From 884dea7531962b17ef843ac2175faa050e8b0758 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Apr 2014 12:57:06 +0200 Subject: Add support for ordered types, mixed content --- libxsd/xsd/cxx/tree/elements.hxx | 40 +++++++++++++++++++++++++++++++++++++++- libxsd/xsd/cxx/tree/elements.ixx | 21 +++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) (limited to 'libxsd/xsd/cxx/tree') diff --git a/libxsd/xsd/cxx/tree/elements.hxx b/libxsd/xsd/cxx/tree/elements.hxx index 6270c40..89be61e 100644 --- a/libxsd/xsd/cxx/tree/elements.hxx +++ b/libxsd/xsd/cxx/tree/elements.hxx @@ -21,6 +21,7 @@ #include #include #include // std::auto_ptr/unique_ptr +#include // std::size_t #include #include #include @@ -190,7 +191,6 @@ namespace xsd unsigned long x_; }; - // Parsing properties. Refer to xsd/cxx/xml/elements.hxx for XML- // related properties. // @@ -199,6 +199,44 @@ namespace xsd { }; + /** + * @brief Content order sequence entry. + * + * @nosubgrouping + */ + struct content_order + { + /** + * @brief Initialize an instance with passed id and index. + * + * @param id Content id. + * @param index Content index in the corresponding sequence. + */ + content_order (std::size_t id, std::size_t index = 0) + : id (id), index (index) + { + } + + /** + * @brief Content id. + */ + std::size_t id; + + /** + * @brief Content index. + */ + std::size_t index; + }; + + bool + operator== (const content_order&, const content_order&); + + bool + operator!= (const content_order&, const content_order&); + + bool + operator< (const content_order&, const content_order&); + //@cond // DOM user data keys. diff --git a/libxsd/xsd/cxx/tree/elements.ixx b/libxsd/xsd/cxx/tree/elements.ixx index 1098299..da8a83e 100644 --- a/libxsd/xsd/cxx/tree/elements.ixx +++ b/libxsd/xsd/cxx/tree/elements.ixx @@ -8,6 +8,27 @@ namespace xsd { namespace tree { + // content_order_type + // + + inline bool + operator== (const content_order& x, const content_order& y) + { + return x.id == y.id && x.index == y.index; + } + + inline bool + operator!= (const content_order& x, const content_order& y) + { + return !(x == y); + } + + inline bool + operator< (const content_order& x, const content_order& y) + { + return x.id < y.id || (x.id == y.id && x.index < y.index); + } + // type // -- cgit v1.1