summaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/xml/dom/serialization-header.hxx
blob: a3cbff4f3946497c5bf9b4087a39ed409be85bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// file      : xsd/cxx/xml/dom/serialization-header.hxx
// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSD_CXX_XML_DOM_SERIALIZATION_HEADER_HXX
#define XSD_CXX_XML_DOM_SERIALIZATION_HEADER_HXX

#include <map>
#include <string>

#include <xercesc/dom/DOMElement.hpp>

namespace xsd
{
  namespace cxx
  {
    namespace xml
    {
      namespace dom
      {
        // Find an existing prefix or establish a new one. Try to use
        // hint if provided and available.
        //
        template <typename C>
        std::basic_string<C>
        prefix (const C* ns, xercesc::DOMElement&, const C* hint = 0);

        template <typename C>
        inline std::basic_string<C>
        prefix (const std::basic_string<C>& ns,
                xercesc::DOMElement& e,
                const C* hint = 0)
        {
          return prefix (ns.c_str (), e, hint);
        }

        //
        //
        template <typename C>
        void
        clear (xercesc::DOMElement&);

        //
        //
        template <typename C>
        class namespace_info
        {
	public:
          typedef std::basic_string<C> string;

          namespace_info ()
          {
          }

          namespace_info (const string& name_, const string& schema_)
              : name (name_),
                schema (schema_)
          {
          }

          std::basic_string<C> name;
          std::basic_string<C> schema;
        };


        // Map of namespace prefix to namespace_info.
        //
        template <typename C>
        class namespace_infomap:
          public std::map<std::basic_string<C>, namespace_info<C> >
        {
        };
      }
    }
  }
}

#include <xsd/cxx/xml/dom/serialization-header.txx>

#endif  // XSD_CXX_XML_DOM_SERIALIZATION_HEADER_HXX