root/win32/xsd-3.1.0-i686/libxsd/xsd/cxx/tree/serialization/boolean.hxx @ 111

Revision 111, 1.2 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/serialization/boolean.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_SERIALIZATION_BOOLEAN_HXX
7#define XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX
8
9#include <sstream>
10
11namespace XERCES_CPP_NAMESPACE
12{
13  inline void
14  operator<< (xercesc::DOMElement& e, bool b)
15  {
16    std::basic_ostringstream<char> os;
17    os.setf (std::ios_base::boolalpha);
18    os << b;
19    e << os.str ();
20  }
21
22  inline void
23  operator<< (xercesc::DOMAttr& a, bool b)
24  {
25    std::basic_ostringstream<char> os;
26    os.setf (std::ios_base::boolalpha);
27    os << b;
28    a << os.str ();
29  }
30}
31
32namespace xsd
33{
34  namespace cxx
35  {
36    namespace tree
37    {
38      template <typename C>
39      inline void
40      operator<< (list_stream<C>& ls, bool b)
41      {
42        // We don't need to restore the original bool format flag
43        // since items in the list are all of the same type.
44        //
45        ls.os_.setf (std::ios_base::boolalpha);
46        ls.os_ << b;
47      }
48    }
49  }
50}
51
52#endif // XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX
Note: See TracBrowser for help on using the browser.