From 707cc94fe52463870a9c6c8e2e66eaaa389e601d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 24 Feb 2009 15:16:26 +0200 Subject: Start tracking XSD/e with git after version 3.0.0 --- libxsde/xsde/cxx/parser/map.hxx | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 libxsde/xsde/cxx/parser/map.hxx (limited to 'libxsde/xsde/cxx/parser/map.hxx') diff --git a/libxsde/xsde/cxx/parser/map.hxx b/libxsde/xsde/cxx/parser/map.hxx new file mode 100644 index 0000000..400de27 --- /dev/null +++ b/libxsde/xsde/cxx/parser/map.hxx @@ -0,0 +1,87 @@ +// file : xsde/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 XSDE_CXX_PARSER_MAP_HXX +#define XSDE_CXX_PARSER_MAP_HXX + +#include // size_t + +#include +#include + +#include + +namespace xsde +{ + namespace cxx + { + namespace parser + { + // Parser map. Used in the polymorphic document parsing. + // + class parser_map + { + public: + // 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 char* type) const = 0; + + // Reset the parsers this map contains. + // + virtual void + reset () const = 0; + + virtual + ~parser_map (); + }; + + // Default parser map implementation. + // + class parser_map_impl: public parser_map + { + public: +#ifndef XSDE_EXCEPTIONS + enum error + { + error_none, + error_no_memory + }; + + error + _error () const; +#endif + + public: + parser_map_impl (size_t buckets); + + void + insert (parser_base&); + + virtual parser_base* + find (const char* type) const; + + virtual void + reset () const; + + private: + parser_map_impl (const parser_map_impl&); + + parser_map_impl& + operator= (const parser_map_impl&); + + private: + hashmap map_; + }; + } + } +} + +#include + +#endif // XSDE_CXX_PARSER_MAP_HXX -- cgit v1.1