1 | // file : xsd/cxx/tree/list.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_TREE_LIST_HXX |
---|
7 | #define XSD_CXX_TREE_LIST_HXX |
---|
8 | |
---|
9 | #include <string> |
---|
10 | |
---|
11 | #include <xercesc/dom/DOMAttr.hpp> |
---|
12 | #include <xercesc/dom/DOMElement.hpp> |
---|
13 | |
---|
14 | #include <xsd/cxx/tree/istream-fwd.hxx> // tree::istream |
---|
15 | #include <xsd/cxx/tree/containers.hxx> // fundamental_p, sequence |
---|
16 | |
---|
17 | namespace xsd |
---|
18 | { |
---|
19 | namespace cxx |
---|
20 | { |
---|
21 | namespace tree |
---|
22 | { |
---|
23 | // Class template for xsd:list mapping. Based on the sequence |
---|
24 | // template. Note that I cannot get rid of 'fund' because HP |
---|
25 | // aCC3 likes it this way. |
---|
26 | // |
---|
27 | template <typename X, typename C, bool fund = fundamental_p<X>::r> |
---|
28 | class list; |
---|
29 | |
---|
30 | |
---|
31 | // |
---|
32 | // |
---|
33 | template <typename X, typename C> |
---|
34 | class list<X, C, false>: public sequence<X> |
---|
35 | { |
---|
36 | public: |
---|
37 | explicit |
---|
38 | list (flags f = 0, container* c = 0) |
---|
39 | : sequence<X> (f, c) |
---|
40 | { |
---|
41 | } |
---|
42 | |
---|
43 | list (typename sequence<X>::size_type n, const X& x) |
---|
44 | : sequence<X> (n, x) |
---|
45 | { |
---|
46 | } |
---|
47 | |
---|
48 | template<typename I> |
---|
49 | list (const I& b, const I& e) |
---|
50 | : sequence<X> (b, e) |
---|
51 | { |
---|
52 | } |
---|
53 | |
---|
54 | template <typename S> |
---|
55 | list (istream<S>&, flags = 0, container* c = 0); |
---|
56 | |
---|
57 | list (const list<X, C, false>& v, flags f = 0, container* c = 0) |
---|
58 | : sequence<X> (v, f, c) |
---|
59 | { |
---|
60 | } |
---|
61 | |
---|
62 | public: |
---|
63 | list (const xercesc::DOMElement&, flags = 0, container* c = 0); |
---|
64 | |
---|
65 | list (const xercesc::DOMAttr&, flags = 0, container* c = 0); |
---|
66 | |
---|
67 | list (const std::basic_string<C>&, |
---|
68 | const xercesc::DOMElement*, |
---|
69 | flags = 0, |
---|
70 | container* c = 0); |
---|
71 | |
---|
72 | private: |
---|
73 | void |
---|
74 | init (const std::basic_string<C>&, const xercesc::DOMElement*); |
---|
75 | }; |
---|
76 | |
---|
77 | |
---|
78 | // |
---|
79 | // |
---|
80 | template <typename X, typename C> |
---|
81 | class list<X, C, true>: public sequence<X> |
---|
82 | { |
---|
83 | public: |
---|
84 | explicit |
---|
85 | list (flags f = 0, container* c = 0) |
---|
86 | : sequence<X> (f, c) |
---|
87 | { |
---|
88 | } |
---|
89 | |
---|
90 | explicit |
---|
91 | list (typename sequence<X>::size_type n, const X& x) |
---|
92 | : sequence<X> (n, x) |
---|
93 | { |
---|
94 | } |
---|
95 | |
---|
96 | template<typename I> |
---|
97 | list (const I& b, const I& e) |
---|
98 | : sequence<X> (b, e) |
---|
99 | { |
---|
100 | } |
---|
101 | |
---|
102 | template <typename S> |
---|
103 | list (istream<S>&, flags = 0, container* c = 0); |
---|
104 | |
---|
105 | list (const list<X, C, true>& s, flags f = 0, container* c = 0) |
---|
106 | : sequence<X> (s, f, c) |
---|
107 | { |
---|
108 | } |
---|
109 | |
---|
110 | public: |
---|
111 | list (const xercesc::DOMElement&, flags = 0, container* c = 0); |
---|
112 | |
---|
113 | list (const xercesc::DOMAttr&, flags = 0, container* c = 0); |
---|
114 | |
---|
115 | list (const std::basic_string<C>&, |
---|
116 | const xercesc::DOMElement*, |
---|
117 | flags = 0, |
---|
118 | container* c = 0); |
---|
119 | |
---|
120 | private: |
---|
121 | void |
---|
122 | init (const std::basic_string<C>&, const xercesc::DOMElement*); |
---|
123 | }; |
---|
124 | } |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | #endif // XSD_CXX_TREE_LIST_HXX |
---|