1 // file : XMLSchema/Writer.hpp
2 // author : Boris Kolpackov <boris@dre.vanderbilt.edu>
3 #ifndef XMLSCHEMA_WRITER_HPP
4 #define XMLSCHEMA_WRITER_HPP
8 #include <ace/XML_Utils/XSCRT/Writer.hpp>
10 #include <ace/XML_Utils/XMLSchema/Types.hpp>
11 #include <ace/XML_Utils/XMLSchema/Traversal.hpp>
19 template <typename T
, typename C
>
20 struct FundamentalType
: Traversal::Traverser
<T
>,
21 virtual XSCRT::Writer
<C
>
23 FundamentalType (XSCRT::XML::Element
<C
>& e
)
24 : XSCRT::Writer
<C
> (e
)
28 using XSCRT::Writer
<C
>::top_
;
29 using XSCRT::Writer
<C
>::attr_
;
34 using namespace XSCRT::XML
;
36 std::basic_ostringstream
<C
> os
;
40 if (Attribute
<C
>* a
= attr_ ())
46 top_().value (os
.str ());
54 Traversal::Traverser
<T
>::traverse (t
);
57 FundamentalType () = default;
61 struct FundamentalType
<XSCRT::FundamentalType
<bool>, C
> :
62 Traversal::Traverser
<XSCRT::FundamentalType
<bool> >,
63 virtual XSCRT::Writer
<C
>
65 FundamentalType (XSCRT::XML::Element
<C
> &e
)
66 : XSCRT::Writer
<C
> (e
)
70 using XSCRT::Writer
<C
>::top_
;
71 using XSCRT::Writer
<C
>::attr_
;
74 traverse (XSCRT::FundamentalType
<bool> const &o
)
76 using namespace XSCRT::XML
;
78 std::basic_ostringstream
<C
> os
;
89 if (Attribute
<C
>* a
= attr_ ())
95 top_().value (os
.str ());
101 traverse (XSCRT::FundamentalType
<bool> &t
)
103 Traversal::Traverser
<XSCRT::FundamentalType
<bool> >::traverse (t
);
106 FundamentalType () = default;
110 template <typename C
>
111 struct IDREF
: Traversal::Traverser
<XMLSchema::IDREF
<C
> >,
112 virtual XSCRT::Writer
<C
>
114 IDREF (XSCRT::XML::Element
<C
>& e
)
115 : XSCRT::Writer
<C
> (e
)
121 typename
Traversal::Traverser
<XMLSchema::IDREF
<C
> >::Type
const& o
)
123 using namespace XSCRT::XML
;
125 if (Attribute
<C
>* a
= XSCRT::Writer
<C
>::attr_ ())
131 XSCRT::Writer
<C
>::top_().value (o
.id ());
138 traverse (typename
Traversal::Traverser
<XMLSchema::IDREF
<C
> >::Type
&o
)
140 Traversal::Traverser
<XMLSchema::IDREF
<C
> >::traverse (o
);
148 #endif // XMLSCHEMA_WRITER_HPP