Configuration API
Claes Holmerson
claes at it-slav.net
Thu Apr 29 23:05:04 EEST 2004
On Thu, 29 Apr 2004, Waldo Bastian wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thu April 29 2004 13:04, Dave Cridland [Home] wrote:
> > > * Read values from the config.
> >
> > What's a value?
> >
> > It might sound like a pretty obvious thing to answer, but consider the
> > current prior art a bit:
> >
> > Avi, for LR, advocates that everything should be a string.
> >
> > GConf supports a handful of fundamental datatypes, plus lists of any of
> > them, plus pair of any two.
> >
> > KConfig supports stuff like expandable paths and all sorts.
> >
> > ACAP supports structures, but the members can only be strings, or
> > (technically) unordered lists of strings. (I say technically - an ACAP
> > server is allowed to reorder multivalues attributes on a STORE, however,
> > none of them do. A search must be consistent on the order it produces, so
> > there's little value I've seen.)
> >
> > So there you are - four different configuration systems, four different
> > concepts of what a 'value' is.
>
> At the storage level, KConfig considers all values utf-8 strings. When the
> application asks for the value it specifies the desired type and only then
> will the value be converted to that type. With KConfigXT we generate code for
> the access methods so that we get type-safety from the compiler based on the
> type specified in the meta-data. In both cases the backend has no actual
> knowledge about the type.
>
It might be a good idea to borrow some of the primitive data types that
are defined in the XML Schema Spec (Part 2), and use them in the backend
storage.
http://www.w3.org/TR/xmlschema-2/
The types below could be of interest
3.2.1 string
3.2.2 boolean
3.2.3 decimal
3.2.4 float
3.2.5 double
3.2.6 duration
3.2.7 dateTime
3.2.8 time
3.2.9 date
3.2.10 gYearMonth
3.2.11 gYear
3.2.12 gMonthDay
3.2.13 gDay
3.2.14 gMonth
3.2.15 hexBinary
3.2.16 base64Binary
Advantages with this include that they are well defined, including the
lexical representation. And also, libraries that help with parsing of
values from XML documents can hopefully be used to parse strings fetched
from the config API.
Even though XML Schema sometimes is regarded as a failure, its data types
are also used in other schema languages.
Claes
More information about the xdg
mailing list