root/win32/xsd-3.1.0-i686/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx @ 111

Revision 111, 2.1 kB (checked in by mido, 16 years ago)

pridana knihovna XSD (a jeji chlebodarkyne XERCES), v ramci Win32 zprovoznen priklad tests/test_xsd_hello.cxx

RevLine 
[111]1// file      : xsd/cxx/parser/validating/inheritance-map.hxx
2// author    : Boris Kolpackov <boris@codesynthesis.com>
3// copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC
4// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
5
6#ifndef XSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX
7#define XSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX
8
9#include <map>
10#include <cstddef> // std::size_t
11
12#include <xsd/cxx/ro-string.hxx>
13
14namespace xsd
15{
16  namespace cxx
17  {
18    namespace parser
19    {
20      namespace validating
21      {
22        template <typename C>
23        struct string_comparison
24        {
25          bool
26          operator() (const C* x, const C* y) const
27          {
28            ro_string<C> s (x);
29            return s.compare (y) < 0;
30          }
31        };
32
33        template <typename C>
34        struct inheritance_map
35        {
36          void
37          insert (const C* derived, const C* base)
38          {
39            map_[derived] = base;
40          }
41
42          bool
43          check (const C* derived, const ro_string<C>& base) const;
44
45        private:
46          typedef std::map<const C*, const C*, string_comparison<C> > map;
47          map map_;
48        };
49
50
51        // Translation unit initializer.
52        //
53        template<typename C>
54        struct inheritance_map_init
55        {
56          static inheritance_map<C>* map;
57          static std::size_t count;
58
59          inheritance_map_init ();
60          ~inheritance_map_init ();
61        };
62
63        template<typename C>
64        inheritance_map<C>* inheritance_map_init<C>::map = 0;
65
66        template<typename C>
67        std::size_t inheritance_map_init<C>::count = 0;
68
69        template<typename C>
70        inline inheritance_map<C>&
71        inheritance_map_instance ()
72        {
73          return *inheritance_map_init<C>::map;
74        }
75
76
77        // Map entry initializer.
78        //
79        template<typename C>
80        struct inheritance_map_entry
81        {
82          inheritance_map_entry (const C* derived, const C* base);
83        };
84      }
85    }
86  }
87}
88
89#include <xsd/cxx/parser/validating/inheritance-map.txx>
90
91#endif  // XSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX
Note: See TracBrowser for help on using the browser.