root/win32/xsd-3.1.0-i686/libxsd/xsd/cxx/tree/date-time-insertion.txx @ 124

Revision 111, 3.7 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/date-time-insertion.txx
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
6namespace xsd
7{
8  namespace cxx
9  {
10    namespace tree
11    {
12      // time_zone
13      //
14      template <typename S>
15      inline ostream<S>&
16      operator<< (ostream<S>& s, const time_zone& z)
17      {
18        return s << z.zone_hours () << z.zone_minutes ();
19      }
20
21      // gday
22      //
23      template <typename S, typename C, typename B>
24      ostream<S>&
25      operator<< (ostream<S>& s, const gday<C, B>& x)
26      {
27        bool zp (x.zone_present ());
28
29        s << x.day () << zp;
30
31        if (zp)
32        {
33          const time_zone& z (x);
34          s << z;
35        }
36
37        return s;
38      }
39
40      // gmonth
41      //
42      template <typename S, typename C, typename B>
43      ostream<S>&
44      operator<< (ostream<S>& s, const gmonth<C, B>& x)
45      {
46        bool zp (x.zone_present ());
47
48        s << x.month () << zp;
49
50        if (zp)
51        {
52          const time_zone& z (x);
53          s << z;
54        }
55
56        return s;
57      }
58
59      // gyear
60      //
61      template <typename S, typename C, typename B>
62      ostream<S>&
63      operator<< (ostream<S>& s, const gyear<C, B>& x)
64      {
65        bool zp (x.zone_present ());
66
67        s << x.year () << zp;
68
69        if (zp)
70        {
71          const time_zone& z (x);
72          s << z;
73        }
74
75        return s;
76      }
77
78      // gmonth_day
79      //
80      template <typename S, typename C, typename B>
81      ostream<S>&
82      operator<< (ostream<S>& s, const gmonth_day<C, B>& x)
83      {
84        bool zp (x.zone_present ());
85
86        s << x.month () << x.day () << zp;
87
88        if (zp)
89        {
90          const time_zone& z (x);
91          s << z;
92        }
93
94        return s;
95      }
96
97      // gyear_month
98      //
99      template <typename S, typename C, typename B>
100      ostream<S>&
101      operator<< (ostream<S>& s, const gyear_month<C, B>& x)
102      {
103        bool zp (x.zone_present ());
104
105        s << x.year () << x.month () << zp;
106
107        if (zp)
108        {
109          const time_zone& z (x);
110          s << z;
111        }
112
113        return s;
114      }
115
116      // date
117      //
118      template <typename S, typename C, typename B>
119      ostream<S>&
120      operator<< (ostream<S>& s, const date<C, B>& x)
121      {
122        bool zp (x.zone_present ());
123
124        s << x.year () << x.month () << x.day () << zp;
125
126        if (zp)
127        {
128          const time_zone& z (x);
129          s << z;
130        }
131
132        return s;
133      }
134
135      // time
136      //
137      template <typename S, typename C, typename B>
138      ostream<S>&
139      operator<< (ostream<S>& s, const time<C, B>& x)
140      {
141        bool zp (x.zone_present ());
142
143        s << x.hours () << x.minutes () << x.seconds () << zp;
144
145        if (zp)
146        {
147          const time_zone& z (x);
148          s << z;
149        }
150
151        return s;
152      }
153
154      // date_time
155      //
156      template <typename S, typename C, typename B>
157      ostream<S>&
158      operator<< (ostream<S>& s, const date_time<C, B>& x)
159      {
160        bool zp (x.zone_present ());
161
162        s << x.year () << x.month () << x.day ()
163          << x.hours () << x.minutes () << x.seconds () << zp;
164
165        if (zp)
166        {
167          const time_zone& z (x);
168          s << z;
169        }
170
171        return s;
172      }
173
174      // duration
175      //
176      template <typename S, typename C, typename B>
177      ostream<S>&
178      operator<< (ostream<S>& s, const duration<C, B>& x)
179      {
180        s << x.negative ()
181          << x.years () << x.months () << x.days ()
182          << x.hours () << x.minutes () << x.seconds ();
183
184        return s;
185      }
186    }
187  }
188}
Note: See TracBrowser for help on using the browser.