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