Revision 111, 1.7 kB
(checked in by mido, 17 years ago)
|
pridana knihovna XSD (a jeji chlebodarkyne XERCES), v ramci Win32 zprovoznen priklad tests/test_xsd_hello.cxx
|
Line | |
---|
1 | // file : xsd/cxx/parser/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_MAP_HXX |
---|
7 | #define XSD_CXX_PARSER_MAP_HXX |
---|
8 | |
---|
9 | #include <map> |
---|
10 | #include <string> |
---|
11 | |
---|
12 | #include <xsd/cxx/ro-string.hxx> |
---|
13 | #include <xsd/cxx/parser/elements.hxx> |
---|
14 | |
---|
15 | namespace xsd |
---|
16 | { |
---|
17 | namespace cxx |
---|
18 | { |
---|
19 | namespace parser |
---|
20 | { |
---|
21 | // Parser map. Used in the polymorphic document parsing. |
---|
22 | // |
---|
23 | template <typename C> |
---|
24 | struct parser_map |
---|
25 | { |
---|
26 | virtual |
---|
27 | ~parser_map (); |
---|
28 | |
---|
29 | // The type argument is the type name and namespace from the |
---|
30 | // xsi:type attribute or substitution group map in the form |
---|
31 | // "<name> <namespace>" with the space and namespace part |
---|
32 | // absent if the type does not have a namespace. |
---|
33 | // |
---|
34 | virtual parser_base<C>* |
---|
35 | find (const ro_string<C>& type) = 0; |
---|
36 | }; |
---|
37 | |
---|
38 | |
---|
39 | // Parser map implementation. |
---|
40 | // |
---|
41 | template <typename C> |
---|
42 | struct parser_map_impl: parser_map<C> |
---|
43 | { |
---|
44 | virtual |
---|
45 | ~parser_map_impl (); |
---|
46 | |
---|
47 | parser_map_impl () |
---|
48 | : map_ (0) |
---|
49 | { |
---|
50 | } |
---|
51 | |
---|
52 | void |
---|
53 | insert (const C* type, parser_base<C>&); |
---|
54 | |
---|
55 | virtual parser_base<C>* |
---|
56 | find (const ro_string<C>& type); |
---|
57 | |
---|
58 | private: |
---|
59 | parser_map_impl (const parser_map_impl&); |
---|
60 | |
---|
61 | parser_map_impl& |
---|
62 | operator= (const parser_map_impl&); |
---|
63 | |
---|
64 | private: |
---|
65 | typedef std::map<std::basic_string<C>, parser_base<C>*> map; |
---|
66 | |
---|
67 | map* map_; |
---|
68 | }; |
---|
69 | } |
---|
70 | } |
---|
71 | } |
---|
72 | |
---|
73 | #include <xsd/cxx/parser/map.txx> |
---|
74 | |
---|
75 | #endif // XSD_CXX_PARSER_MAP_HXX |
---|