
Integral types
--------------

8-bit

"byte"                 signed char                          byte
"unsignedByte"         unsigned char                        unsigned_byte

16-bit

"short"                short                                short_
"unsignedShort"        unsigned short                       unsigned_short

32-bit

"int"                  int                                  int_
"unsignedInt"          unsigned int                         unsigned_int

64-bit

"long"                 long long [long]                     long_
"unsignedLong"         unsigned long long [unsigned long]   unsigned_long


Arbitrary length

"integer"              long long                            integer
"nonPositiveInteger"   integer                              non_positive_integer
"nonNegativeInteger"   integer                              non_negative_integer
"positiveInteger"      integer                              positive_integer
"negativeInteger"      integer                              negative_integer


Boolean
-------

"boolean"              bool                                 boolean


Floating-point types
--------------------

"float"                float                                float_
"double"               double                               double_
"decimal"              long double                          decimal


String types
------------

"string"               <type derived from std::basic_string> string
"normalizedString"     <type derived from string>            normalized_string
"token"                <type derived from normalized_string> token
"Name"                 <type derived from token>             name
"NMTOKEN"              <type derived from token>             nmtoken
"NMTOKENS"             <type derived from vector<nmtoken> >  nmtokens
"NCName"               <type derived from name>              ncname
"language"             <type derived from token>             language


Qualified name
--------------

"QName"                <uri, ncname>                         qname


ID/IDREF
--------

"ID"                   <type derived from ncname>            id
"IDREF"                <type derived from ncname>            idref
"IDREFS"               <type derived from vector<idref> >    idrefs

URI
---
"anyURI"               <type derived from std::basic_string> uri

Binary
------
"base64Binary"         <type derived from std::basic_string> base64_binary
"hexBinary"            <type derived from std::basic_string> hex_binary

Date/time
---------

"date"                 <type derived from std::basic_string> date
"dateTime"             <type derived from std::basic_string> date_time
"duration"             <type derived from std::basic_string> duration
"gDay"                 <type derived from std::basic_string> day
"gMonth"               <type derived from std::basic_string> month
"gMonthDay"            <type derived from std::basic_string> month_day
"gYear"                <type derived from std::basic_string> year
"gYearMonth"           <type derived from std::basic_string> year_month
"time"                 <type derived from std::basic_string> time

Entity
------
"ENTITY"               <type derived from name>              entity
"ENTITIES"             <type derived from vector<entity> >   entities



Simple Type
-----------

  @@ Parser will need to return smart_ptr<type>

  One
  ---
  public:
    type const&
    name () const;

    type&
    name ();

    void
    name (type const&);

  protected:
    type name_;


  [I can do better by returning certain types by value (like char)]


  Optional
  --------
  public:
    type const*
    name () const;

    type*
    name ();

    void
    name (type const&);

    void
    name (type const*);

  protected:
    optional<type> name_;


  template <typename x>
  struct optional
  {
    optional ()
  };


  Sequence
  --------
  public:
    sequence<type> const&
    name () const;

    sequence<type>&
    name ();

    void
    name (sequence<type> const&);

  protected:
    sequence<type> name_;


Complex Type
-----------

  One
  ---

  public:
    type const&
    name () const;

    type&
    name ();

    void
    name (type const&); // Uses clone() to avoid slicing.

    void
    name (smart_ptr<type>&); // Assumes ownership. Can be overloaded for
                             // various smart_ptr (std::auto_ptr).

  protected:
    smart_ptr<type> name_;


  Optional
  --------
  public:
    type const*
    name () const;

    type*
    name ();

    void
    name (type const&); // Uses clone() to avoid slicing.

    void
    name (type const*); // Uses clone() to avoid slicing.

    void
    name (smart_ptr<type>&); // Assumes ownership. Can be overloaded for
                             // various smart_ptr (std::auto_ptr).

  protected:
    smart_ptr<type> name_;


  if (type* i = foo.name ())
  {
    f (*i);
  }

  if (foo.name ())
  {
    f (foo.name ().value);
  }

  Sequence
  --------
    @@ Special "polymorphism-aware" sequence template. Uses clone() to
       avoid slicing.

  public:
    sequence<type const&>
    name () const;

    sequence<type&>&
    name ();

    void
    name (sequence<type const&> const&);

  protected:
    sequence<type&> name_;
