From 2615896faa646e5830abf2c269150e1165c66515 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- .../cxx/parser/validating/inheritance-map.hxx | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 libxsd/libxsd/cxx/parser/validating/inheritance-map.hxx (limited to 'libxsd/libxsd/cxx/parser/validating/inheritance-map.hxx') diff --git a/libxsd/libxsd/cxx/parser/validating/inheritance-map.hxx b/libxsd/libxsd/cxx/parser/validating/inheritance-map.hxx new file mode 100644 index 0000000..759e074 --- /dev/null +++ b/libxsd/libxsd/cxx/parser/validating/inheritance-map.hxx @@ -0,0 +1,99 @@ +// file : libxsd/cxx/parser/validating/inheritance-map.hxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef LIBXSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX +#define LIBXSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX + +#include +#include // std::size_t + +#include + +namespace xsd +{ + namespace cxx + { + namespace parser + { + namespace validating + { + template + struct string_comparison + { + bool + operator() (const C* x, const C* y) const + { + ro_string s (x); + return s.compare (y) < 0; + } + }; + + template + struct inheritance_map + { + void + insert (const C* derived, const C* base) + { + map_[derived] = base; + } + + void + erase (const C* derived) + { + map_.erase (derived); + } + + bool + check (const C* derived, const ro_string& base) const; + + private: + typedef std::map > map; + map map_; + }; + + + // Translation unit initializer. + // + template + struct inheritance_map_init + { + static inheritance_map* map; + static std::size_t count; + + inheritance_map_init (); + ~inheritance_map_init (); + }; + + template + inheritance_map* inheritance_map_init::map = 0; + + template + std::size_t inheritance_map_init::count = 0; + + template + inline inheritance_map& + inheritance_map_instance () + { + return *inheritance_map_init::map; + } + + + // Map entry initializer. + // + template + struct inheritance_map_entry + { + inheritance_map_entry (const C* derived, const C* base); + ~inheritance_map_entry (); + + private: + const C* derived_; + }; + } + } + } +} + +#include + +#endif // LIBXSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX -- cgit v1.1