From b7197929af1cca15e490703ba3632ae52a348b60 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Oct 2010 12:21:35 +0200 Subject: New mapping for anyType with support for polymorphism --- documentation/cxx/hybrid/guide/index.xhtml | 87 ++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'documentation') diff --git a/documentation/cxx/hybrid/guide/index.xhtml b/documentation/cxx/hybrid/guide/index.xhtml index 7d33a4e..b3edc1d 100644 --- a/documentation/cxx/hybrid/guide/index.xhtml +++ b/documentation/cxx/hybrid/guide/index.xhtml @@ -270,6 +270,7 @@ 5.11Mapping for gYear 5.12Mapping for gYearMonth 5.13Mapping for time + 5.14Mapping for anyType @@ -4599,6 +4600,21 @@ for (supermen::person_iterator i = sm->person ().begin (); time Section 5.13, "Mapping for time" + + + anyType and anySimpleType + + + anyType + any_type + Section 5.14, "Mapping for anyType" + + + anySimpleType + any_simple_type + std::string or char*
+ Section 3.1, "Standard Template Library" +

As you can see from the table above a number of built-in @@ -5644,6 +5660,77 @@ namespace xml_schema } +

5.14 Mapping for anyType

+ +

The anyType built-in XML Schema type is mapped to + the any_type class in the xml_schema + namespace. With C++ exceptions enabled (Section 3.3, + "C++ Exceptions"), it has the following interface:

+ +
+namespace xml_schema
+{
+  class any_type
+  {
+  public:
+    // Custom data.
+    //
+    typedef xml_schema::data_sequence custom_data_sequence;
+    typedef custom_data_sequence::iterator custom_data_iterator;
+    typedef custom_data_sequence::const_iterator custom_data_const_iterator;
+
+    void
+    allocate_custom_data ();
+
+    const custom_data_sequence&
+    custom_data () const;
+
+    custom_data_sequence&
+    custom_data ();
+  };
+}
+  
+ +

If C++ exceptions are disabled, the any_type class has + the following interface:

+ +
+namespace xml_schema
+{
+  class any_type
+  {
+  public:
+    // Custom data.
+    //
+    typedef xml_schema::data_sequence custom_data_sequence;
+    typedef custom_data_sequence::iterator custom_data_iterator;
+    typedef custom_data_sequence::const_iterator custom_data_const_iterator;
+
+    bool
+    allocate_custom_data ();
+
+    const custom_data_sequence&
+    custom_data () const;
+
+    custom_data_sequence&
+    custom_data ();
+  };
+}
+  
+ +

The allocate_custom_data() function allocates the + custom data sequence. With C++ exceptions disabled, it returns + false if memory allocation has failed and true + otherwise. For more information on custom data, refer to + Section 4.9, "Customizing the Object Model".

+ +

The default parser and serializer implementations for the + anyType built-in type ignore all its content and + return an empty any_type instance. If your application + needs to access this content, then you will need to provide your + own implementations of these parser and serializer and use the + custom data sequence to store the extracted data.

+

6 Parsing and Serialization

-- cgit v1.1