From 638c2b35c3aa49e568d8f1c243eb577d7da0c2cd Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 16 Oct 2015 07:53:11 -0400 Subject: [PATCH] ISO8601: Added ::dump methods for debugging --- src/ISO8601.cpp | 34 +++++++++++++++++++++++++++++++++- src/ISO8601.h | 2 ++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index 2e4707763..e7d30875d 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -1615,8 +1615,24 @@ void ISO8601d::operator++ (int) _date = tomorrow._date; } +//////////////////////////////////////////////////////////////////////////////// +std::string ISO8601d::dump () const +{ + std::stringstream s; + s << "ISO8601d" + << " _year=" << _year + << " _month=" << _month + << " _week=" << _week + << " _weekday=" << _weekday + << " _julian=" << _julian + << " _day=" << _day + << " _seconds=" << _seconds + << " _offset=" << _offset + << " _utc=" << _utc + << " _date=" << _date; - + return s.str (); +} //////////////////////////////////////////////////////////////////////////////// ISO8601p::ISO8601p () @@ -1968,3 +1984,19 @@ void ISO8601p::resolve () } //////////////////////////////////////////////////////////////////////////////// +std::string ISO8601p::dump () const +{ + std::stringstream s; + s << "ISO8601p" + << " _year=" << _year + << " _month=" << _month + << " _day=" << _day + << " _hours=" << _hours + << " _minutes=" << _minutes + << " _seconds=" << _seconds + << " _period=" << _period; + + return s.str (); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/ISO8601.h b/src/ISO8601.h index b336ccb15..6af7f96f6 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -121,6 +121,7 @@ private: bool parse_time_off_ext (Nibbler&); bool validate (); void resolve (); + std::string dump () const; public: int _year; @@ -160,6 +161,7 @@ private: bool parse_designated (Nibbler&); bool validate (); void resolve (); + std::string dump () const; public: int _year;