root/win32/xsd-3.1.0-i686/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx @ 111

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

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

Line 
1// file      : xsd/cxx/tree/parsing/unsigned-long.hxx
2// author    : Boris Kolpackov <boris@codesynthesis.com>
3// copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC
4// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
5
6#ifndef XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX
7#define XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX
8
9#include <xsd/cxx/ro-string.hxx>
10#include <xsd/cxx/zc-istream.hxx>
11
12#include <xsd/cxx/xml/string.hxx> // xml::transcode
13
14#include <xsd/cxx/tree/text.hxx>  // text_content
15
16namespace xsd
17{
18  namespace cxx
19  {
20    namespace tree
21    {
22      template <typename C>
23      struct traits<unsigned long long, C>
24      {
25        typedef unsigned long long type;
26
27        static type
28        create (const xercesc::DOMElement& e, flags f, container* c);
29
30        static type
31        create (const xercesc::DOMAttr& a, flags f, container* c);
32
33        static type
34        create (const std::basic_string<C>& s,
35                const xercesc::DOMElement*,
36                flags,
37                container*);
38      };
39
40      template <typename C>
41      unsigned long long traits<unsigned long long, C>::
42      create (const xercesc::DOMElement& e, flags f, container* c)
43      {
44        return create (text_content<C> (e), 0, f, c);
45      }
46
47      template <typename C>
48      unsigned long long traits<unsigned long long, C>::
49      create (const xercesc::DOMAttr& a, flags f, container* c)
50      {
51        return create (xml::transcode<C> (a.getValue ()), 0, f, c);
52      }
53
54      template <typename C>
55      unsigned long long traits<unsigned long long, C>::
56      create (const std::basic_string<C>& s,
57              const xercesc::DOMElement*,
58              flags,
59              container*)
60      {
61        // This type cannot have whitespaces in its values. As result we
62        // don't need to waste time collapsing whitespaces. All we need to
63        // do is trim the string representation which can be done without
64        // copying.
65        //
66        ro_string<C> tmp (s);
67        trim (tmp);
68
69        zc_istream<C> is (tmp);
70
71        type t;
72        is >> t;
73
74        return t;
75      }
76    }
77  }
78}
79
80#endif // XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX
Note: See TracBrowser for help on using the browser.