Branch data Line data Source code
1 : : // file : xsd/cxx/tree/types.hxx
2 : : // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
3 : : // license : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 : :
5 : : /**
6 : : * @file
7 : : *
8 : : * @brief Contains C++ class definitions for XML Schema built-in types.
9 : : *
10 : : * This is an internal header and is included by the generated code. You
11 : : * normally should not include it directly.
12 : : *
13 : : */
14 : :
15 : : #ifndef XSD_CXX_TREE_TYPES_HXX
16 : : #define XSD_CXX_TREE_TYPES_HXX
17 : :
18 : : #include <string>
19 : : #include <cstddef> // std::size_t
20 : :
21 : : #include <xercesc/dom/DOMAttr.hpp>
22 : : #include <xercesc/dom/DOMElement.hpp>
23 : :
24 : : #include <xsd/cxx/tree/elements.hxx>
25 : : #include <xsd/cxx/tree/list.hxx>
26 : : #include <xsd/cxx/tree/buffer.hxx>
27 : : #include <xsd/cxx/tree/istream-fwd.hxx>
28 : :
29 : : #include <xsd/cxx/tree/date-time.hxx>
30 : :
31 : : namespace xsd
32 : : {
33 : : namespace cxx
34 : : {
35 : : /**
36 : : * @brief C++/Tree mapping runtime namespace.
37 : : *
38 : : * This is an internal namespace and normally should not be referenced
39 : : * directly. Instead you should use the aliases for types in this
40 : : * namespaces that are created in the generated code.
41 : : *
42 : : */
43 : : namespace tree
44 : : {
45 : : /**
46 : : * @brief Class corresponding to the XML Schema %string built-in
47 : : * type.
48 : : *
49 : : * The %string class publicly inherits from and has the same set
50 : : * of constructors as @c std::basic_string. It therefore can be
51 : : * used as @c std::string (or @c std::wstring if you are using
52 : : * @c wchar_t as the character type).
53 : : *
54 : : * @nosubgrouping
55 : : */
56 : : template <typename C, typename B>
57 : 10 : class string: public B, public std::basic_string<C>
58 : : {
59 : : typedef std::basic_string<C> base_type;
60 : :
61 : : base_type&
62 : : base ()
63 : : {
64 : : return *this;
65 : : }
66 : :
67 : : public:
68 : : /**
69 : : * @name Constructors
70 : : */
71 : : //@{
72 : :
73 : : /**
74 : : * @brief Default constructor creates an empty %string.
75 : : */
76 : : string ()
77 : 0 : {
78 : : }
79 : :
80 : : /**
81 : : * @brief Initialize an instance with a copy of a C %string.
82 : : *
83 : : * @param s A C %string to copy.
84 : : */
85 : 0 : string (const C* s)
86 [ # # ]: 0 : : base_type (s)
87 : : {
88 : 0 : }
89 : :
90 : : /**
91 : : * @brief Initialize an instance with a character array.
92 : : *
93 : : * @param s A character array to copy.
94 : : * @param n A number of character to copy.
95 : : */
96 : : string (const C* s, std::size_t n)
97 : : : base_type (s, n)
98 : : {
99 : : }
100 : :
101 : : /**
102 : : * @brief Initialize an instance with multiple copies of the same
103 : : * character.
104 : : *
105 : : * @param n A number of copies to create.
106 : : * @param c A character to copy.
107 : : */
108 : : string (std::size_t n, C c)
109 : : : base_type (n, c)
110 : : {
111 : : }
112 : :
113 : : /**
114 : : * @brief Initialize an instance with a copy of a standard %string.
115 : : *
116 : : * @param s A standard %string to copy.
117 : : */
118 : 0 : string (const std::basic_string<C>& s)
119 : 0 : : base_type (s)
120 : : {
121 : 0 : }
122 : :
123 : : /**
124 : : * @brief Initialize an instance with a copy of a substring.
125 : : *
126 : : * @param s A standard %string to copy the substring from.
127 : : * @param pos An index of the first character to copy from.
128 : : * @param n A number of characters to copy.
129 : : */
130 : : string (const std::basic_string<C>& s,
131 : : std::size_t pos,
132 : : std::size_t n = std::basic_string<C>::npos)
133 : : : base_type (s, pos, n)
134 : : {
135 : : }
136 : :
137 : : public:
138 : : /**
139 : : * @brief Copy constructor.
140 : : *
141 : : * @param x An instance to make a copy of.
142 : : * @param f Flags to create the copy with.
143 : : * @param c A pointer to the object that will contain the copy.
144 : : *
145 : : * For polymorphic object models use the @c _clone function instead.
146 : : */
147 : 0 : string (const string& x, flags f = 0, container* c = 0)
148 : 0 : : B (x, f, c), base_type (x)
149 : : {
150 : 0 : }
151 : :
152 : : /**
153 : : * @brief Copy the instance polymorphically.
154 : : *
155 : : * @param f Flags to create the copy with.
156 : : * @param c A pointer to the object that will contain the copy.
157 : : * @return A pointer to the dynamically allocated copy.
158 : : *
159 : : * This function ensures that the dynamic type of the instance
160 : : * is used for copying and should be used for polymorphic object
161 : : * models instead of the copy constructor.
162 : : */
163 : : virtual string*
164 : : _clone (flags f = 0, container* c = 0) const;
165 : :
166 : : public:
167 : : /**
168 : : * @brief Create an instance from a data representation
169 : : * stream.
170 : : *
171 : : * @param s A stream to extract the data from.
172 : : * @param f Flags to create the new instance with.
173 : : * @param c A pointer to the object that will contain the new
174 : : * instance.
175 : : */
176 : : template <typename S>
177 : : string (istream<S>& s, flags f = 0, container* c = 0);
178 : :
179 : : /**
180 : : * @brief Create an instance from a DOM element.
181 : : *
182 : : * @param e A DOM element to extract the data from.
183 : : * @param f Flags to create the new instance with.
184 : : * @param c A pointer to the object that will contain the new
185 : : * instance.
186 : : */
187 : : string (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
188 : :
189 : : /**
190 : : * @brief Create an instance from a DOM Attribute.
191 : : *
192 : : * @param a A DOM attribute to extract the data from.
193 : : * @param f Flags to create the new instance with.
194 : : * @param c A pointer to the object that will contain the new
195 : : * instance.
196 : : */
197 : : string (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
198 : :
199 : : /**
200 : : * @brief Create an instance from a %string fragment.
201 : : *
202 : : * @param s A %string fragment to extract the data from.
203 : : * @param e A pointer to DOM element containing the %string fragment.
204 : : * @param f Flags to create the new instance with.
205 : : * @param c A pointer to the object that will contain the new
206 : : * instance.
207 : : */
208 : : string (const std::basic_string<C>& s,
209 : : const xercesc::DOMElement* e,
210 : : flags f = 0,
211 : : container* c = 0);
212 : : //@}
213 : :
214 : : public:
215 : : /**
216 : : * @brief Assign a character to the instance.
217 : : *
218 : : * The resulting %string has only one character.
219 : : *
220 : : * @param c A character to assign.
221 : : * @return A reference to the instance.
222 : : */
223 : : string&
224 : : operator= (C c)
225 : : {
226 : : base () = c;
227 : : return *this;
228 : : }
229 : :
230 : : /**
231 : : * @brief Assign a C %string to the instance.
232 : : *
233 : : * The resulting %string contains a copy of the C %string.
234 : : *
235 : : * @param s A C %string to assign.
236 : : * @return A reference to the instance.
237 : : */
238 : : string&
239 : : operator= (const C* s)
240 : : {
241 : : base () = s;
242 : : return *this;
243 : : }
244 : :
245 : : /**
246 : : * @brief Assign a standard %string to the instance.
247 : : *
248 : : * The resulting %string contains a copy of the standard %string.
249 : : *
250 : : * @param s A standard %string to assign.
251 : : * @return A reference to the instance.
252 : : */
253 : : string&
254 : : operator= (const std::basic_string<C>& s)
255 : : {
256 : : base () = s;
257 : : return *this;
258 : : }
259 : :
260 : : /**
261 : : * @brief Copy assignment operator.
262 : : *
263 : : * @param x An instance to assign.
264 : : * @return A reference to the instance.
265 : : */
266 : : string&
267 : : operator= (const string& x)
268 : : {
269 : : base () = x;
270 : : return *this;
271 : : }
272 : : };
273 : :
274 : : /**
275 : : * @brief %string comparison operator.
276 : : *
277 : : * @return True if the strings are equal, false otherwise.
278 : : */
279 : : template <typename C, typename B>
280 : : inline bool
281 : : operator== (const string<C, B>& a, const string<C, B>& b)
282 : : {
283 : 0 : return static_cast<const std::basic_string<C>&> (a) == b;
284 : : }
285 : :
286 : : /**
287 : : * @brief %string comparison operator.
288 : : *
289 : : * @return True if the strings are not equal, false otherwise.
290 : : */
291 : : template <typename C, typename B>
292 : : inline bool
293 : : operator!= (const string<C, B>& a, const string<C, B>& b)
294 : : {
295 : : return !(a == b);
296 : : }
297 : :
298 : : /**
299 : : * @brief Class corresponding to the XML Schema normalizedString
300 : : * built-in type.
301 : : *
302 : : * The %normalized_string class publicly inherits from and has
303 : : * the same set of constructors as @c std::basic_string. It
304 : : * therefore can be used as @c std::string (or @c std::wstring
305 : : * if you are using @c wchar_t as the character type).
306 : : *
307 : : * @nosubgrouping
308 : : */
309 : : template <typename C, typename B>
310 : : class normalized_string: public B
311 : : {
312 : : typedef B base_type;
313 : :
314 : : base_type&
315 : : base ()
316 : : {
317 : : return *this;
318 : : }
319 : :
320 : : public:
321 : : /**
322 : : * @name Constructors
323 : : */
324 : : //@{
325 : :
326 : : /**
327 : : * @brief Default constructor creates an empty %normalized_string.
328 : : */
329 : : normalized_string ()
330 : : {
331 : : }
332 : :
333 : : /**
334 : : * @brief Initialize an instance with a copy of a C %string.
335 : : *
336 : : * @param s A C %string to copy.
337 : : */
338 : : normalized_string (const C* s)
339 : : : base_type (s)
340 : : {
341 : : }
342 : :
343 : : /**
344 : : * @brief Initialize an instance with a character array.
345 : : *
346 : : * @param s A character array to copy.
347 : : * @param n A number of character to copy.
348 : : */
349 : : normalized_string (const C* s, std::size_t n)
350 : : : base_type (s, n)
351 : : {
352 : : }
353 : :
354 : : /**
355 : : * @brief Initialize an instance with multiple copies of the same
356 : : * character.
357 : : *
358 : : * @param n A number of copies to create.
359 : : * @param c A character to copy.
360 : : */
361 : : normalized_string (std::size_t n, C c)
362 : : : base_type (n, c)
363 : : {
364 : : }
365 : :
366 : : /**
367 : : * @brief Initialize an instance with a copy of a standard %string.
368 : : *
369 : : * @param s A standard %string to copy.
370 : : */
371 : : normalized_string (const std::basic_string<C>& s)
372 : : : base_type (s)
373 : : {
374 : : }
375 : :
376 : : /**
377 : : * @brief Initialize an instance with a copy of a substring.
378 : : *
379 : : * @param s A standard %string to copy the substring from.
380 : : * @param pos An index of the first character to copy from.
381 : : * @param n A number of characters to copy.
382 : : */
383 : : normalized_string (const std::basic_string<C>& s,
384 : : std::size_t pos,
385 : : std::size_t n = std::basic_string<C>::npos)
386 : : : base_type (s, pos, n)
387 : : {
388 : : }
389 : :
390 : : public:
391 : : /**
392 : : * @brief Copy constructor.
393 : : *
394 : : * @param x An instance to make a copy of.
395 : : * @param f Flags to create the copy with.
396 : : * @param c A pointer to the object that will contain the copy.
397 : : *
398 : : * For polymorphic object models use the @c _clone function instead.
399 : : */
400 : : normalized_string (const normalized_string& x,
401 : : flags f = 0,
402 : : container* c = 0)
403 : : : base_type (x, f, c)
404 : : {
405 : : }
406 : :
407 : : /**
408 : : * @brief Copy the instance polymorphically.
409 : : *
410 : : * @param f Flags to create the copy with.
411 : : * @param c A pointer to the object that will contain the copy.
412 : : * @return A pointer to the dynamically allocated copy.
413 : : *
414 : : * This function ensures that the dynamic type of the instance
415 : : * is used for copying and should be used for polymorphic object
416 : : * models instead of the copy constructor.
417 : : */
418 : : virtual normalized_string*
419 : : _clone (flags f = 0, container* c = 0) const;
420 : :
421 : : public:
422 : : /**
423 : : * @brief Create an instance from a data representation
424 : : * stream.
425 : : *
426 : : * @param s A stream to extract the data from.
427 : : * @param f Flags to create the new instance with.
428 : : * @param c A pointer to the object that will contain the new
429 : : * instance.
430 : : */
431 : : template <typename S>
432 : : normalized_string (istream<S>& s, flags f = 0, container* c = 0);
433 : :
434 : : /**
435 : : * @brief Create an instance from a DOM element.
436 : : *
437 : : * @param e A DOM element to extract the data from.
438 : : * @param f Flags to create the new instance with.
439 : : * @param c A pointer to the object that will contain the new
440 : : * instance.
441 : : */
442 : : normalized_string (const xercesc::DOMElement& e,
443 : : flags f = 0,
444 : : container* c = 0);
445 : :
446 : : /**
447 : : * @brief Create an instance from a DOM Attribute.
448 : : *
449 : : * @param a A DOM attribute to extract the data from.
450 : : * @param f Flags to create the new instance with.
451 : : * @param c A pointer to the object that will contain the new
452 : : * instance.
453 : : */
454 : : normalized_string (const xercesc::DOMAttr& a,
455 : : flags f = 0,
456 : : container* c = 0);
457 : :
458 : : /**
459 : : * @brief Create an instance from a %string fragment.
460 : : *
461 : : * @param s A %string fragment to extract the data from.
462 : : * @param e A pointer to DOM element containing the %string fragment.
463 : : * @param f Flags to create the new instance with.
464 : : * @param c A pointer to the object that will contain the new
465 : : * instance.
466 : : */
467 : : normalized_string (const std::basic_string<C>& s,
468 : : const xercesc::DOMElement* e,
469 : : flags f = 0,
470 : : container* c = 0);
471 : : //@}
472 : :
473 : : public:
474 : : /**
475 : : * @brief Assign a character to the instance.
476 : : *
477 : : * The resulting %normalized_string has only one character.
478 : : *
479 : : * @param c A character to assign.
480 : : * @return A reference to the instance.
481 : : */
482 : : normalized_string&
483 : : operator= (C c)
484 : : {
485 : : base () = c;
486 : : return *this;
487 : : }
488 : :
489 : : /**
490 : : * @brief Assign a C %string to the instance.
491 : : *
492 : : * The resulting %normalized_string contains a copy of the C %string.
493 : : *
494 : : * @param s A C %string to assign.
495 : : * @return A reference to the instance.
496 : : */
497 : : normalized_string&
498 : : operator= (const C* s)
499 : : {
500 : : base () = s;
501 : : return *this;
502 : : }
503 : :
504 : : /**
505 : : * @brief Assign a standard %string to the instance.
506 : : *
507 : : * The resulting %normalized_string contains a copy of the standard
508 : : * %string.
509 : : *
510 : : * @param s A standard %string to assign.
511 : : * @return A reference to the instance.
512 : : */
513 : : normalized_string&
514 : : operator= (const std::basic_string<C>& s)
515 : : {
516 : : base () = s;
517 : : return *this;
518 : : }
519 : :
520 : : /**
521 : : * @brief Copy assignment operator.
522 : : *
523 : : * @param x An instance to assign.
524 : : * @return A reference to the instance.
525 : : */
526 : : normalized_string&
527 : : operator= (const normalized_string& x)
528 : : {
529 : : base () = x;
530 : : return *this;
531 : : }
532 : :
533 : : protected:
534 : : //@cond
535 : :
536 : : void
537 : : normalize ();
538 : :
539 : : //@endcond
540 : : };
541 : :
542 : :
543 : : /**
544 : : * @brief Class corresponding to the XML Schema %token built-in
545 : : * type.
546 : : *
547 : : * The %token class publicly inherits from and has the same set
548 : : * of constructors as @c std::basic_string. It therefore can be
549 : : * used as @c std::string (or @c std::wstring if you are using
550 : : * @c wchar_t as the character type).
551 : : *
552 : : * @nosubgrouping
553 : : */
554 : : template <typename C, typename B>
555 : : class token: public B
556 : : {
557 : : typedef B base_type;
558 : :
559 : : base_type&
560 : : base ()
561 : : {
562 : : return *this;
563 : : }
564 : :
565 : : public:
566 : : /**
567 : : * @name Constructors
568 : : */
569 : : //@{
570 : :
571 : : /**
572 : : * @brief Default constructor creates an empty %token.
573 : : */
574 : : token ()
575 : : {
576 : : }
577 : :
578 : : /**
579 : : * @brief Initialize an instance with a copy of a C %string.
580 : : *
581 : : * @param s A C %string to copy.
582 : : */
583 : : token (const C* s)
584 : : : base_type (s)
585 : : {
586 : : }
587 : :
588 : : /**
589 : : * @brief Initialize an instance with a character array.
590 : : *
591 : : * @param s A character array to copy.
592 : : * @param n A number of character to copy.
593 : : */
594 : : token (const C* s, std::size_t n)
595 : : : base_type (s, n)
596 : : {
597 : : }
598 : :
599 : : /**
600 : : * @brief Initialize an instance with multiple copies of the same
601 : : * character.
602 : : *
603 : : * @param n A number of copies to create.
604 : : * @param c A character to copy.
605 : : */
606 : : token (std::size_t n, C c)
607 : : : base_type (n, c)
608 : : {
609 : : }
610 : :
611 : : /**
612 : : * @brief Initialize an instance with a copy of a standard %string.
613 : : *
614 : : * @param s A standard %string to copy.
615 : : */
616 : : token (const std::basic_string<C>& s)
617 : : : base_type (s)
618 : : {
619 : : }
620 : :
621 : : /**
622 : : * @brief Initialize an instance with a copy of a substring.
623 : : *
624 : : * @param s A standard %string to copy the substring from.
625 : : * @param pos An index of the first character to copy from.
626 : : * @param n A number of characters to copy.
627 : : */
628 : : token (const std::basic_string<C>& s,
629 : : std::size_t pos,
630 : : std::size_t n = std::basic_string<C>::npos)
631 : : : base_type (s, pos, n)
632 : : {
633 : : }
634 : :
635 : : public:
636 : : /**
637 : : * @brief Copy constructor.
638 : : *
639 : : * @param x An instance to make a copy of.
640 : : * @param f Flags to create the copy with.
641 : : * @param c A pointer to the object that will contain the copy.
642 : : *
643 : : * For polymorphic object models use the @c _clone function instead.
644 : : */
645 : : token (const token& x, flags f = 0, container* c = 0)
646 : : : base_type (x, f, c)
647 : : {
648 : : }
649 : :
650 : : /**
651 : : * @brief Copy the instance polymorphically.
652 : : *
653 : : * @param f Flags to create the copy with.
654 : : * @param c A pointer to the object that will contain the copy.
655 : : * @return A pointer to the dynamically allocated copy.
656 : : *
657 : : * This function ensures that the dynamic type of the instance
658 : : * is used for copying and should be used for polymorphic object
659 : : * models instead of the copy constructor.
660 : : */
661 : : virtual token*
662 : : _clone (flags f = 0, container* c = 0) const;
663 : :
664 : : public:
665 : : /**
666 : : * @brief Create an instance from a data representation
667 : : * stream.
668 : : *
669 : : * @param s A stream to extract the data from.
670 : : * @param f Flags to create the new instance with.
671 : : * @param c A pointer to the object that will contain the new
672 : : * instance.
673 : : */
674 : : template <typename S>
675 : : token (istream<S>& s, flags f = 0, container* c = 0);
676 : :
677 : : /**
678 : : * @brief Create an instance from a DOM element.
679 : : *
680 : : * @param e A DOM element to extract the data from.
681 : : * @param f Flags to create the new instance with.
682 : : * @param c A pointer to the object that will contain the new
683 : : * instance.
684 : : */
685 : : token (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
686 : :
687 : : /**
688 : : * @brief Create an instance from a DOM Attribute.
689 : : *
690 : : * @param a A DOM attribute to extract the data from.
691 : : * @param f Flags to create the new instance with.
692 : : * @param c A pointer to the object that will contain the new
693 : : * instance.
694 : : */
695 : : token (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
696 : :
697 : : /**
698 : : * @brief Create an instance from a %string fragment.
699 : : *
700 : : * @param s A %string fragment to extract the data from.
701 : : * @param e A pointer to DOM element containing the %string fragment.
702 : : * @param f Flags to create the new instance with.
703 : : * @param c A pointer to the object that will contain the new
704 : : * instance.
705 : : */
706 : : token (const std::basic_string<C>& s,
707 : : const xercesc::DOMElement* e,
708 : : flags f = 0,
709 : : container* c = 0);
710 : : //@}
711 : :
712 : : public:
713 : : /**
714 : : * @brief Assign a character to the instance.
715 : : *
716 : : * The resulting %token has only one character.
717 : : *
718 : : * @param c A character to assign.
719 : : * @return A reference to the instance.
720 : : */
721 : : token&
722 : : operator= (C c)
723 : : {
724 : : base () = c;
725 : : return *this;
726 : : }
727 : :
728 : : /**
729 : : * @brief Assign a C %string to the instance.
730 : : *
731 : : * The resulting %token contains a copy of the C %string.
732 : : *
733 : : * @param s A C %string to assign.
734 : : * @return A reference to the instance.
735 : : */
736 : : token&
737 : : operator= (const C* s)
738 : : {
739 : : base () = s;
740 : : return *this;
741 : : }
742 : :
743 : : /**
744 : : * @brief Assign a standard %string to the instance.
745 : : *
746 : : * The resulting %token contains a copy of the standard %string.
747 : : *
748 : : * @param s A standard %string to assign.
749 : : * @return A reference to the instance.
750 : : */
751 : : token&
752 : : operator= (const std::basic_string<C>& s)
753 : : {
754 : : base () = s;
755 : : return *this;
756 : : }
757 : :
758 : : /**
759 : : * @brief Copy assignment operator.
760 : : *
761 : : * @param x An instance to assign.
762 : : * @return A reference to the instance.
763 : : */
764 : : token&
765 : : operator= (const token& x)
766 : : {
767 : : base () = x;
768 : : return *this;
769 : : }
770 : :
771 : : protected:
772 : : //@cond
773 : :
774 : : void
775 : : collapse ();
776 : :
777 : : //@endcond
778 : : };
779 : :
780 : :
781 : : /**
782 : : * @brief Class corresponding to the XML Schema NMTOKEN built-in
783 : : * type.
784 : : *
785 : : * The %nmtoken class publicly inherits from and has the same set
786 : : * of constructors as @c std::basic_string. It therefore can be
787 : : * used as @c std::string (or @c std::wstring if you are using
788 : : * @c wchar_t as the character type).
789 : : *
790 : : * @nosubgrouping
791 : : */
792 : : template <typename C, typename B>
793 : : class nmtoken: public B
794 : : {
795 : : typedef B base_type;
796 : :
797 : : base_type&
798 : : base ()
799 : : {
800 : : return *this;
801 : : }
802 : :
803 : : public:
804 : : /**
805 : : * @name Constructors
806 : : */
807 : : //@{
808 : :
809 : : /**
810 : : * @brief Initialize an instance with a copy of a C %string.
811 : : *
812 : : * @param s A C %string to copy.
813 : : */
814 : : nmtoken (const C* s)
815 : : : base_type (s)
816 : : {
817 : : }
818 : :
819 : : /**
820 : : * @brief Initialize an instance with a character array.
821 : : *
822 : : * @param s A character array to copy.
823 : : * @param n A number of character to copy.
824 : : */
825 : : nmtoken (const C* s, std::size_t n)
826 : : : base_type (s, n)
827 : : {
828 : : }
829 : :
830 : : /**
831 : : * @brief Initialize an instance with multiple copies of the same
832 : : * character.
833 : : *
834 : : * @param n A number of copies to create.
835 : : * @param c A character to copy.
836 : : */
837 : : nmtoken (std::size_t n, C c)
838 : : : base_type (n, c)
839 : : {
840 : : }
841 : :
842 : : /**
843 : : * @brief Initialize an instance with a copy of a standard %string.
844 : : *
845 : : * @param s A standard %string to copy.
846 : : */
847 : : nmtoken (const std::basic_string<C>& s)
848 : : : base_type (s)
849 : : {
850 : : }
851 : :
852 : : /**
853 : : * @brief Initialize an instance with a copy of a substring.
854 : : *
855 : : * @param s A standard %string to copy the substring from.
856 : : * @param pos An index of the first character to copy from.
857 : : * @param n A number of characters to copy.
858 : : */
859 : : nmtoken (const std::basic_string<C>& s,
860 : : std::size_t pos,
861 : : std::size_t n = std::basic_string<C>::npos)
862 : : : base_type (s, pos, n)
863 : : {
864 : : }
865 : :
866 : : public:
867 : : /**
868 : : * @brief Copy constructor.
869 : : *
870 : : * @param x An instance to make a copy of.
871 : : * @param f Flags to create the copy with.
872 : : * @param c A pointer to the object that will contain the copy.
873 : : *
874 : : * For polymorphic object models use the @c _clone function instead.
875 : : */
876 : : nmtoken (const nmtoken& x, flags f = 0, container* c = 0)
877 : : : base_type (x, f, c)
878 : : {
879 : : }
880 : :
881 : : /**
882 : : * @brief Copy the instance polymorphically.
883 : : *
884 : : * @param f Flags to create the copy with.
885 : : * @param c A pointer to the object that will contain the copy.
886 : : * @return A pointer to the dynamically allocated copy.
887 : : *
888 : : * This function ensures that the dynamic type of the instance
889 : : * is used for copying and should be used for polymorphic object
890 : : * models instead of the copy constructor.
891 : : */
892 : : virtual nmtoken*
893 : : _clone (flags f = 0, container* c = 0) const;
894 : :
895 : : public:
896 : : /**
897 : : * @brief Create an instance from a data representation
898 : : * stream.
899 : : *
900 : : * @param s A stream to extract the data from.
901 : : * @param f Flags to create the new instance with.
902 : : * @param c A pointer to the object that will contain the new
903 : : * instance.
904 : : */
905 : : template <typename S>
906 : : nmtoken (istream<S>& s, flags f = 0, container* c = 0);
907 : :
908 : : /**
909 : : * @brief Create an instance from a DOM element.
910 : : *
911 : : * @param e A DOM element to extract the data from.
912 : : * @param f Flags to create the new instance with.
913 : : * @param c A pointer to the object that will contain the new
914 : : * instance.
915 : : */
916 : : nmtoken (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
917 : :
918 : : /**
919 : : * @brief Create an instance from a DOM Attribute.
920 : : *
921 : : * @param a A DOM attribute to extract the data from.
922 : : * @param f Flags to create the new instance with.
923 : : * @param c A pointer to the object that will contain the new
924 : : * instance.
925 : : */
926 : : nmtoken (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
927 : :
928 : : /**
929 : : * @brief Create an instance from a %string fragment.
930 : : *
931 : : * @param s A %string fragment to extract the data from.
932 : : * @param e A pointer to DOM element containing the %string fragment.
933 : : * @param f Flags to create the new instance with.
934 : : * @param c A pointer to the object that will contain the new
935 : : * instance.
936 : : */
937 : : nmtoken (const std::basic_string<C>& s,
938 : : const xercesc::DOMElement* e,
939 : : flags f = 0,
940 : : container* c = 0);
941 : : //@}
942 : :
943 : : public:
944 : : /**
945 : : * @brief Assign a character to the instance.
946 : : *
947 : : * The resulting %nmtoken has only one character.
948 : : *
949 : : * @param c A character to assign.
950 : : * @return A reference to the instance.
951 : : */
952 : : nmtoken&
953 : : operator= (C c)
954 : : {
955 : : base () = c;
956 : : return *this;
957 : : }
958 : :
959 : : /**
960 : : * @brief Assign a C %string to the instance.
961 : : *
962 : : * The resulting %nmtoken contains a copy of the C %string.
963 : : *
964 : : * @param s A C %string to assign.
965 : : * @return A reference to the instance.
966 : : */
967 : : nmtoken&
968 : : operator= (const C* s)
969 : : {
970 : : base () = s;
971 : : return *this;
972 : : }
973 : :
974 : : /**
975 : : * @brief Assign a standard %string to the instance.
976 : : *
977 : : * The resulting %nmtoken contains a copy of the standard %string.
978 : : *
979 : : * @param s A standard %string to assign.
980 : : * @return A reference to the instance.
981 : : */
982 : : nmtoken&
983 : : operator= (const std::basic_string<C>& s)
984 : : {
985 : : base () = s;
986 : : return *this;
987 : : }
988 : :
989 : : /**
990 : : * @brief Copy assignment operator.
991 : : *
992 : : * @param x An instance to assign.
993 : : * @return A reference to the instance.
994 : : */
995 : : nmtoken&
996 : : operator= (const nmtoken& x)
997 : : {
998 : : base () = x;
999 : : return *this;
1000 : : }
1001 : :
1002 : : protected:
1003 : : //@cond
1004 : :
1005 : : nmtoken ()
1006 : : : base_type ()
1007 : : {
1008 : : }
1009 : :
1010 : : //@endcond
1011 : : };
1012 : :
1013 : :
1014 : : /**
1015 : : * @brief Class corresponding to the XML Schema NMTOKENS built-in
1016 : : * type.
1017 : : *
1018 : : * The %nmtokens class is a vector (or %list in XML Schema terminology)
1019 : : * of nmtoken elements. It is implemented in terms of the list class
1020 : : * template.
1021 : : *
1022 : : * @nosubgrouping
1023 : : */
1024 : : template <typename C, typename B, typename nmtoken>
1025 : : class nmtokens: public B, public list<nmtoken, C>
1026 : : {
1027 : : typedef list<nmtoken, C> base_type;
1028 : :
1029 : : public:
1030 : : /**
1031 : : * @name Constructors
1032 : : */
1033 : : //@{
1034 : :
1035 : : /**
1036 : : * @brief Default constructor creates no elements.
1037 : : */
1038 : : nmtokens ()
1039 : : : base_type (this)
1040 : : {
1041 : : }
1042 : :
1043 : : /**
1044 : : * @brief Initialize the instance with copies of an exemplar elements.
1045 : : *
1046 : : * @param n A number of elements to copy.
1047 : : * @param x An exemplar element to copy.
1048 : : */
1049 : : nmtokens (typename base_type::size_type n, const nmtoken& x)
1050 : : : base_type (n, x, this)
1051 : : {
1052 : : }
1053 : :
1054 : : /**
1055 : : * @brief Initialize the instance with copies of elements from an
1056 : : * iterator range.
1057 : : *
1058 : : * @param begin An iterator pointing to the first element.
1059 : : * @param end An iterator pointing to the one past the last element.
1060 : : */
1061 : : template <typename I>
1062 : : nmtokens (const I& begin, const I& end)
1063 : : : base_type (begin, end, this)
1064 : : {
1065 : : }
1066 : :
1067 : : public:
1068 : : /**
1069 : : * @brief Copy constructor.
1070 : : *
1071 : : * @param x An instance to make a copy of.
1072 : : * @param f Flags to create the copy with.
1073 : : * @param c A pointer to the object that will contain the copy.
1074 : : *
1075 : : * For polymorphic object models use the @c _clone function instead.
1076 : : */
1077 : : nmtokens (const nmtokens& x, flags f, container* c = 0)
1078 : : : B (x, f, c), base_type (x, f, this)
1079 : : {
1080 : : }
1081 : :
1082 : : /**
1083 : : * @brief Copy the instance polymorphically.
1084 : : *
1085 : : * @param f Flags to create the copy with.
1086 : : * @param c A pointer to the object that will contain the copy.
1087 : : * @return A pointer to the dynamically allocated copy.
1088 : : *
1089 : : * This function ensures that the dynamic type of the instance
1090 : : * is used for copying and should be used for polymorphic object
1091 : : * models instead of the copy constructor.
1092 : : */
1093 : : virtual nmtokens*
1094 : : _clone (flags f = 0, container* c = 0) const;
1095 : :
1096 : : public:
1097 : : /**
1098 : : * @brief Create an instance from a data representation
1099 : : * stream.
1100 : : *
1101 : : * @param s A stream to extract the data from.
1102 : : * @param f Flags to create the new instance with.
1103 : : * @param c A pointer to the object that will contain the new
1104 : : * instance.
1105 : : */
1106 : : template <typename S>
1107 : : nmtokens (istream<S>& s, flags f = 0, container* c = 0);
1108 : :
1109 : : /**
1110 : : * @brief Create an instance from a DOM element.
1111 : : *
1112 : : * @param e A DOM element to extract the data from.
1113 : : * @param f Flags to create the new instance with.
1114 : : * @param c A pointer to the object that will contain the new
1115 : : * instance.
1116 : : */
1117 : : nmtokens (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
1118 : :
1119 : : /**
1120 : : * @brief Create an instance from a DOM Attribute.
1121 : : *
1122 : : * @param a A DOM attribute to extract the data from.
1123 : : * @param f Flags to create the new instance with.
1124 : : * @param c A pointer to the object that will contain the new
1125 : : * instance.
1126 : : */
1127 : : nmtokens (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
1128 : :
1129 : : /**
1130 : : * @brief Create an instance from a %string fragment.
1131 : : *
1132 : : * @param s A %string fragment to extract the data from.
1133 : : * @param e A pointer to DOM element containing the %string fragment.
1134 : : * @param f Flags to create the new instance with.
1135 : : * @param c A pointer to the object that will contain the new
1136 : : * instance.
1137 : : */
1138 : : nmtokens (const std::basic_string<C>& s,
1139 : : const xercesc::DOMElement* e,
1140 : : flags f = 0,
1141 : : container* c = 0);
1142 : : //@}
1143 : : };
1144 : :
1145 : : /**
1146 : : * @brief %nmtokens comparison operator.
1147 : : *
1148 : : * @return True if the lists of nmtokens are equal, false otherwise.
1149 : : */
1150 : : template <typename C, typename B, typename nmtoken>
1151 : : inline bool
1152 : : operator== (const nmtokens<C, B, nmtoken>& a,
1153 : : const nmtokens<C, B, nmtoken>& b)
1154 : : {
1155 : : return static_cast<const list<nmtoken, C>&> (a) == b;
1156 : : }
1157 : :
1158 : : /**
1159 : : * @brief %nmtokens comparison operator.
1160 : : *
1161 : : * @return True if the lists of nmtokens are not equal, false otherwise.
1162 : : */
1163 : : template <typename C, typename B, typename nmtoken>
1164 : : inline bool
1165 : : operator!= (const nmtokens<C, B, nmtoken>& a,
1166 : : const nmtokens<C, B, nmtoken>& b)
1167 : : {
1168 : : return !(a == b);
1169 : : }
1170 : :
1171 : : /**
1172 : : * @brief Class corresponding to the XML Schema Name built-in
1173 : : * type.
1174 : : *
1175 : : * The %name class publicly inherits from and has the same set
1176 : : * of constructors as @c std::basic_string. It therefore can be
1177 : : * used as @c std::string (or @c std::wstring if you are using
1178 : : * @c wchar_t as the character type).
1179 : : *
1180 : : * @nosubgrouping
1181 : : */
1182 : : template <typename C, typename B>
1183 : : class name: public B
1184 : : {
1185 : : typedef B base_type;
1186 : :
1187 : : base_type&
1188 : : base ()
1189 : : {
1190 : : return *this;
1191 : : }
1192 : :
1193 : : public:
1194 : : /**
1195 : : * @name Constructors
1196 : : */
1197 : : //@{
1198 : :
1199 : : /**
1200 : : * @brief Initialize an instance with a copy of a C %string.
1201 : : *
1202 : : * @param s A C %string to copy.
1203 : : */
1204 : : name (const C* s)
1205 : : : base_type (s)
1206 : : {
1207 : : }
1208 : :
1209 : : /**
1210 : : * @brief Initialize an instance with a character array.
1211 : : *
1212 : : * @param s A character array to copy.
1213 : : * @param n A number of character to copy.
1214 : : */
1215 : : name (const C* s, std::size_t n)
1216 : : : base_type (s, n)
1217 : : {
1218 : : }
1219 : :
1220 : : /**
1221 : : * @brief Initialize an instance with multiple copies of the same
1222 : : * character.
1223 : : *
1224 : : * @param n A number of copies to create.
1225 : : * @param c A character to copy.
1226 : : */
1227 : : name (std::size_t n, C c)
1228 : : : base_type (n, c)
1229 : : {
1230 : : }
1231 : :
1232 : : /**
1233 : : * @brief Initialize an instance with a copy of a standard %string.
1234 : : *
1235 : : * @param s A standard %string to copy.
1236 : : */
1237 : : name (const std::basic_string<C>& s)
1238 : : : base_type (s)
1239 : : {
1240 : : }
1241 : :
1242 : : /**
1243 : : * @brief Initialize an instance with a copy of a substring.
1244 : : *
1245 : : * @param s A standard %string to copy the substring from.
1246 : : * @param pos An index of the first character to copy from.
1247 : : * @param n A number of characters to copy.
1248 : : */
1249 : : name (const std::basic_string<C>& s,
1250 : : std::size_t pos,
1251 : : std::size_t n = std::basic_string<C>::npos)
1252 : : : base_type (s, pos, n)
1253 : : {
1254 : : }
1255 : :
1256 : : public:
1257 : : /**
1258 : : * @brief Copy constructor.
1259 : : *
1260 : : * @param x An instance to make a copy of.
1261 : : * @param f Flags to create the copy with.
1262 : : * @param c A pointer to the object that will contain the copy.
1263 : : *
1264 : : * For polymorphic object models use the @c _clone function instead.
1265 : : */
1266 : : name (const name& x, flags f = 0, container* c = 0)
1267 : : : base_type (x, f, c)
1268 : : {
1269 : : }
1270 : :
1271 : : /**
1272 : : * @brief Copy the instance polymorphically.
1273 : : *
1274 : : * @param f Flags to create the copy with.
1275 : : * @param c A pointer to the object that will contain the copy.
1276 : : * @return A pointer to the dynamically allocated copy.
1277 : : *
1278 : : * This function ensures that the dynamic type of the instance
1279 : : * is used for copying and should be used for polymorphic object
1280 : : * models instead of the copy constructor.
1281 : : */
1282 : : virtual name*
1283 : : _clone (flags f = 0, container* c = 0) const;
1284 : :
1285 : : public:
1286 : : /**
1287 : : * @brief Create an instance from a data representation
1288 : : * stream.
1289 : : *
1290 : : * @param s A stream to extract the data from.
1291 : : * @param f Flags to create the new instance with.
1292 : : * @param c A pointer to the object that will contain the new
1293 : : * instance.
1294 : : */
1295 : : template <typename S>
1296 : : name (istream<S>& s, flags f = 0, container* c = 0);
1297 : :
1298 : : /**
1299 : : * @brief Create an instance from a DOM element.
1300 : : *
1301 : : * @param e A DOM element to extract the data from.
1302 : : * @param f Flags to create the new instance with.
1303 : : * @param c A pointer to the object that will contain the new
1304 : : * instance.
1305 : : */
1306 : : name (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
1307 : :
1308 : : /**
1309 : : * @brief Create an instance from a DOM Attribute.
1310 : : *
1311 : : * @param a A DOM attribute to extract the data from.
1312 : : * @param f Flags to create the new instance with.
1313 : : * @param c A pointer to the object that will contain the new
1314 : : * instance.
1315 : : */
1316 : : name (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
1317 : :
1318 : : /**
1319 : : * @brief Create an instance from a %string fragment.
1320 : : *
1321 : : * @param s A %string fragment to extract the data from.
1322 : : * @param e A pointer to DOM element containing the %string fragment.
1323 : : * @param f Flags to create the new instance with.
1324 : : * @param c A pointer to the object that will contain the new
1325 : : * instance.
1326 : : */
1327 : : name (const std::basic_string<C>& s,
1328 : : const xercesc::DOMElement* e,
1329 : : flags f = 0,
1330 : : container* c = 0);
1331 : : //@}
1332 : :
1333 : : public:
1334 : : /**
1335 : : * @brief Assign a character to the instance.
1336 : : *
1337 : : * The resulting %name has only one character.
1338 : : *
1339 : : * @param c A character to assign.
1340 : : * @return A reference to the instance.
1341 : : */
1342 : : name&
1343 : : operator= (C c)
1344 : : {
1345 : : base () = c;
1346 : : return *this;
1347 : : }
1348 : :
1349 : : /**
1350 : : * @brief Assign a C %string to the instance.
1351 : : *
1352 : : * The resulting %name contains a copy of the C %string.
1353 : : *
1354 : : * @param s A C %string to assign.
1355 : : * @return A reference to the instance.
1356 : : */
1357 : : name&
1358 : : operator= (const C* s)
1359 : : {
1360 : : base () = s;
1361 : : return *this;
1362 : : }
1363 : :
1364 : : /**
1365 : : * @brief Assign a standard %string to the instance.
1366 : : *
1367 : : * The resulting %name contains a copy of the standard %string.
1368 : : *
1369 : : * @param s A standard %string to assign.
1370 : : * @return A reference to the instance.
1371 : : */
1372 : : name&
1373 : : operator= (const std::basic_string<C>& s)
1374 : : {
1375 : : base () = s;
1376 : : return *this;
1377 : : }
1378 : :
1379 : : /**
1380 : : * @brief Copy assignment operator.
1381 : : *
1382 : : * @param x An instance to assign.
1383 : : * @return A reference to the instance.
1384 : : */
1385 : : name&
1386 : : operator= (const name& x)
1387 : : {
1388 : : base () = x;
1389 : : return *this;
1390 : : }
1391 : :
1392 : : protected:
1393 : : //@cond
1394 : :
1395 : : name ()
1396 : : : base_type ()
1397 : : {
1398 : : }
1399 : :
1400 : : //@endcond
1401 : : };
1402 : :
1403 : :
1404 : : // Forward declaration for Sun CC.
1405 : : //
1406 : : template <typename C, typename B, typename uri, typename ncname>
1407 : : class qname;
1408 : :
1409 : :
1410 : : /**
1411 : : * @brief Class corresponding to the XML Schema NCame built-in
1412 : : * type.
1413 : : *
1414 : : * The %ncname class publicly inherits from and has the same set
1415 : : * of constructors as @c std::basic_string. It therefore can be
1416 : : * used as @c std::string (or @c std::wstring if you are using
1417 : : * @c wchar_t as the character type).
1418 : : *
1419 : : * @nosubgrouping
1420 : : */
1421 : : template <typename C, typename B>
1422 : : class ncname: public B
1423 : : {
1424 : : typedef B base_type;
1425 : :
1426 : : base_type&
1427 : : base ()
1428 : : {
1429 : : return *this;
1430 : : }
1431 : :
1432 : : public:
1433 : : /**
1434 : : * @name Constructors
1435 : : */
1436 : : //@{
1437 : :
1438 : : /**
1439 : : * @brief Initialize an instance with a copy of a C %string.
1440 : : *
1441 : : * @param s A C %string to copy.
1442 : : */
1443 : : ncname (const C* s)
1444 : : : base_type (s)
1445 : : {
1446 : : }
1447 : :
1448 : : /**
1449 : : * @brief Initialize an instance with a character array.
1450 : : *
1451 : : * @param s A character array to copy.
1452 : : * @param n A number of character to copy.
1453 : : */
1454 : : ncname (const C* s, std::size_t n)
1455 : : : base_type (s, n)
1456 : : {
1457 : : }
1458 : :
1459 : : /**
1460 : : * @brief Initialize an instance with multiple copies of the same
1461 : : * character.
1462 : : *
1463 : : * @param n A number of copies to create.
1464 : : * @param c A character to copy.
1465 : : */
1466 : : ncname (std::size_t n, C c)
1467 : : : base_type (n, c)
1468 : : {
1469 : : }
1470 : :
1471 : : /**
1472 : : * @brief Initialize an instance with a copy of a standard %string.
1473 : : *
1474 : : * @param s A standard %string to copy.
1475 : : */
1476 : : ncname (const std::basic_string<C>& s)
1477 : : : base_type (s)
1478 : : {
1479 : : }
1480 : :
1481 : : /**
1482 : : * @brief Initialize an instance with a copy of a substring.
1483 : : *
1484 : : * @param s A standard %string to copy the substring from.
1485 : : * @param pos An index of the first character to copy from.
1486 : : * @param n A number of characters to copy.
1487 : : */
1488 : : ncname (const std::basic_string<C>& s,
1489 : : std::size_t pos,
1490 : : std::size_t n = std::basic_string<C>::npos)
1491 : : : base_type (s, pos, n)
1492 : : {
1493 : : }
1494 : :
1495 : : public:
1496 : : /**
1497 : : * @brief Copy constructor.
1498 : : *
1499 : : * @param x An instance to make a copy of.
1500 : : * @param f Flags to create the copy with.
1501 : : * @param c A pointer to the object that will contain the copy.
1502 : : *
1503 : : * For polymorphic object models use the @c _clone function instead.
1504 : : */
1505 : : ncname (const ncname& x, flags f = 0, container* c = 0)
1506 : : : base_type (x, f, c)
1507 : : {
1508 : : }
1509 : :
1510 : : /**
1511 : : * @brief Copy the instance polymorphically.
1512 : : *
1513 : : * @param f Flags to create the copy with.
1514 : : * @param c A pointer to the object that will contain the copy.
1515 : : * @return A pointer to the dynamically allocated copy.
1516 : : *
1517 : : * This function ensures that the dynamic type of the instance
1518 : : * is used for copying and should be used for polymorphic object
1519 : : * models instead of the copy constructor.
1520 : : */
1521 : : virtual ncname*
1522 : : _clone (flags f = 0, container* c = 0) const;
1523 : :
1524 : : public:
1525 : : /**
1526 : : * @brief Create an instance from a data representation
1527 : : * stream.
1528 : : *
1529 : : * @param s A stream to extract the data from.
1530 : : * @param f Flags to create the new instance with.
1531 : : * @param c A pointer to the object that will contain the new
1532 : : * instance.
1533 : : */
1534 : : template <typename S>
1535 : : ncname (istream<S>& s, flags f = 0, container* c = 0);
1536 : :
1537 : : /**
1538 : : * @brief Create an instance from a DOM element.
1539 : : *
1540 : : * @param e A DOM element to extract the data from.
1541 : : * @param f Flags to create the new instance with.
1542 : : * @param c A pointer to the object that will contain the new
1543 : : * instance.
1544 : : */
1545 : : ncname (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
1546 : :
1547 : : /**
1548 : : * @brief Create an instance from a DOM Attribute.
1549 : : *
1550 : : * @param a A DOM attribute to extract the data from.
1551 : : * @param f Flags to create the new instance with.
1552 : : * @param c A pointer to the object that will contain the new
1553 : : * instance.
1554 : : */
1555 : : ncname (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
1556 : :
1557 : : /**
1558 : : * @brief Create an instance from a %string fragment.
1559 : : *
1560 : : * @param s A %string fragment to extract the data from.
1561 : : * @param e A pointer to DOM element containing the %string fragment.
1562 : : * @param f Flags to create the new instance with.
1563 : : * @param c A pointer to the object that will contain the new
1564 : : * instance.
1565 : : */
1566 : : ncname (const std::basic_string<C>& s,
1567 : : const xercesc::DOMElement* e,
1568 : : flags f = 0,
1569 : : container* c = 0);
1570 : : //@}
1571 : :
1572 : : public:
1573 : : /**
1574 : : * @brief Assign a character to the instance.
1575 : : *
1576 : : * The resulting %ncname has only one character.
1577 : : *
1578 : : * @param c A character to assign.
1579 : : * @return A reference to the instance.
1580 : : */
1581 : : ncname&
1582 : : operator= (C c)
1583 : : {
1584 : : base () = c;
1585 : : return *this;
1586 : : }
1587 : :
1588 : : /**
1589 : : * @brief Assign a C %string to the instance.
1590 : : *
1591 : : * The resulting %ncname contains a copy of the C %string.
1592 : : *
1593 : : * @param s A C %string to assign.
1594 : : * @return A reference to the instance.
1595 : : */
1596 : : ncname&
1597 : : operator= (const C* s)
1598 : : {
1599 : : base () = s;
1600 : : return *this;
1601 : : }
1602 : :
1603 : : /**
1604 : : * @brief Assign a standard %string to the instance.
1605 : : *
1606 : : * The resulting %ncname contains a copy of the standard %string.
1607 : : *
1608 : : * @param s A standard %string to assign.
1609 : : * @return A reference to the instance.
1610 : : */
1611 : : ncname&
1612 : : operator= (const std::basic_string<C>& s)
1613 : : {
1614 : : base () = s;
1615 : : return *this;
1616 : : }
1617 : :
1618 : : /**
1619 : : * @brief Copy assignment operator.
1620 : : *
1621 : : * @param x An instance to assign.
1622 : : * @return A reference to the instance.
1623 : : */
1624 : : ncname&
1625 : : operator= (const ncname& x)
1626 : : {
1627 : : base () = x;
1628 : : return *this;
1629 : : }
1630 : :
1631 : : protected:
1632 : : //@cond
1633 : :
1634 : : ncname ()
1635 : : : base_type ()
1636 : : {
1637 : : }
1638 : :
1639 : : //@endcond
1640 : :
1641 : : template <typename, typename, typename, typename>
1642 : : friend class qname;
1643 : : };
1644 : :
1645 : :
1646 : : /**
1647 : : * @brief Class corresponding to the XML Schema %language built-in
1648 : : * type.
1649 : : *
1650 : : * The %language class publicly inherits from and has the same set
1651 : : * of constructors as @c std::basic_string. It therefore can be
1652 : : * used as @c std::string (or @c std::wstring if you are using
1653 : : * @c wchar_t as the character type).
1654 : : *
1655 : : * @nosubgrouping
1656 : : */
1657 : : template <typename C, typename B>
1658 : : class language: public B
1659 : : {
1660 : : typedef B base_type;
1661 : :
1662 : : base_type&
1663 : : base ()
1664 : : {
1665 : : return *this;
1666 : : }
1667 : :
1668 : : public:
1669 : : /**
1670 : : * @name Constructors
1671 : : */
1672 : : //@{
1673 : :
1674 : : /**
1675 : : * @brief Initialize an instance with a copy of a C %string.
1676 : : *
1677 : : * @param s A C %string to copy.
1678 : : */
1679 : : language (const C* s)
1680 : : : base_type (s)
1681 : : {
1682 : : }
1683 : :
1684 : : /**
1685 : : * @brief Initialize an instance with a character array.
1686 : : *
1687 : : * @param s A character array to copy.
1688 : : * @param n A number of character to copy.
1689 : : */
1690 : : language (const C* s, std::size_t n)
1691 : : : base_type (s, n)
1692 : : {
1693 : : }
1694 : :
1695 : : /**
1696 : : * @brief Initialize an instance with multiple copies of the same
1697 : : * character.
1698 : : *
1699 : : * @param n A number of copies to create.
1700 : : * @param c A character to copy.
1701 : : */
1702 : : language (std::size_t n, C c)
1703 : : : base_type (n, c)
1704 : : {
1705 : : }
1706 : :
1707 : : /**
1708 : : * @brief Initialize an instance with a copy of a standard %string.
1709 : : *
1710 : : * @param s A standard %string to copy.
1711 : : */
1712 : : language (const std::basic_string<C>& s)
1713 : : : base_type (s)
1714 : : {
1715 : : }
1716 : :
1717 : : /**
1718 : : * @brief Initialize an instance with a copy of a substring.
1719 : : *
1720 : : * @param s A standard %string to copy the substring from.
1721 : : * @param pos An index of the first character to copy from.
1722 : : * @param n A number of characters to copy.
1723 : : */
1724 : : language (const std::basic_string<C>& s,
1725 : : std::size_t pos,
1726 : : std::size_t n = std::basic_string<C>::npos)
1727 : : : base_type (s, pos, n)
1728 : : {
1729 : : }
1730 : :
1731 : : public:
1732 : : /**
1733 : : * @brief Copy constructor.
1734 : : *
1735 : : * @param x An instance to make a copy of.
1736 : : * @param f Flags to create the copy with.
1737 : : * @param c A pointer to the object that will contain the copy.
1738 : : *
1739 : : * For polymorphic object models use the @c _clone function instead.
1740 : : */
1741 : : language (const language& x, flags f = 0, container* c = 0)
1742 : : : base_type (x, f, c)
1743 : : {
1744 : : }
1745 : :
1746 : : /**
1747 : : * @brief Copy the instance polymorphically.
1748 : : *
1749 : : * @param f Flags to create the copy with.
1750 : : * @param c A pointer to the object that will contain the copy.
1751 : : * @return A pointer to the dynamically allocated copy.
1752 : : *
1753 : : * This function ensures that the dynamic type of the instance
1754 : : * is used for copying and should be used for polymorphic object
1755 : : * models instead of the copy constructor.
1756 : : */
1757 : : virtual language*
1758 : : _clone (flags f = 0, container* c = 0) const;
1759 : :
1760 : : public:
1761 : : /**
1762 : : * @brief Create an instance from a data representation
1763 : : * stream.
1764 : : *
1765 : : * @param s A stream to extract the data from.
1766 : : * @param f Flags to create the new instance with.
1767 : : * @param c A pointer to the object that will contain the new
1768 : : * instance.
1769 : : */
1770 : : template <typename S>
1771 : : language (istream<S>& s, flags f = 0, container* c = 0);
1772 : :
1773 : : /**
1774 : : * @brief Create an instance from a DOM element.
1775 : : *
1776 : : * @param e A DOM element to extract the data from.
1777 : : * @param f Flags to create the new instance with.
1778 : : * @param c A pointer to the object that will contain the new
1779 : : * instance.
1780 : : */
1781 : : language (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
1782 : :
1783 : : /**
1784 : : * @brief Create an instance from a DOM Attribute.
1785 : : *
1786 : : * @param a A DOM attribute to extract the data from.
1787 : : * @param f Flags to create the new instance with.
1788 : : * @param c A pointer to the object that will contain the new
1789 : : * instance.
1790 : : */
1791 : : language (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
1792 : :
1793 : : /**
1794 : : * @brief Create an instance from a %string fragment.
1795 : : *
1796 : : * @param s A %string fragment to extract the data from.
1797 : : * @param e A pointer to DOM element containing the %string fragment.
1798 : : * @param f Flags to create the new instance with.
1799 : : * @param c A pointer to the object that will contain the new
1800 : : * instance.
1801 : : */
1802 : : language (const std::basic_string<C>& s,
1803 : : const xercesc::DOMElement* e,
1804 : : flags f = 0,
1805 : : container* c = 0);
1806 : : //@}
1807 : :
1808 : : public:
1809 : : /**
1810 : : * @brief Assign a character to the instance.
1811 : : *
1812 : : * The resulting %language has only one character.
1813 : : *
1814 : : * @param c A character to assign.
1815 : : * @return A reference to the instance.
1816 : : */
1817 : : language&
1818 : : operator= (C c)
1819 : : {
1820 : : base () = c;
1821 : : return *this;
1822 : : }
1823 : :
1824 : : /**
1825 : : * @brief Assign a C %string to the instance.
1826 : : *
1827 : : * The resulting %language contains a copy of the C %string.
1828 : : *
1829 : : * @param s A C %string to assign.
1830 : : * @return A reference to the instance.
1831 : : */
1832 : : language&
1833 : : operator= (const C* s)
1834 : : {
1835 : : base () = s;
1836 : : return *this;
1837 : : }
1838 : :
1839 : : /**
1840 : : * @brief Assign a standard %string to the instance.
1841 : : *
1842 : : * The resulting %language contains a copy of the standard %string.
1843 : : *
1844 : : * @param s A standard %string to assign.
1845 : : * @return A reference to the instance.
1846 : : */
1847 : : language&
1848 : : operator= (const std::basic_string<C>& s)
1849 : : {
1850 : : base () = s;
1851 : : return *this;
1852 : : }
1853 : :
1854 : : /**
1855 : : * @brief Copy assignment operator.
1856 : : *
1857 : : * @param x An instance to assign.
1858 : : * @return A reference to the instance.
1859 : : */
1860 : : language&
1861 : : operator= (const language& x)
1862 : : {
1863 : : base () = x;
1864 : : return *this;
1865 : : }
1866 : :
1867 : : protected:
1868 : : //@cond
1869 : :
1870 : : language ()
1871 : : : base_type ()
1872 : : {
1873 : : }
1874 : :
1875 : : //@endcond
1876 : : };
1877 : :
1878 : :
1879 : : //@cond
1880 : :
1881 : : template <typename C, typename ncname>
1882 : : struct identity_impl: identity
1883 : : {
1884 : : identity_impl (const ncname& id)
1885 : : : id_ (id)
1886 : : {
1887 : : }
1888 : :
1889 : : virtual bool
1890 : : before (const identity& y) const;
1891 : :
1892 : : virtual void
1893 : : throw_duplicate_id () const;
1894 : :
1895 : : private:
1896 : : const ncname& id_;
1897 : : };
1898 : :
1899 : : //@endcond
1900 : :
1901 : :
1902 : : /**
1903 : : * @brief Class corresponding to the XML Schema ID built-in
1904 : : * type.
1905 : : *
1906 : : * The %id class publicly inherits from and has the same set
1907 : : * of constructors as @c std::basic_string. It therefore can be
1908 : : * used as @c std::string (or @c std::wstring if you are using
1909 : : * @c wchar_t as the character type).
1910 : : *
1911 : : * @nosubgrouping
1912 : : */
1913 : : template <typename C, typename B>
1914 : : class id: public B
1915 : : {
1916 : : typedef B base_type;
1917 : :
1918 : : base_type&
1919 : : base ()
1920 : : {
1921 : : return *this;
1922 : : }
1923 : :
1924 : : public:
1925 : : ~id()
1926 : : {
1927 : : unregister_id ();
1928 : : }
1929 : :
1930 : : public:
1931 : : /**
1932 : : * @name Constructors
1933 : : */
1934 : : //@{
1935 : :
1936 : : /**
1937 : : * @brief Initialize an instance with a copy of a C %string.
1938 : : *
1939 : : * @param s A C %string to copy.
1940 : : */
1941 : : id (const C* s)
1942 : : : base_type (s), identity_ (*this)
1943 : : {
1944 : : register_id ();
1945 : : }
1946 : :
1947 : : /**
1948 : : * @brief Initialize an instance with a character array.
1949 : : *
1950 : : * @param s A character array to copy.
1951 : : * @param n A number of character to copy.
1952 : : */
1953 : : id (const C* s, std::size_t n)
1954 : : : base_type (s, n), identity_ (*this)
1955 : : {
1956 : : register_id ();
1957 : : }
1958 : :
1959 : : /**
1960 : : * @brief Initialize an instance with multiple copies of the same
1961 : : * character.
1962 : : *
1963 : : * @param n A number of copies to create.
1964 : : * @param c A character to copy.
1965 : : */
1966 : : id (std::size_t n, C c)
1967 : : : base_type (n, c), identity_ (*this)
1968 : : {
1969 : : register_id ();
1970 : : }
1971 : :
1972 : : /**
1973 : : * @brief Initialize an instance with a copy of a standard %string.
1974 : : *
1975 : : * @param s A standard %string to copy.
1976 : : */
1977 : : id (const std::basic_string<C>& s)
1978 : : : base_type (s), identity_ (*this)
1979 : : {
1980 : : register_id ();
1981 : : }
1982 : :
1983 : : /**
1984 : : * @brief Initialize an instance with a copy of a substring.
1985 : : *
1986 : : * @param s A standard %string to copy the substring from.
1987 : : * @param pos An index of the first character to copy from.
1988 : : * @param n A number of characters to copy.
1989 : : */
1990 : : id (const std::basic_string<C>& s,
1991 : : std::size_t pos,
1992 : : std::size_t n = std::basic_string<C>::npos)
1993 : : : base_type (s, pos, n), identity_ (*this)
1994 : : {
1995 : : register_id ();
1996 : : }
1997 : :
1998 : : public:
1999 : : /**
2000 : : * @brief Copy constructor.
2001 : : *
2002 : : * @param x An instance to make a copy of.
2003 : : * @param f Flags to create the copy with.
2004 : : * @param c A pointer to the object that will contain the copy.
2005 : : *
2006 : : * For polymorphic object models use the @c _clone function instead.
2007 : : */
2008 : : id (const id& x, flags f = 0, container* c = 0)
2009 : : : base_type (x, f, c), identity_ (*this)
2010 : : {
2011 : : register_id ();
2012 : : }
2013 : :
2014 : : /**
2015 : : * @brief Copy the instance polymorphically.
2016 : : *
2017 : : * @param f Flags to create the copy with.
2018 : : * @param c A pointer to the object that will contain the copy.
2019 : : * @return A pointer to the dynamically allocated copy.
2020 : : *
2021 : : * This function ensures that the dynamic type of the instance
2022 : : * is used for copying and should be used for polymorphic object
2023 : : * models instead of the copy constructor.
2024 : : */
2025 : : virtual id*
2026 : : _clone (flags f = 0, container* c = 0) const;
2027 : :
2028 : : public:
2029 : : /**
2030 : : * @brief Create an instance from a data representation
2031 : : * stream.
2032 : : *
2033 : : * @param s A stream to extract the data from.
2034 : : * @param f Flags to create the new instance with.
2035 : : * @param c A pointer to the object that will contain the new
2036 : : * instance.
2037 : : */
2038 : : template <typename S>
2039 : : id (istream<S>& s, flags f = 0, container* c = 0);
2040 : :
2041 : : /**
2042 : : * @brief Create an instance from a DOM element.
2043 : : *
2044 : : * @param e A DOM element to extract the data from.
2045 : : * @param f Flags to create the new instance with.
2046 : : * @param c A pointer to the object that will contain the new
2047 : : * instance.
2048 : : */
2049 : : id (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
2050 : :
2051 : : /**
2052 : : * @brief Create an instance from a DOM Attribute.
2053 : : *
2054 : : * @param a A DOM attribute to extract the data from.
2055 : : * @param f Flags to create the new instance with.
2056 : : * @param c A pointer to the object that will contain the new
2057 : : * instance.
2058 : : */
2059 : : id (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
2060 : :
2061 : : /**
2062 : : * @brief Create an instance from a %string fragment.
2063 : : *
2064 : : * @param s A %string fragment to extract the data from.
2065 : : * @param e A pointer to DOM element containing the %string fragment.
2066 : : * @param f Flags to create the new instance with.
2067 : : * @param c A pointer to the object that will contain the new
2068 : : * instance.
2069 : : */
2070 : : id (const std::basic_string<C>& s,
2071 : : const xercesc::DOMElement* e,
2072 : : flags f = 0,
2073 : : container* c = 0);
2074 : : //@}
2075 : :
2076 : : public:
2077 : : /**
2078 : : * @brief Assign a character to the instance.
2079 : : *
2080 : : * The resulting %id has only one character.
2081 : : *
2082 : : * @param c A character to assign.
2083 : : * @return A reference to the instance.
2084 : : */
2085 : : id&
2086 : : operator= (C c);
2087 : :
2088 : :
2089 : : /**
2090 : : * @brief Assign a C %string to the instance.
2091 : : *
2092 : : * The resulting %id contains a copy of the C %string.
2093 : : *
2094 : : * @param s A C %string to assign.
2095 : : * @return A reference to the instance.
2096 : : */
2097 : : id&
2098 : : operator= (const C* s);
2099 : :
2100 : : /**
2101 : : * @brief Assign a standard %string to the instance.
2102 : : *
2103 : : * The resulting %id contains a copy of the standard %string.
2104 : : *
2105 : : * @param s A standard %string to assign.
2106 : : * @return A reference to the instance.
2107 : : */
2108 : : id&
2109 : : operator= (const std::basic_string<C>& s);
2110 : :
2111 : : /**
2112 : : * @brief Copy assignment operator.
2113 : : *
2114 : : * @param x An instance to assign.
2115 : : * @return A reference to the instance.
2116 : : */
2117 : : id&
2118 : : operator= (const id& x);
2119 : :
2120 : : public:
2121 : : //@cond
2122 : :
2123 : : virtual void
2124 : : _container (container*);
2125 : :
2126 : : using B::_container;
2127 : :
2128 : : //@endcond
2129 : :
2130 : : protected:
2131 : : //@cond
2132 : :
2133 : : id ()
2134 : : : base_type (), identity_ (*this)
2135 : : {
2136 : : register_id ();
2137 : : }
2138 : :
2139 : : //@endcond
2140 : :
2141 : : private:
2142 : : void
2143 : : register_id ();
2144 : :
2145 : : void
2146 : : unregister_id ();
2147 : :
2148 : : private:
2149 : : identity_impl<C, B> identity_;
2150 : : };
2151 : :
2152 : :
2153 : : /**
2154 : : * @brief Class corresponding to the XML Schema IDREF built-in
2155 : : * type.
2156 : : *
2157 : : * The %idref class publicly inherits from and has the same set
2158 : : * of constructors as @c std::basic_string. It therefore can be
2159 : : * used as @c std::string (or @c std::wstring if you are using
2160 : : * @c wchar_t as the character type).
2161 : : *
2162 : : * The %idref class also provides an autopointer-like interface
2163 : : * for resolving referenced objects. By default the object is
2164 : : * returned as type (mapping for anyType) but statically-typed
2165 : : * %idref can be created using the XML Schema extension. See the
2166 : : * C++/Tree Mapping User Manual for more information.
2167 : : *
2168 : : * @nosubgrouping
2169 : : */
2170 : : template <typename C, typename B, typename T>
2171 : : class idref: public B
2172 : : {
2173 : : typedef B base_type;
2174 : :
2175 : : base_type&
2176 : : base ()
2177 : : {
2178 : : return *this;
2179 : : }
2180 : :
2181 : : public:
2182 : : /**
2183 : : * @brief Referenced type.
2184 : : */
2185 : : typedef T ref_type;
2186 : :
2187 : : public:
2188 : : /**
2189 : : * @name Constructors
2190 : : */
2191 : : //@{
2192 : :
2193 : : /**
2194 : : * @brief Initialize an instance with a copy of a C %string.
2195 : : *
2196 : : * @param s A C %string to copy.
2197 : : */
2198 : : idref (const C* s)
2199 : : : base_type (s), identity_ (*this)
2200 : : {
2201 : : }
2202 : :
2203 : : /**
2204 : : * @brief Initialize an instance with a character array.
2205 : : *
2206 : : * @param s A character array to copy.
2207 : : * @param n A number of character to copy.
2208 : : */
2209 : : idref (const C* s, std::size_t n)
2210 : : : base_type (s, n), identity_ (*this)
2211 : : {
2212 : : }
2213 : :
2214 : : /**
2215 : : * @brief Initialize an instance with multiple copies of the same
2216 : : * character.
2217 : : *
2218 : : * @param n A number of copies to create.
2219 : : * @param c A character to copy.
2220 : : */
2221 : : idref (std::size_t n, C c)
2222 : : : base_type (n, c), identity_ (*this)
2223 : : {
2224 : : }
2225 : :
2226 : : /**
2227 : : * @brief Initialize an instance with a copy of a standard %string.
2228 : : *
2229 : : * @param s A standard %string to copy.
2230 : : */
2231 : : idref (const std::basic_string<C>& s)
2232 : : : base_type (s), identity_ (*this)
2233 : : {
2234 : : }
2235 : :
2236 : : /**
2237 : : * @brief Initialize an instance with a copy of a substring.
2238 : : *
2239 : : * @param s A standard %string to copy the substring from.
2240 : : * @param pos An index of the first character to copy from.
2241 : : * @param n A number of characters to copy.
2242 : : */
2243 : : idref (const std::basic_string<C>& s,
2244 : : std::size_t pos,
2245 : : std::size_t n = std::basic_string<C>::npos)
2246 : : : base_type (s, pos, n), identity_ (*this)
2247 : : {
2248 : : }
2249 : :
2250 : : public:
2251 : : /**
2252 : : * @brief Copy constructor.
2253 : : *
2254 : : * @param x An instance to make a copy of.
2255 : : * @param f Flags to create the copy with.
2256 : : * @param c A pointer to the object that will contain the copy.
2257 : : *
2258 : : * For polymorphic object models use the @c _clone function instead.
2259 : : */
2260 : : idref (const idref& x, flags f = 0, container* c = 0)
2261 : : : base_type (x, f, c), identity_ (*this)
2262 : : {
2263 : : }
2264 : :
2265 : : /**
2266 : : * @brief Copy the instance polymorphically.
2267 : : *
2268 : : * @param f Flags to create the copy with.
2269 : : * @param c A pointer to the object that will contain the copy.
2270 : : * @return A pointer to the dynamically allocated copy.
2271 : : *
2272 : : * This function ensures that the dynamic type of the instance
2273 : : * is used for copying and should be used for polymorphic object
2274 : : * models instead of the copy constructor.
2275 : : */
2276 : : virtual idref*
2277 : : _clone (flags f = 0, container* c = 0) const;
2278 : :
2279 : : public:
2280 : : /**
2281 : : * @brief Create an instance from a data representation
2282 : : * stream.
2283 : : *
2284 : : * @param s A stream to extract the data from.
2285 : : * @param f Flags to create the new instance with.
2286 : : * @param c A pointer to the object that will contain the new
2287 : : * instance.
2288 : : */
2289 : : template <typename S>
2290 : : idref (istream<S>& s, flags f = 0, container* c = 0);
2291 : :
2292 : : /**
2293 : : * @brief Create an instance from a DOM element.
2294 : : *
2295 : : * @param e A DOM element to extract the data from.
2296 : : * @param f Flags to create the new instance with.
2297 : : * @param c A pointer to the object that will contain the new
2298 : : * instance.
2299 : : */
2300 : : idref (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
2301 : :
2302 : : /**
2303 : : * @brief Create an instance from a DOM Attribute.
2304 : : *
2305 : : * @param a A DOM attribute to extract the data from.
2306 : : * @param f Flags to create the new instance with.
2307 : : * @param c A pointer to the object that will contain the new
2308 : : * instance.
2309 : : */
2310 : : idref (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
2311 : :
2312 : : /**
2313 : : * @brief Create an instance from a %string fragment.
2314 : : *
2315 : : * @param s A %string fragment to extract the data from.
2316 : : * @param e A pointer to DOM element containing the %string fragment.
2317 : : * @param f Flags to create the new instance with.
2318 : : * @param c A pointer to the object that will contain the new
2319 : : * instance.
2320 : : */
2321 : : idref (const std::basic_string<C>& s,
2322 : : const xercesc::DOMElement* e,
2323 : : flags f = 0,
2324 : : container* c = 0);
2325 : : //@}
2326 : :
2327 : : public:
2328 : : /**
2329 : : * @brief Assign a character to the instance.
2330 : : *
2331 : : * The resulting %idref has only one character.
2332 : : *
2333 : : * @param c A character to assign.
2334 : : * @return A reference to the instance.
2335 : : */
2336 : : idref&
2337 : : operator= (C c)
2338 : : {
2339 : : base () = c;
2340 : : return *this;
2341 : : }
2342 : :
2343 : : /**
2344 : : * @brief Assign a C %string to the instance.
2345 : : *
2346 : : * The resulting %idref contains a copy of the C %string.
2347 : : *
2348 : : * @param s A C %string to assign.
2349 : : * @return A reference to the instance.
2350 : : */
2351 : : idref&
2352 : : operator= (const C* s)
2353 : : {
2354 : : base () = s;
2355 : : return *this;
2356 : : }
2357 : :
2358 : : /**
2359 : : * @brief Assign a standard %string to the instance.
2360 : : *
2361 : : * The resulting %idref contains a copy of the standard %string.
2362 : : *
2363 : : * @param s A standard %string to assign.
2364 : : * @return A reference to the instance.
2365 : : */
2366 : : idref&
2367 : : operator= (const std::basic_string<C>& s)
2368 : : {
2369 : : base () = s;
2370 : : return *this;
2371 : : }
2372 : :
2373 : : /**
2374 : : * @brief Copy assignment operator.
2375 : : *
2376 : : * @param x An instance to assign.
2377 : : * @return A reference to the instance.
2378 : : */
2379 : : idref&
2380 : : operator= (const idref& x)
2381 : : {
2382 : : base () = x;
2383 : : return *this;
2384 : : }
2385 : :
2386 : : public:
2387 : : /**
2388 : : * @brief Call referenced object.
2389 : : *
2390 : : * @return A constant pointer to the referenced object.
2391 : : */
2392 : : const ref_type*
2393 : : operator-> () const
2394 : : {
2395 : : return get ();
2396 : : }
2397 : :
2398 : : /**
2399 : : * @brief Call referenced object.
2400 : : *
2401 : : * @return A pointer to the referenced object.
2402 : : */
2403 : : ref_type*
2404 : : operator-> ()
2405 : : {
2406 : : return get ();
2407 : : }
2408 : :
2409 : : /**
2410 : : * @brief Dereference referenced object.
2411 : : *
2412 : : * @return A constant C++ reference to the referenced object.
2413 : : */
2414 : : const ref_type&
2415 : : operator* () const
2416 : : {
2417 : : return *(get ());
2418 : : }
2419 : :
2420 : : /**
2421 : : * @brief Dereference referenced object.
2422 : : *
2423 : : * @return A C++ reference to the referenced object.
2424 : : */
2425 : : ref_type&
2426 : : operator* ()
2427 : : {
2428 : : return *(get ());
2429 : : }
2430 : :
2431 : : /**
2432 : : * @brief Get a constant pointer to the referenced object.
2433 : : *
2434 : : * @return A constant pointer to the referenced object or 0 if
2435 : : * the object is not found.
2436 : : */
2437 : : const ref_type*
2438 : : get () const
2439 : : {
2440 : : return dynamic_cast<const ref_type*> (get_ ());
2441 : : }
2442 : :
2443 : : /**
2444 : : * @brief Get a pointer to the referenced object.
2445 : : *
2446 : : * @return A pointer to the referenced object or 0 if the object
2447 : : * is not found.
2448 : : */
2449 : : ref_type*
2450 : : get ()
2451 : : {
2452 : : return dynamic_cast<ref_type*> (get_ ());
2453 : : }
2454 : :
2455 : : /**
2456 : : * @brief Opaque type that can be evaluated as true or false.
2457 : : */
2458 : : typedef void (idref::*bool_convertible)();
2459 : :
2460 : : /**
2461 : : * @brief Implicit conversion to boolean type.
2462 : : *
2463 : : * @return True if the referenced object is found, false otherwise.
2464 : : */
2465 : : operator bool_convertible () const
2466 : : {
2467 : : return get_ () ? &idref::true_ : 0;
2468 : : }
2469 : :
2470 : : protected:
2471 : : //@cond
2472 : :
2473 : : idref ()
2474 : : : base_type (), identity_ (*this)
2475 : : {
2476 : : }
2477 : :
2478 : : //@endcond
2479 : :
2480 : : private:
2481 : : const _type*
2482 : : get_ () const;
2483 : :
2484 : : _type*
2485 : : get_ ();
2486 : :
2487 : : void
2488 : : true_ ();
2489 : :
2490 : : private:
2491 : : identity_impl<C, B> identity_;
2492 : : };
2493 : :
2494 : :
2495 : : /**
2496 : : * @brief Class corresponding to the XML Schema IDREFS built-in
2497 : : * type.
2498 : : *
2499 : : * The %idrefs class is a vector (or %list in XML Schema terminology)
2500 : : * of idref elements. It is implemented in terms of the list class
2501 : : * template.
2502 : : *
2503 : : * @nosubgrouping
2504 : : */
2505 : : template <typename C, typename B, typename idref>
2506 : : class idrefs: public B, public list<idref, C>
2507 : : {
2508 : : typedef list<idref, C> base_type;
2509 : :
2510 : : public:
2511 : : /**
2512 : : * @name Constructors
2513 : : */
2514 : : //@{
2515 : :
2516 : : /**
2517 : : * @brief Default constructor creates no elements.
2518 : : */
2519 : : idrefs ()
2520 : : : base_type (this)
2521 : : {
2522 : : }
2523 : :
2524 : : /**
2525 : : * @brief Initialize the instance with copies of an exemplar elements.
2526 : : *
2527 : : * @param n A number of elements to copy.
2528 : : * @param x An exemplar element to copy.
2529 : : */
2530 : : idrefs (typename base_type::size_type n, const idref& x)
2531 : : : base_type (n, x, this)
2532 : : {
2533 : : }
2534 : :
2535 : : /**
2536 : : * @brief Initialize the instance with copies of elements from an
2537 : : * iterator range.
2538 : : *
2539 : : * @param begin An iterator pointing to the first element.
2540 : : * @param end An iterator pointing to the one past the last element.
2541 : : */
2542 : : template <typename I>
2543 : : idrefs (const I& begin, const I& end)
2544 : : : base_type (begin, end, this)
2545 : : {
2546 : : }
2547 : :
2548 : : public:
2549 : : /**
2550 : : * @brief Copy constructor.
2551 : : *
2552 : : * @param x An instance to make a copy of.
2553 : : * @param f Flags to create the copy with.
2554 : : * @param c A pointer to the object that will contain the copy.
2555 : : *
2556 : : * For polymorphic object models use the @c _clone function instead.
2557 : : */
2558 : : idrefs (const idrefs& x, flags f = 0, container* c = 0)
2559 : : : B (x, f, c), base_type (x, f, this)
2560 : : {
2561 : : }
2562 : :
2563 : : /**
2564 : : * @brief Copy the instance polymorphically.
2565 : : *
2566 : : * @param f Flags to create the copy with.
2567 : : * @param c A pointer to the object that will contain the copy.
2568 : : * @return A pointer to the dynamically allocated copy.
2569 : : *
2570 : : * This function ensures that the dynamic type of the instance
2571 : : * is used for copying and should be used for polymorphic object
2572 : : * models instead of the copy constructor.
2573 : : */
2574 : : virtual idrefs*
2575 : : _clone (flags f = 0, container* c = 0) const;
2576 : :
2577 : : public:
2578 : : /**
2579 : : * @brief Create an instance from a data representation
2580 : : * stream.
2581 : : *
2582 : : * @param s A stream to extract the data from.
2583 : : * @param f Flags to create the new instance with.
2584 : : * @param c A pointer to the object that will contain the new
2585 : : * instance.
2586 : : */
2587 : : template <typename S>
2588 : : idrefs (istream<S>& s, flags f = 0, container* c = 0);
2589 : :
2590 : : /**
2591 : : * @brief Create an instance from a DOM element.
2592 : : *
2593 : : * @param e A DOM element to extract the data from.
2594 : : * @param f Flags to create the new instance with.
2595 : : * @param c A pointer to the object that will contain the new
2596 : : * instance.
2597 : : */
2598 : : idrefs (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
2599 : :
2600 : : /**
2601 : : * @brief Create an instance from a DOM Attribute.
2602 : : *
2603 : : * @param a A DOM attribute to extract the data from.
2604 : : * @param f Flags to create the new instance with.
2605 : : * @param c A pointer to the object that will contain the new
2606 : : * instance.
2607 : : */
2608 : : idrefs (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
2609 : :
2610 : : /**
2611 : : * @brief Create an instance from a %string fragment.
2612 : : *
2613 : : * @param s A %string fragment to extract the data from.
2614 : : * @param e A pointer to DOM element containing the %string fragment.
2615 : : * @param f Flags to create the new instance with.
2616 : : * @param c A pointer to the object that will contain the new
2617 : : * instance.
2618 : : */
2619 : : idrefs (const std::basic_string<C>& s,
2620 : : const xercesc::DOMElement* e,
2621 : : flags f = 0,
2622 : : container* c = 0);
2623 : : //@}
2624 : : };
2625 : :
2626 : : /**
2627 : : * @brief %idrefs comparison operator.
2628 : : *
2629 : : * @return True if the lists of idrefs are equal, false otherwise.
2630 : : */
2631 : : template <typename C, typename B, typename idref>
2632 : : inline bool
2633 : : operator== (const idrefs<C, B, idref>& a, const idrefs<C, B, idref>& b)
2634 : : {
2635 : : return static_cast<const list<idref, C>&> (a) == b;
2636 : : }
2637 : :
2638 : : /**
2639 : : * @brief %idrefs comparison operator.
2640 : : *
2641 : : * @return True if the lists of idrefs are not equal, false otherwise.
2642 : : */
2643 : : template <typename C, typename B, typename idref>
2644 : : inline bool
2645 : : operator!= (const idrefs<C, B, idref>& a, const idrefs<C, B, idref>& b)
2646 : : {
2647 : : return !(a == b);
2648 : : }
2649 : :
2650 : : /**
2651 : : * @brief Class corresponding to the XML Schema anyURI built-in
2652 : : * type.
2653 : : *
2654 : : * The %uri class publicly inherits from and has the same set
2655 : : * of constructors as @c std::basic_string. It therefore can be
2656 : : * used as @c std::string (or @c std::wstring if you are using
2657 : : * @c wchar_t as the character type).
2658 : : *
2659 : : * @nosubgrouping
2660 : : */
2661 : : template <typename C, typename B>
2662 : : class uri: public B, public std::basic_string<C>
2663 : : {
2664 : : typedef std::basic_string<C> base_type;
2665 : :
2666 : : base_type&
2667 : : base ()
2668 : : {
2669 : : return *this;
2670 : : }
2671 : :
2672 : : public:
2673 : : /**
2674 : : * @name Constructors
2675 : : */
2676 : : //@{
2677 : :
2678 : : /**
2679 : : * @brief Initialize an instance with a copy of a C %string.
2680 : : *
2681 : : * @param s A C %string to copy.
2682 : : */
2683 : : uri (const C* s)
2684 : : : base_type (s)
2685 : : {
2686 : : }
2687 : :
2688 : : /**
2689 : : * @brief Initialize an instance with a character array.
2690 : : *
2691 : : * @param s A character array to copy.
2692 : : * @param n A number of character to copy.
2693 : : */
2694 : : uri (const C* s, std::size_t n)
2695 : : : base_type (s, n)
2696 : : {
2697 : : }
2698 : :
2699 : : /**
2700 : : * @brief Initialize an instance with multiple copies of the same
2701 : : * character.
2702 : : *
2703 : : * @param n A number of copies to create.
2704 : : * @param c A character to copy.
2705 : : */
2706 : : uri (std::size_t n, C c)
2707 : : : base_type (n, c)
2708 : : {
2709 : : }
2710 : :
2711 : : /**
2712 : : * @brief Initialize an instance with a copy of a standard %string.
2713 : : *
2714 : : * @param s A standard %string to copy.
2715 : : */
2716 : : uri (const std::basic_string<C>& s)
2717 : : : base_type (s)
2718 : : {
2719 : : }
2720 : :
2721 : : /**
2722 : : * @brief Initialize an instance with a copy of a substring.
2723 : : *
2724 : : * @param s A standard %string to copy the substring from.
2725 : : * @param pos An index of the first character to copy from.
2726 : : * @param n A number of characters to copy.
2727 : : */
2728 : : uri (const std::basic_string<C>& s,
2729 : : std::size_t pos,
2730 : : std::size_t n = std::basic_string<C>::npos)
2731 : : : base_type (s, pos, n)
2732 : : {
2733 : : }
2734 : :
2735 : : public:
2736 : : /**
2737 : : * @brief Copy constructor.
2738 : : *
2739 : : * @param x An instance to make a copy of.
2740 : : * @param f Flags to create the copy with.
2741 : : * @param c A pointer to the object that will contain the copy.
2742 : : *
2743 : : * For polymorphic object models use the @c _clone function instead.
2744 : : */
2745 : : uri (const uri& x, flags f = 0, container* c = 0)
2746 : : : B (x, f, c), base_type (x)
2747 : : {
2748 : : }
2749 : :
2750 : : /**
2751 : : * @brief Copy the instance polymorphically.
2752 : : *
2753 : : * @param f Flags to create the copy with.
2754 : : * @param c A pointer to the object that will contain the copy.
2755 : : * @return A pointer to the dynamically allocated copy.
2756 : : *
2757 : : * This function ensures that the dynamic type of the instance
2758 : : * is used for copying and should be used for polymorphic object
2759 : : * models instead of the copy constructor.
2760 : : */
2761 : : virtual uri*
2762 : : _clone (flags f = 0, container* c = 0) const;
2763 : :
2764 : : public:
2765 : : /**
2766 : : * @brief Create an instance from a data representation
2767 : : * stream.
2768 : : *
2769 : : * @param s A stream to extract the data from.
2770 : : * @param f Flags to create the new instance with.
2771 : : * @param c A pointer to the object that will contain the new
2772 : : * instance.
2773 : : */
2774 : : template <typename S>
2775 : : uri (istream<S>& s, flags f = 0, container* c = 0);
2776 : :
2777 : : /**
2778 : : * @brief Create an instance from a DOM element.
2779 : : *
2780 : : * @param e A DOM element to extract the data from.
2781 : : * @param f Flags to create the new instance with.
2782 : : * @param c A pointer to the object that will contain the new
2783 : : * instance.
2784 : : */
2785 : : uri (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
2786 : :
2787 : : /**
2788 : : * @brief Create an instance from a DOM Attribute.
2789 : : *
2790 : : * @param a A DOM attribute to extract the data from.
2791 : : * @param f Flags to create the new instance with.
2792 : : * @param c A pointer to the object that will contain the new
2793 : : * instance.
2794 : : */
2795 : : uri (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
2796 : :
2797 : : /**
2798 : : * @brief Create an instance from a %string fragment.
2799 : : *
2800 : : * @param s A %string fragment to extract the data from.
2801 : : * @param e A pointer to DOM element containing the %string fragment.
2802 : : * @param f Flags to create the new instance with.
2803 : : * @param c A pointer to the object that will contain the new
2804 : : * instance.
2805 : : */
2806 : : uri (const std::basic_string<C>& s,
2807 : : const xercesc::DOMElement* e,
2808 : : flags f = 0,
2809 : : container* c = 0);
2810 : : //@}
2811 : :
2812 : : public:
2813 : : /**
2814 : : * @brief Assign a character to the instance.
2815 : : *
2816 : : * The resulting %uri has only one character.
2817 : : *
2818 : : * @param c A character to assign.
2819 : : * @return A reference to the instance.
2820 : : */
2821 : : uri&
2822 : : operator= (C c)
2823 : : {
2824 : : base () = c;
2825 : : return *this;
2826 : : }
2827 : :
2828 : : /**
2829 : : * @brief Assign a C %string to the instance.
2830 : : *
2831 : : * The resulting %uri contains a copy of the C %string.
2832 : : *
2833 : : * @param s A C %string to assign.
2834 : : * @return A reference to the instance.
2835 : : */
2836 : : uri&
2837 : : operator= (const C* s)
2838 : : {
2839 : : base () = s;
2840 : : return *this;
2841 : : }
2842 : :
2843 : : /**
2844 : : * @brief Assign a standard %string to the instance.
2845 : : *
2846 : : * The resulting %uri contains a copy of the standard %string.
2847 : : *
2848 : : * @param s A standard %string to assign.
2849 : : * @return A reference to the instance.
2850 : : */
2851 : : uri&
2852 : : operator= (const std::basic_string<C>& s)
2853 : : {
2854 : : base () = s;
2855 : : return *this;
2856 : : }
2857 : :
2858 : : /**
2859 : : * @brief Copy assignment operator.
2860 : : *
2861 : : * @param x An instance to assign.
2862 : : * @return A reference to the instance.
2863 : : */
2864 : : uri&
2865 : : operator= (const uri& x)
2866 : : {
2867 : : base () = x;
2868 : : return *this;
2869 : : }
2870 : :
2871 : : protected:
2872 : : //@cond
2873 : :
2874 : : uri ()
2875 : : : base_type ()
2876 : : {
2877 : : }
2878 : :
2879 : : //@endcond
2880 : :
2881 : : template <typename, typename, typename, typename>
2882 : : friend class qname;
2883 : : };
2884 : :
2885 : : /**
2886 : : * @brief %uri comparison operator.
2887 : : *
2888 : : * @return True if the uris are equal, false otherwise.
2889 : : */
2890 : : template <typename C, typename B>
2891 : : inline bool
2892 : : operator== (const uri<C, B>& a, const uri<C, B>& b)
2893 : : {
2894 : : return static_cast<const std::basic_string<C>&> (a) == b;
2895 : : }
2896 : :
2897 : : /**
2898 : : * @brief %uri comparison operator.
2899 : : *
2900 : : * @return True if the uris are not equal, false otherwise.
2901 : : */
2902 : : template <typename C, typename B>
2903 : : inline bool
2904 : : operator!= (const uri<C, B>& a, const uri<C, B>& b)
2905 : : {
2906 : : return !(a == b);
2907 : : }
2908 : :
2909 : : /**
2910 : : * @brief Class corresponding to the XML Schema QName built-in
2911 : : * type.
2912 : : *
2913 : : * The %qname class represents a potentially namespace-qualified
2914 : : * XML %name.
2915 : : *
2916 : : * @nosubgrouping
2917 : : */
2918 : : template <typename C, typename B, typename uri, typename ncname>
2919 : : class qname: public B
2920 : : {
2921 : : public:
2922 : : /**
2923 : : * @name Constructors
2924 : : */
2925 : : //@{
2926 : :
2927 : : /**
2928 : : * @brief Initialize an instance with a %name only.
2929 : : *
2930 : : * The resulting %qname is unqualified.
2931 : : *
2932 : : * @param n An XML %name (ncname).
2933 : : */
2934 : : qname (const ncname& n)
2935 : : : ns_ (), name_ (n)
2936 : : {
2937 : : }
2938 : :
2939 : : /**
2940 : : * @brief Initialize an instance with a %name and a namespace.
2941 : : *
2942 : : * The resulting %qname is qualified.
2943 : : *
2944 : : * @param ns An XML namespace (uri).
2945 : : * @param n An XML %name (ncname).
2946 : : */
2947 : : qname (const uri& ns, const ncname& n)
2948 : : : ns_ (ns), name_ (n)
2949 : : {
2950 : : }
2951 : :
2952 : : public:
2953 : : /**
2954 : : * @brief Copy constructor.
2955 : : *
2956 : : * @param x An instance to make a copy of.
2957 : : * @param f Flags to create the copy with.
2958 : : * @param c A pointer to the object that will contain the copy.
2959 : : *
2960 : : * For polymorphic object models use the @c _clone function instead.
2961 : : */
2962 : : qname (const qname& x, flags f = 0, container* c = 0)
2963 : : : B (x, f, c),
2964 : : ns_ (x.ns_),
2965 : : name_ (x.name_)
2966 : : {
2967 : : // Note that ns_ and name_ have no DOM association.
2968 : : //
2969 : : }
2970 : :
2971 : : /**
2972 : : * @brief Copy the instance polymorphically.
2973 : : *
2974 : : * @param f Flags to create the copy with.
2975 : : * @param c A pointer to the object that will contain the copy.
2976 : : * @return A pointer to the dynamically allocated copy.
2977 : : *
2978 : : * This function ensures that the dynamic type of the instance
2979 : : * is used for copying and should be used for polymorphic object
2980 : : * models instead of the copy constructor.
2981 : : */
2982 : : virtual qname*
2983 : : _clone (flags f = 0, container* c = 0) const;
2984 : :
2985 : : public:
2986 : : /**
2987 : : * @brief Create an instance from a data representation
2988 : : * stream.
2989 : : *
2990 : : * @param s A stream to extract the data from.
2991 : : * @param f Flags to create the new instance with.
2992 : : * @param c A pointer to the object that will contain the new
2993 : : * instance.
2994 : : */
2995 : : template <typename S>
2996 : : qname (istream<S>& s, flags f = 0, container* c = 0);
2997 : :
2998 : : /**
2999 : : * @brief Create an instance from a DOM element.
3000 : : *
3001 : : * @param e A DOM element to extract the data from.
3002 : : * @param f Flags to create the new instance with.
3003 : : * @param c A pointer to the object that will contain the new
3004 : : * instance.
3005 : : */
3006 : : qname (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
3007 : :
3008 : : /**
3009 : : * @brief Create an instance from a DOM Attribute.
3010 : : *
3011 : : * @param a A DOM attribute to extract the data from.
3012 : : * @param f Flags to create the new instance with.
3013 : : * @param c A pointer to the object that will contain the new
3014 : : * instance.
3015 : : */
3016 : : qname (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
3017 : :
3018 : : /**
3019 : : * @brief Create an instance from a %string fragment.
3020 : : *
3021 : : * @param s A %string fragment to extract the data from.
3022 : : * @param e A pointer to DOM element containing the %string fragment.
3023 : : * @param f Flags to create the new instance with.
3024 : : * @param c A pointer to the object that will contain the new
3025 : : * instance.
3026 : : */
3027 : : qname (const std::basic_string<C>& s,
3028 : : const xercesc::DOMElement* e,
3029 : : flags f = 0,
3030 : : container* c = 0);
3031 : : //@}
3032 : :
3033 : : public:
3034 : : /**
3035 : : * @brief Determine if the %name is qualified.
3036 : : *
3037 : : * @return True if the %name is qualified, false otherwise.
3038 : : */
3039 : : bool
3040 : : qualified () const
3041 : : {
3042 : : return !ns_.empty ();
3043 : : }
3044 : :
3045 : : /**
3046 : : * @brief Get XML namespace.
3047 : : *
3048 : : * @return A constant reference to qualifying XML namespace.
3049 : : */
3050 : : const uri&
3051 : : namespace_ () const
3052 : : {
3053 : : return ns_;
3054 : : }
3055 : :
3056 : : /**
3057 : : * @brief Get XML %name.
3058 : : *
3059 : : * @return A constant reference to unqualified XML %name.
3060 : : */
3061 : : const ncname&
3062 : : name () const
3063 : : {
3064 : : return name_;
3065 : : }
3066 : :
3067 : : protected:
3068 : : //@cond
3069 : :
3070 : : qname ()
3071 : : : ns_ (), name_ ()
3072 : : {
3073 : : }
3074 : :
3075 : : //@endcond
3076 : :
3077 : : private:
3078 : : static uri
3079 : : resolve (const std::basic_string<C>&, const xercesc::DOMElement*);
3080 : :
3081 : : private:
3082 : : uri ns_;
3083 : : ncname name_;
3084 : : };
3085 : :
3086 : : /**
3087 : : * @brief %qname comparison operator.
3088 : : *
3089 : : * @return True if the names are equal, false otherwise.
3090 : : */
3091 : : template <typename C, typename B, typename uri, typename ncname>
3092 : : inline bool
3093 : : operator== (const qname<C, B, uri, ncname>& a,
3094 : : const qname<C, B, uri, ncname>& b)
3095 : : {
3096 : : return a.name () == b.name () && a.namespace_ () == b.namespace_ ();
3097 : : }
3098 : :
3099 : : /**
3100 : : * @brief %qname comparison operator.
3101 : : *
3102 : : * @return True if the names are not equal, false otherwise.
3103 : : */
3104 : : template <typename C, typename B, typename uri, typename ncname>
3105 : : inline bool
3106 : : operator!= (const qname<C, B, uri, ncname>& a,
3107 : : const qname<C, B, uri, ncname>& b)
3108 : : {
3109 : : return !(a == b);
3110 : : }
3111 : :
3112 : :
3113 : : /**
3114 : : * @brief Class corresponding to the XML Schema base64Binary
3115 : : * built-in type.
3116 : : *
3117 : : * The %base64_binary class is a binary %buffer abstraction with
3118 : : * base64-encoded representation in XML. It publicly inherits from
3119 : : * the buffer class which provides the %buffer functionality.
3120 : : *
3121 : : * @nosubgrouping
3122 : : */
3123 : : template <typename C, typename B>
3124 : : class base64_binary: public B, public buffer<C>
3125 : : {
3126 : : public:
3127 : : typedef typename buffer<C>::size_t size_t;
3128 : :
3129 : : public:
3130 : : /**
3131 : : * @name Constructors
3132 : : */
3133 : : //@{
3134 : :
3135 : : /**
3136 : : * @brief Allocate a %buffer of the specified size.
3137 : : *
3138 : : * The resulting %buffer has the same size and capacity.
3139 : : *
3140 : : * @param size A %buffer size in bytes.
3141 : : */
3142 : : explicit
3143 : : base64_binary (size_t size = 0);
3144 : :
3145 : : /**
3146 : : * @brief Allocate a %buffer of the specified size and capacity.
3147 : : *
3148 : : * @param size A %buffer size in bytes.
3149 : : * @param capacity A %buffer capacity in bytes.
3150 : : * @throw bounds If @a size exceeds @a capacity
3151 : : */
3152 : : base64_binary (size_t size, size_t capacity);
3153 : :
3154 : : /**
3155 : : * @brief Allocate a %buffer of the specified size and copy
3156 : : * the data.
3157 : : *
3158 : : * The resulting %buffer has the same size and capacity with
3159 : : * @a size bytes copied from @a data.
3160 : : *
3161 : : * @param data A %buffer to copy the data from.
3162 : : * @param size A %buffer size in bytes.
3163 : : */
3164 : : base64_binary (const void* data, size_t size);
3165 : :
3166 : : /**
3167 : : * @brief Allocate a %buffer of the specified size and capacity
3168 : : * and copy the data.
3169 : : *
3170 : : * @a size bytes are copied from @a data to the resulting
3171 : : * %buffer.
3172 : : *
3173 : : * @param data A %buffer to copy the data from.
3174 : : * @param size A %buffer size in bytes.
3175 : : * @param capacity A %buffer capacity in bytes.
3176 : : * @throw bounds If @a size exceeds @a capacity
3177 : : */
3178 : : base64_binary (const void* data, size_t size, size_t capacity);
3179 : :
3180 : : /**
3181 : : * @brief Reuse an existing %buffer.
3182 : : *
3183 : : * If the @a assume_ownership argument is true, the %buffer will
3184 : : * assume ownership of @a data and will release the memory
3185 : : * by calling @c operator @c delete().
3186 : : *
3187 : : * @param data A %buffer to reuse.
3188 : : * @param size A %buffer size in bytes.
3189 : : * @param capacity A %buffer capacity in bytes.
3190 : : * @param assume_ownership A boolean value indication whether to
3191 : : * assume ownership.
3192 : : * @throw bounds If @a size exceeds @a capacity
3193 : : */
3194 : : base64_binary (void* data,
3195 : : size_t size,
3196 : : size_t capacity,
3197 : : bool assume_ownership);
3198 : : public:
3199 : : /**
3200 : : * @brief Copy constructor.
3201 : : *
3202 : : * @param x An instance to make a copy of.
3203 : : * @param f Flags to create the copy with.
3204 : : * @param c A pointer to the object that will contain the copy.
3205 : : *
3206 : : * For polymorphic object models use the @c _clone function instead.
3207 : : */
3208 : : base64_binary (const base64_binary& x,
3209 : : flags f = 0,
3210 : : container* c = 0)
3211 : : : B (x, f, c), buffer<C> (x)
3212 : : {
3213 : : }
3214 : :
3215 : : /**
3216 : : * @brief Copy the instance polymorphically.
3217 : : *
3218 : : * @param f Flags to create the copy with.
3219 : : * @param c A pointer to the object that will contain the copy.
3220 : : * @return A pointer to the dynamically allocated copy.
3221 : : *
3222 : : * This function ensures that the dynamic type of the instance
3223 : : * is used for copying and should be used for polymorphic object
3224 : : * models instead of the copy constructor.
3225 : : */
3226 : : virtual base64_binary*
3227 : : _clone (flags f = 0, container* c = 0) const;
3228 : :
3229 : : public:
3230 : : /**
3231 : : * @brief Create an instance from a data representation
3232 : : * stream.
3233 : : *
3234 : : * @param s A stream to extract the data from.
3235 : : * @param f Flags to create the new instance with.
3236 : : * @param c A pointer to the object that will contain the new
3237 : : * instance.
3238 : : */
3239 : : template <typename S>
3240 : : base64_binary (istream<S>& s, flags f = 0, container* c = 0);
3241 : :
3242 : : /**
3243 : : * @brief Create an instance from a DOM element.
3244 : : *
3245 : : * @param e A DOM element to extract the data from.
3246 : : * @param f Flags to create the new instance with.
3247 : : * @param c A pointer to the object that will contain the new
3248 : : * instance.
3249 : : */
3250 : : base64_binary (const xercesc::DOMElement& e,
3251 : : flags f = 0,
3252 : : container* c = 0);
3253 : :
3254 : : /**
3255 : : * @brief Create an instance from a DOM Attribute.
3256 : : *
3257 : : * @param a A DOM attribute to extract the data from.
3258 : : * @param f Flags to create the new instance with.
3259 : : * @param c A pointer to the object that will contain the new
3260 : : * instance.
3261 : : */
3262 : : base64_binary (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
3263 : :
3264 : : /**
3265 : : * @brief Create an instance from a %string fragment.
3266 : : *
3267 : : * @param s A %string fragment to extract the data from.
3268 : : * @param e A pointer to DOM element containing the %string fragment.
3269 : : * @param f Flags to create the new instance with.
3270 : : * @param c A pointer to the object that will contain the new
3271 : : * instance.
3272 : : */
3273 : : base64_binary (const std::basic_string<C>& s,
3274 : : const xercesc::DOMElement* e,
3275 : : flags f = 0,
3276 : : container* c = 0);
3277 : : //@}
3278 : :
3279 : : public:
3280 : : /**
3281 : : * @brief Copy assignment operator.
3282 : : *
3283 : : * @param x An instance to assign.
3284 : : * @return A reference to the instance.
3285 : : */
3286 : : base64_binary&
3287 : : operator= (const base64_binary& x)
3288 : : {
3289 : : buffer<C>& b (*this);
3290 : : b = x;
3291 : : return *this;
3292 : : }
3293 : :
3294 : : public:
3295 : : /**
3296 : : * @brief Encode the %buffer in base64 encoding.
3297 : : *
3298 : : * @return A %string with base64-encoded data.
3299 : : */
3300 : : std::basic_string<C>
3301 : : encode () const;
3302 : :
3303 : : private:
3304 : : void
3305 : : decode (const XMLCh*);
3306 : : };
3307 : :
3308 : : /**
3309 : : * @brief %base64_binary comparison operator.
3310 : : *
3311 : : * @return True if the binaries are equal, false otherwise.
3312 : : */
3313 : : template <typename C, typename B>
3314 : : inline bool
3315 : : operator== (const base64_binary<C, B>& a, const base64_binary<C, B>& b)
3316 : : {
3317 : : return static_cast<const buffer<C>&> (a) == b;
3318 : : }
3319 : :
3320 : : /**
3321 : : * @brief %base64_binary comparison operator.
3322 : : *
3323 : : * @return True if the binaries are not equal, false otherwise.
3324 : : */
3325 : : template <typename C, typename B>
3326 : : inline bool
3327 : : operator!= (const base64_binary<C, B>& a, const base64_binary<C, B>& b)
3328 : : {
3329 : : return !(a == b);
3330 : : }
3331 : :
3332 : : /**
3333 : : * @brief Class corresponding to the XML Schema hexBinary
3334 : : * built-in type.
3335 : : *
3336 : : * The %hex_binary class is a binary %buffer abstraction with
3337 : : * hex-encoded representation in XML. It publicly inherits from
3338 : : * the buffer class which provides the %buffer functionality.
3339 : : *
3340 : : * @nosubgrouping
3341 : : */
3342 : : template <typename C, typename B>
3343 : : class hex_binary: public B, public buffer<C>
3344 : : {
3345 : : public:
3346 : : typedef typename buffer<C>::size_t size_t;
3347 : :
3348 : : public:
3349 : : /**
3350 : : * @name Constructors
3351 : : */
3352 : : //@{
3353 : :
3354 : : /**
3355 : : * @brief Allocate a %buffer of the specified size.
3356 : : *
3357 : : * The resulting %buffer has the same size and capacity.
3358 : : *
3359 : : * @param size A %buffer size in bytes.
3360 : : */
3361 : : explicit
3362 : : hex_binary (size_t size = 0);
3363 : :
3364 : : /**
3365 : : * @brief Allocate a %buffer of the specified size and capacity.
3366 : : *
3367 : : * @param size A %buffer size in bytes.
3368 : : * @param capacity A %buffer capacity in bytes.
3369 : : * @throw bounds If @a size exceeds @a capacity
3370 : : */
3371 : : hex_binary (size_t size, size_t capacity);
3372 : :
3373 : : /**
3374 : : * @brief Allocate a %buffer of the specified size and copy
3375 : : * the data.
3376 : : *
3377 : : * The resulting %buffer has the same size and capacity with
3378 : : * @a size bytes copied from @a data.
3379 : : *
3380 : : * @param data A %buffer to copy the data from.
3381 : : * @param size A %buffer size in bytes.
3382 : : */
3383 : : hex_binary (const void* data, size_t size);
3384 : :
3385 : : /**
3386 : : * @brief Allocate a %buffer of the specified size and capacity
3387 : : * and copy the data.
3388 : : *
3389 : : * @a size bytes are copied from @a data to the resulting
3390 : : * %buffer.
3391 : : *
3392 : : * @param data A %buffer to copy the data from.
3393 : : * @param size A %buffer size in bytes.
3394 : : * @param capacity A %buffer capacity in bytes.
3395 : : * @throw bounds If @a size exceeds @a capacity
3396 : : */
3397 : : hex_binary (const void* data, size_t size, size_t capacity);
3398 : :
3399 : : /**
3400 : : * @brief Reuse an existing %buffer..
3401 : : *
3402 : : * If the @a assume_ownership argument is true, the %buffer will
3403 : : * assume ownership of @a data and will release the memory
3404 : : * by calling @c operator @c delete().
3405 : : *
3406 : : * @param data A %buffer to reuse.
3407 : : * @param size A %buffer size in bytes.
3408 : : * @param capacity A %buffer capacity in bytes.
3409 : : * @param assume_ownership A boolean value indication whether to
3410 : : * assume ownership.
3411 : : * @throw bounds If @a size exceeds @a capacity
3412 : : */
3413 : : hex_binary (void* data,
3414 : : size_t size,
3415 : : size_t capacity,
3416 : : bool assume_ownership);
3417 : :
3418 : : public:
3419 : : /**
3420 : : * @brief Copy constructor.
3421 : : *
3422 : : * @param x An instance to make a copy of.
3423 : : * @param f Flags to create the copy with.
3424 : : * @param c A pointer to the object that will contain the copy.
3425 : : *
3426 : : * For polymorphic object models use the @c _clone function instead.
3427 : : */
3428 : : hex_binary (const hex_binary& x, flags f = 0, container* c = 0)
3429 : : : B (x, f, c), buffer<C> (x)
3430 : : {
3431 : : }
3432 : :
3433 : : /**
3434 : : * @brief Copy the instance polymorphically.
3435 : : *
3436 : : * @param f Flags to create the copy with.
3437 : : * @param c A pointer to the object that will contain the copy.
3438 : : * @return A pointer to the dynamically allocated copy.
3439 : : *
3440 : : * This function ensures that the dynamic type of the instance
3441 : : * is used for copying and should be used for polymorphic object
3442 : : * models instead of the copy constructor.
3443 : : */
3444 : : virtual hex_binary*
3445 : : _clone (flags f = 0, container* c = 0) const;
3446 : :
3447 : : public:
3448 : : /**
3449 : : * @brief Create an instance from a data representation
3450 : : * stream.
3451 : : *
3452 : : * @param s A stream to extract the data from.
3453 : : * @param f Flags to create the new instance with.
3454 : : * @param c A pointer to the object that will contain the new
3455 : : * instance.
3456 : : */
3457 : : template <typename S>
3458 : : hex_binary (istream<S>& s, flags f = 0, container* c = 0);
3459 : :
3460 : : /**
3461 : : * @brief Create an instance from a DOM element.
3462 : : *
3463 : : * @param e A DOM element to extract the data from.
3464 : : * @param f Flags to create the new instance with.
3465 : : * @param c A pointer to the object that will contain the new
3466 : : * instance.
3467 : : */
3468 : : hex_binary (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
3469 : :
3470 : : /**
3471 : : * @brief Create an instance from a DOM Attribute.
3472 : : *
3473 : : * @param a A DOM attribute to extract the data from.
3474 : : * @param f Flags to create the new instance with.
3475 : : * @param c A pointer to the object that will contain the new
3476 : : * instance.
3477 : : */
3478 : : hex_binary (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
3479 : :
3480 : : /**
3481 : : * @brief Create an instance from a %string fragment.
3482 : : *
3483 : : * @param s A %string fragment to extract the data from.
3484 : : * @param e A pointer to DOM element containing the %string fragment.
3485 : : * @param f Flags to create the new instance with.
3486 : : * @param c A pointer to the object that will contain the new
3487 : : * instance.
3488 : : */
3489 : : hex_binary (const std::basic_string<C>& s,
3490 : : const xercesc::DOMElement* e,
3491 : : flags f = 0,
3492 : : container* c = 0);
3493 : : //@}
3494 : :
3495 : : public:
3496 : : /**
3497 : : * @brief Copy assignment operator.
3498 : : *
3499 : : * @param x An instance to assign.
3500 : : * @return A reference to the instance.
3501 : : */
3502 : : hex_binary&
3503 : : operator= (const hex_binary& x)
3504 : : {
3505 : : buffer<C>& b (*this);
3506 : : b = x;
3507 : : return *this;
3508 : : }
3509 : :
3510 : : public:
3511 : : /**
3512 : : * @brief Encode the %buffer in hex encoding.
3513 : : *
3514 : : * @return A %string with hex-encoded data.
3515 : : */
3516 : : std::basic_string<C>
3517 : : encode () const;
3518 : :
3519 : : private:
3520 : : void
3521 : : decode (const XMLCh*);
3522 : : };
3523 : :
3524 : : /**
3525 : : * @brief %hex_binary comparison operator.
3526 : : *
3527 : : * @return True if the binaries are equal, false otherwise.
3528 : : */
3529 : : template <typename C, typename B>
3530 : : inline bool
3531 : : operator== (const hex_binary<C, B>& a, const hex_binary<C, B>& b)
3532 : : {
3533 : : return static_cast<const buffer<C>&> (a) == b;
3534 : : }
3535 : :
3536 : : /**
3537 : : * @brief %hex_binary comparison operator.
3538 : : *
3539 : : * @return True if the binaries are not equal, false otherwise.
3540 : : */
3541 : : template <typename C, typename B>
3542 : : inline bool
3543 : : operator!= (const hex_binary<C, B>& a, const hex_binary<C, B>& b)
3544 : : {
3545 : : return !(a == b);
3546 : : }
3547 : :
3548 : : /**
3549 : : * @brief Class corresponding to the XML Schema ENTITY built-in
3550 : : * type.
3551 : : *
3552 : : * The %entity class publicly inherits from and has the same set
3553 : : * of constructors as @c std::basic_string. It therefore can be
3554 : : * used as @c std::string (or @c std::wstring if you are using
3555 : : * @c wchar_t as the character type).
3556 : : *
3557 : : * @nosubgrouping
3558 : : */
3559 : : template <typename C, typename B>
3560 : : class entity: public B
3561 : : {
3562 : : typedef B base_type;
3563 : :
3564 : : base_type&
3565 : : base ()
3566 : : {
3567 : : return *this;
3568 : : }
3569 : :
3570 : : public:
3571 : : /**
3572 : : * @name Constructors
3573 : : */
3574 : : //@{
3575 : :
3576 : : /**
3577 : : * @brief Initialize an instance with a copy of a C %string.
3578 : : *
3579 : : * @param s A C %string to copy.
3580 : : */
3581 : : entity (const C* s)
3582 : : : base_type (s)
3583 : : {
3584 : : }
3585 : :
3586 : : /**
3587 : : * @brief Initialize an instance with a character array.
3588 : : *
3589 : : * @param s A character array to copy.
3590 : : * @param n A number of character to copy.
3591 : : */
3592 : : entity (const C* s, std::size_t n)
3593 : : : base_type (s, n)
3594 : : {
3595 : : }
3596 : :
3597 : : /**
3598 : : * @brief Initialize an instance with multiple copies of the same
3599 : : * character.
3600 : : *
3601 : : * @param n A number of copies to create.
3602 : : * @param c A character to copy.
3603 : : */
3604 : : entity (std::size_t n, C c)
3605 : : : base_type (n, c)
3606 : : {
3607 : : }
3608 : :
3609 : : /**
3610 : : * @brief Initialize an instance with a copy of a standard %string.
3611 : : *
3612 : : * @param s A standard %string to copy.
3613 : : */
3614 : : entity (const std::basic_string<C>& s)
3615 : : : base_type (s)
3616 : : {
3617 : : }
3618 : :
3619 : : /**
3620 : : * @brief Initialize an instance with a copy of a substring.
3621 : : *
3622 : : * @param s A standard %string to copy the substring from.
3623 : : * @param pos An index of the first character to copy from.
3624 : : * @param n A number of characters to copy.
3625 : : */
3626 : : entity (const std::basic_string<C>& s,
3627 : : std::size_t pos,
3628 : : std::size_t n = std::basic_string<C>::npos)
3629 : : : base_type (s, pos, n)
3630 : : {
3631 : : }
3632 : :
3633 : : public:
3634 : : /**
3635 : : * @brief Copy constructor.
3636 : : *
3637 : : * @param x An instance to make a copy of.
3638 : : * @param f Flags to create the copy with.
3639 : : * @param c A pointer to the object that will contain the copy.
3640 : : *
3641 : : * For polymorphic object models use the @c _clone function instead.
3642 : : */
3643 : : entity (const entity& x, flags f = 0, container* c = 0)
3644 : : : base_type (x, f, c)
3645 : : {
3646 : : }
3647 : :
3648 : : /**
3649 : : * @brief Copy the instance polymorphically.
3650 : : *
3651 : : * @param f Flags to create the copy with.
3652 : : * @param c A pointer to the object that will contain the copy.
3653 : : * @return A pointer to the dynamically allocated copy.
3654 : : *
3655 : : * This function ensures that the dynamic type of the instance
3656 : : * is used for copying and should be used for polymorphic object
3657 : : * models instead of the copy constructor.
3658 : : */
3659 : : virtual entity*
3660 : : _clone (flags f = 0, container* c = 0) const;
3661 : :
3662 : : public:
3663 : : /**
3664 : : * @brief Create an instance from a data representation
3665 : : * stream.
3666 : : *
3667 : : * @param s A stream to extract the data from.
3668 : : * @param f Flags to create the new instance with.
3669 : : * @param c A pointer to the object that will contain the new
3670 : : * instance.
3671 : : */
3672 : : template <typename S>
3673 : : entity (istream<S>& s, flags f = 0, container* c = 0);
3674 : :
3675 : : /**
3676 : : * @brief Create an instance from a DOM element.
3677 : : *
3678 : : * @param e A DOM element to extract the data from.
3679 : : * @param f Flags to create the new instance with.
3680 : : * @param c A pointer to the object that will contain the new
3681 : : * instance.
3682 : : */
3683 : : entity (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
3684 : :
3685 : : /**
3686 : : * @brief Create an instance from a DOM Attribute.
3687 : : *
3688 : : * @param a A DOM attribute to extract the data from.
3689 : : * @param f Flags to create the new instance with.
3690 : : * @param c A pointer to the object that will contain the new
3691 : : * instance.
3692 : : */
3693 : : entity (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
3694 : :
3695 : : /**
3696 : : * @brief Create an instance from a %string fragment.
3697 : : *
3698 : : * @param s A %string fragment to extract the data from.
3699 : : * @param e A pointer to DOM element containing the %string fragment.
3700 : : * @param f Flags to create the new instance with.
3701 : : * @param c A pointer to the object that will contain the new
3702 : : * instance.
3703 : : */
3704 : : entity (const std::basic_string<C>& s,
3705 : : const xercesc::DOMElement* e,
3706 : : flags f = 0,
3707 : : container* c = 0);
3708 : : //@}
3709 : :
3710 : : public:
3711 : : /**
3712 : : * @brief Assign a character to the instance.
3713 : : *
3714 : : * The resulting %entity has only one character.
3715 : : *
3716 : : * @param c A character to assign.
3717 : : * @return A reference to the instance.
3718 : : */
3719 : : entity&
3720 : : operator= (C c)
3721 : : {
3722 : : base () = c;
3723 : : return *this;
3724 : : }
3725 : :
3726 : : /**
3727 : : * @brief Assign a C %string to the instance.
3728 : : *
3729 : : * The resulting %entity contains a copy of the C %string.
3730 : : *
3731 : : * @param s A C %string to assign.
3732 : : * @return A reference to the instance.
3733 : : */
3734 : : entity&
3735 : : operator= (const C* s)
3736 : : {
3737 : : base () = s;
3738 : : return *this;
3739 : : }
3740 : :
3741 : : /**
3742 : : * @brief Assign a standard %string to the instance.
3743 : : *
3744 : : * The resulting %entity contains a copy of the standard %string.
3745 : : *
3746 : : * @param s A standard %string to assign.
3747 : : * @return A reference to the instance.
3748 : : */
3749 : : entity&
3750 : : operator= (const std::basic_string<C>& s)
3751 : : {
3752 : : base () = s;
3753 : : return *this;
3754 : : }
3755 : :
3756 : : /**
3757 : : * @brief Copy assignment operator.
3758 : : *
3759 : : * @param x An instance to assign.
3760 : : * @return A reference to the instance.
3761 : : */
3762 : : entity&
3763 : : operator= (const entity& x)
3764 : : {
3765 : : base () = x;
3766 : : return *this;
3767 : : }
3768 : :
3769 : : protected:
3770 : : //@cond
3771 : :
3772 : : entity ()
3773 : : : base_type ()
3774 : : {
3775 : : }
3776 : :
3777 : : //@endcond
3778 : : };
3779 : :
3780 : :
3781 : : /**
3782 : : * @brief Class corresponding to the XML Schema ENTITIES built-in
3783 : : * type.
3784 : : *
3785 : : * The %entities class is a vector (or %list in XML Schema terminology)
3786 : : * of entity elements. It is implemented in terms of the list class
3787 : : * template.
3788 : : *
3789 : : * @nosubgrouping
3790 : : */
3791 : : template <typename C, typename B, typename entity>
3792 : : class entities: public B, public list<entity, C>
3793 : : {
3794 : : typedef list<entity, C> base_type;
3795 : :
3796 : : public:
3797 : : /**
3798 : : * @name Constructors
3799 : : */
3800 : : //@{
3801 : :
3802 : : /**
3803 : : * @brief Default constructor creates no elements.
3804 : : */
3805 : : entities ()
3806 : : : base_type (this)
3807 : : {
3808 : : }
3809 : :
3810 : : /**
3811 : : * @brief Initialize the instance with copies of an exemplar elements.
3812 : : *
3813 : : * @param n A number of elements to copy.
3814 : : * @param x An exemplar element to copy.
3815 : : */
3816 : : entities (typename base_type::size_type n, const entity& x)
3817 : : : base_type (n, x, this)
3818 : : {
3819 : : }
3820 : :
3821 : : /**
3822 : : * @brief Initialize the instance with copies of elements from an
3823 : : * iterator range.
3824 : : *
3825 : : * @param begin An iterator pointing to the first element.
3826 : : * @param end An iterator pointing to the one past the last element.
3827 : : */
3828 : : template <typename I>
3829 : : entities (const I& begin, const I& end)
3830 : : : base_type (begin, end, this)
3831 : : {
3832 : : }
3833 : :
3834 : : public:
3835 : : /**
3836 : : * @brief Copy constructor.
3837 : : *
3838 : : * @param x An instance to make a copy of.
3839 : : * @param f Flags to create the copy with.
3840 : : * @param c A pointer to the object that will contain the copy.
3841 : : *
3842 : : * For polymorphic object models use the @c _clone function instead.
3843 : : */
3844 : : entities (const entities& x, flags f = 0, container* c = 0)
3845 : : : B (x, f, c), base_type (x, f, this)
3846 : : {
3847 : : }
3848 : :
3849 : : /**
3850 : : * @brief Copy the instance polymorphically.
3851 : : *
3852 : : * @param f Flags to create the copy with.
3853 : : * @param c A pointer to the object that will contain the copy.
3854 : : * @return A pointer to the dynamically allocated copy.
3855 : : *
3856 : : * This function ensures that the dynamic type of the instance
3857 : : * is used for copying and should be used for polymorphic object
3858 : : * models instead of the copy constructor.
3859 : : */
3860 : : virtual entities*
3861 : : _clone (flags f = 0, container* c = 0) const;
3862 : :
3863 : : public:
3864 : : /**
3865 : : * @brief Create an instance from a data representation
3866 : : * stream.
3867 : : *
3868 : : * @param s A stream to extract the data from.
3869 : : * @param f Flags to create the new instance with.
3870 : : * @param c A pointer to the object that will contain the new
3871 : : * instance.
3872 : : */
3873 : : template <typename S>
3874 : : entities (istream<S>& s, flags f = 0, container* c = 0);
3875 : :
3876 : : /**
3877 : : * @brief Create an instance from a DOM element.
3878 : : *
3879 : : * @param e A DOM element to extract the data from.
3880 : : * @param f Flags to create the new instance with.
3881 : : * @param c A pointer to the object that will contain the new
3882 : : * instance.
3883 : : */
3884 : : entities (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
3885 : :
3886 : : /**
3887 : : * @brief Create an instance from a DOM Attribute.
3888 : : *
3889 : : * @param a A DOM attribute to extract the data from.
3890 : : * @param f Flags to create the new instance with.
3891 : : * @param c A pointer to the object that will contain the new
3892 : : * instance.
3893 : : */
3894 : : entities (const xercesc::DOMAttr& a, flags f = 0, container* c = 0);
3895 : :
3896 : : /**
3897 : : * @brief Create an instance from a %string fragment.
3898 : : *
3899 : : * @param s A %string fragment to extract the data from.
3900 : : * @param e A pointer to DOM element containing the %string fragment.
3901 : : * @param f Flags to create the new instance with.
3902 : : * @param c A pointer to the object that will contain the new
3903 : : * instance.
3904 : : */
3905 : : entities (const std::basic_string<C>& s,
3906 : : const xercesc::DOMElement* e,
3907 : : flags f = 0,
3908 : : container* c = 0);
3909 : : //@}
3910 : : };
3911 : :
3912 : : /**
3913 : : * @brief %entities comparison operator.
3914 : : *
3915 : : * @return True if the lists of entities are equal, false otherwise.
3916 : : */
3917 : : template <typename C, typename B, typename entity>
3918 : : inline bool
3919 : : operator== (const entities<C, B, entity>& a,
3920 : : const entities<C, B, entity>& b)
3921 : : {
3922 : : return static_cast<const list<entity, C>&> (a) == b;
3923 : : }
3924 : :
3925 : : /**
3926 : : * @brief %entities comparison operator.
3927 : : *
3928 : : * @return True if the lists of entities are not equal, false otherwise.
3929 : : */
3930 : : template <typename C, typename B, typename entity>
3931 : : inline bool
3932 : : operator!= (const entities<C, B, entity>& a,
3933 : : const entities<C, B, entity>& b)
3934 : : {
3935 : : return !(a == b);
3936 : : }
3937 : : }
3938 : : }
3939 : : }
3940 : :
3941 : : #include <xsd/cxx/tree/types.txx>
3942 : :
3943 : : #endif // XSD_CXX_TREE_TYPES_HXX
|