From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/tree/date-time-insertion.txx | 188 ++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 libxsd/xsd/cxx/tree/date-time-insertion.txx (limited to 'libxsd/xsd/cxx/tree/date-time-insertion.txx') diff --git a/libxsd/xsd/cxx/tree/date-time-insertion.txx b/libxsd/xsd/cxx/tree/date-time-insertion.txx new file mode 100644 index 0000000..bd3cd3d --- /dev/null +++ b/libxsd/xsd/cxx/tree/date-time-insertion.txx @@ -0,0 +1,188 @@ +// file : xsd/cxx/tree/date-time-insertion.txx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // time_zone + // + template + inline ostream& + operator<< (ostream& s, const time_zone& z) + { + return s << z.zone_hours () << z.zone_minutes (); + } + + // gday + // + template + ostream& + operator<< (ostream& s, const gday& x) + { + bool zp (x.zone_present ()); + + s << x.day () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // gmonth + // + template + ostream& + operator<< (ostream& s, const gmonth& x) + { + bool zp (x.zone_present ()); + + s << x.month () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // gyear + // + template + ostream& + operator<< (ostream& s, const gyear& x) + { + bool zp (x.zone_present ()); + + s << x.year () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // gmonth_day + // + template + ostream& + operator<< (ostream& s, const gmonth_day& x) + { + bool zp (x.zone_present ()); + + s << x.month () << x.day () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // gyear_month + // + template + ostream& + operator<< (ostream& s, const gyear_month& x) + { + bool zp (x.zone_present ()); + + s << x.year () << x.month () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // date + // + template + ostream& + operator<< (ostream& s, const date& x) + { + bool zp (x.zone_present ()); + + s << x.year () << x.month () << x.day () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // time + // + template + ostream& + operator<< (ostream& s, const time& x) + { + bool zp (x.zone_present ()); + + s << x.hours () << x.minutes () << x.seconds () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // date_time + // + template + ostream& + operator<< (ostream& s, const date_time& x) + { + bool zp (x.zone_present ()); + + s << x.year () << x.month () << x.day () + << x.hours () << x.minutes () << x.seconds () << zp; + + if (zp) + { + const time_zone& z (x); + s << z; + } + + return s; + } + + // duration + // + template + ostream& + operator<< (ostream& s, const duration& x) + { + s << x.negative () + << x.years () << x.months () << x.days () + << x.hours () << x.minutes () << x.seconds (); + + return s; + } + } + } +} -- cgit v1.1