From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/parser/map.hxx | 79 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 libxsd/xsd/cxx/parser/map.hxx (limited to 'libxsd/xsd/cxx/parser/map.hxx') diff --git a/libxsd/xsd/cxx/parser/map.hxx b/libxsd/xsd/cxx/parser/map.hxx new file mode 100644 index 0000000..7d3696a --- /dev/null +++ b/libxsd/xsd/cxx/parser/map.hxx @@ -0,0 +1,79 @@ +// file : xsd/cxx/parser/map.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_PARSER_MAP_HXX +#define XSD_CXX_PARSER_MAP_HXX + +#include +#include + +#include +#include + +namespace xsd +{ + namespace cxx + { + namespace parser + { + // Parser map. Used in the polymorphic document parsing. + // + template + struct parser_map + { + virtual + ~parser_map (); + + // The type argument is the type name and namespace from the + // xsi:type attribute or substitution group map in the form + // " " with the space and namespace part + // absent if the type does not have a namespace. + // + virtual parser_base* + find (const ro_string& type) const = 0; + }; + + + // Parser map implementation. + // + template + struct parser_map_impl: parser_map + { + parser_map_impl (); + + void + insert (parser_base&); + + virtual parser_base* + find (const ro_string& type) const; + + private: + parser_map_impl (const parser_map_impl&); + + parser_map_impl& + operator= (const parser_map_impl&); + + private: + struct string_comparison + { + bool + operator() (const C* x, const C* y) const + { + ro_string s (x); + return s.compare (y) < 0; + } + }; + + typedef std::map*, string_comparison> map; + map map_; + }; + } + } +} + +#include +#include + +#endif // XSD_CXX_PARSER_MAP_HXX -- cgit v1.1