1 // file      : xsd/cxx/tree/date-time-extraction.txx
2 // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
3 // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 
5 namespace xsd
6 {
7   namespace cxx
8   {
9     namespace tree
10     {
11       // time_zone
12       //
13       template <typename S>
14       inline void time_zone::
zone_extract(istream<S> & s)15       zone_extract (istream<S>& s)
16       {
17         s >> hours_ >> minutes_;
18         present_ = true;
19       }
20 
21       // gday
22       //
23       template <typename C, typename B>
24       template <typename S>
25       gday<C, B>::
gday(istream<S> & s,flags f,container * c)26       gday (istream<S>& s, flags f, container* c)
27           : B (s, f, c)
28       {
29         bool zp;
30         s >> day_ >> zp;
31 
32         if (zp)
33           zone_extract (s);
34       }
35 
36       // gmonth
37       //
38       template <typename C, typename B>
39       template <typename S>
40       gmonth<C, B>::
gmonth(istream<S> & s,flags f,container * c)41       gmonth (istream<S>& s, flags f, container* c)
42           : B (s, f, c)
43       {
44         bool zp;
45         s >> month_ >> zp;
46 
47         if (zp)
48           zone_extract (s);
49       }
50 
51       // gyear
52       //
53       template <typename C, typename B>
54       template <typename S>
55       gyear<C, B>::
gyear(istream<S> & s,flags f,container * c)56       gyear (istream<S>& s, flags f, container* c)
57           : B (s, f, c)
58       {
59         bool zp;
60         s >> year_ >> zp;
61 
62         if (zp)
63           zone_extract (s);
64       }
65 
66       // gmonth_day
67       //
68       template <typename C, typename B>
69       template <typename S>
70       gmonth_day<C, B>::
gmonth_day(istream<S> & s,flags f,container * c)71       gmonth_day (istream<S>& s, flags f, container* c)
72           : B (s, f, c)
73       {
74         bool zp;
75         s >> month_ >> day_ >> zp;
76 
77         if (zp)
78           zone_extract (s);
79       }
80 
81       // gyear_month
82       //
83       template <typename C, typename B>
84       template <typename S>
85       gyear_month<C, B>::
gyear_month(istream<S> & s,flags f,container * c)86       gyear_month (istream<S>& s, flags f, container* c)
87           : B (s, f, c)
88       {
89         bool zp;
90         s >> year_ >> month_ >> zp;
91 
92         if (zp)
93           zone_extract (s);
94       }
95 
96       // date
97       //
98       template <typename C, typename B>
99       template <typename S>
100       date<C, B>::
date(istream<S> & s,flags f,container * c)101       date (istream<S>& s, flags f, container* c)
102           : B (s, f, c)
103       {
104         bool zp;
105         s >> year_ >> month_ >> day_ >> zp;
106 
107         if (zp)
108           zone_extract (s);
109       }
110 
111       // time
112       //
113       template <typename C, typename B>
114       template <typename S>
115       time<C, B>::
time(istream<S> & s,flags f,container * c)116       time (istream<S>& s, flags f, container* c)
117           : B (s, f, c)
118       {
119         bool zp;
120         s >> hours_ >> minutes_ >> seconds_ >> zp;
121 
122         if (zp)
123           zone_extract (s);
124       }
125 
126       // date_time
127       //
128       template <typename C, typename B>
129       template <typename S>
130       date_time<C, B>::
date_time(istream<S> & s,flags f,container * c)131       date_time (istream<S>& s, flags f, container* c)
132           : B (s, f, c)
133       {
134         bool zp;
135         s >> year_ >> month_ >> day_
136           >> hours_ >> minutes_ >> seconds_ >> zp;
137 
138         if (zp)
139           zone_extract (s);
140       }
141 
142       // duration
143       //
144       template <typename C, typename B>
145       template <typename S>
146       duration<C, B>::
duration(istream<S> & s,flags f,container * c)147       duration (istream<S>& s, flags f, container* c)
148           : B (s, f, c)
149       {
150         s >> negative_
151           >> years_ >> months_ >> days_
152           >> hours_ >> minutes_ >> seconds_;
153       }
154     }
155   }
156 }
157