From e4c22d3686da0e973e21eae0561c1169c0eeff36 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Mar 2009 17:09:53 +0200 Subject: Implement support for XML Schema polymorphism in C++/Hybrid examples/cxx/hybrid/polyroot/ examples/cxx/hybrid/polymorphism/: new examples tests/cxx/hybrid/polymorphism/: new tests --- libxsde/xsde/cxx/hybrid/serializer-map.hxx | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 libxsde/xsde/cxx/hybrid/serializer-map.hxx (limited to 'libxsde/xsde/cxx/hybrid/serializer-map.hxx') diff --git a/libxsde/xsde/cxx/hybrid/serializer-map.hxx b/libxsde/xsde/cxx/hybrid/serializer-map.hxx new file mode 100644 index 0000000..5e3fb1a --- /dev/null +++ b/libxsde/xsde/cxx/hybrid/serializer-map.hxx @@ -0,0 +1,52 @@ +// file : xsde/cxx/hybrid/serializer-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_HYBRID_SERIALIZER_MAP_HXX +#define XSDE_CXX_HYBRID_SERIALIZER_MAP_HXX + +#include // size_t + +#include + +namespace xsde +{ + namespace cxx + { + namespace hybrid + { + class serializer_map_impl: public serializer::serializer_map + { + public: + struct entry + { + const char* type_id; + serializer::serializer_base* serializer; + }; + + serializer_map_impl (entry* entries, size_t size) + : entries_ (entries), size_ (size), resetting_ (true) + { + } + + virtual serializer::serializer_base* + find (const void* type_id) const; + + virtual void + reset () const; + + private: + serializer_map_impl (const serializer_map_impl&); + serializer_map_impl& operator= (const serializer_map_impl&); + + private: + entry* entries_; + size_t size_; + bool resetting_; + }; + } + } +} + +#endif // XSDE_CXX_HYBRID_SERIALIZER_MAP_HXX -- cgit v1.1