W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2009

[WebIDL] enum

From: Marcin Hanclik <Marcin.Hanclik@access-company.com>
Date: Mon, 16 Nov 2009 16:15:23 +0100
To: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <FAA1D89C5BAF1142A74AF116630A9F2C28942D7465@OBEEX01.obe.access-company.com>
Hi,

To facilitate the comprehension of the interfaces specified in WebIDL, I think we need to have some way of specifying enumerated values.
At present we define constants and associate them with the attributes in the prose.
E.g. in HTML5 we have:

  const unsigned short NETWORK_EMPTY = 0;
  const unsigned short NETWORK_IDLE = 1;
  const unsigned short NETWORK_LOADING = 2;
  const unsigned short NETWORK_NO_SOURCE = 3;
  readonly attribute unsigned short networkState;

media . networkState
Returns the current state of network activity for the element, from the codes in the list below.

To ease the process of comprehension of the interfaces, we could have e.g.
  [EnumFor=networkState]
  const unsigned short NETWORK_EMPTY = 0;
  [EnumFor=networkState]
  const unsigned short NETWORK_IDLE = 1;
  [EnumFor=networkState]
  const unsigned short NETWORK_LOADING = 2;
  [EnumFor=networkState]
  const unsigned short NETWORK_NO_SOURCE = 3;

  readonly attribute unsigned short networkState;

Alternatively WebIDL could have the "enum" keyword with some specific syntax.
The realization of this functionality does not, however, matter as much as the need to have it specified.

Thanks,
Marcin

Marcin Hanclik
ACCESS Systems Germany GmbH
Tel: +49-208-8290-6452  |  Fax: +49-208-8290-6465
Mobile: +49-163-8290-646
E-Mail: marcin.hanclik@access-company.com


________________________________________

Access Systems Germany GmbH
Essener Strasse 5  |  D-46047 Oberhausen
HRB 13548 Amtsgericht Duisburg
Geschaeftsfuehrer: Michel Piquemal, Tomonori Watanabe, Yusuke Kanda

www.access-company.com

CONFIDENTIALITY NOTICE
This e-mail and any attachments hereto may contain information that is privileged or confidential, and is intended for use only by the
individual or entity to which it is addressed. Any disclosure, copying or distribution of the information by anyone else is strictly prohibited.
If you have received this document in error, please notify us promptly by responding to this e-mail. Thank you.
Received on Monday, 16 November 2009 15:42:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC