@ -5,7 +5,7 @@
*/
/*
* Copyright ( c ) 2012 , Tomasz Sowa
* Copyright ( c ) 2012 - 2018 , Tomasz Sowa
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
@ -288,6 +288,14 @@ public:
void Serialize ( Stream & out ) const ;
/*
this method outputs to the given stream : YYYY - MM - DDTHH : MM : SSZ , eg : 1990 - 02 - 12 T13 : 05 : 39 Z
ISO 8601 format
*/
template < class Stream >
void SerializeISO ( Stream & out ) const ;
/*
parsing day month and year
the input string can be as follows :
@ -567,6 +575,14 @@ void Date::Serialize(Stream & out) const
SerializeHourMinSec ( out ) ;
}
template < class Stream >
void Date : : SerializeISO ( Stream & out ) const
{
SerializeYearMonthDay ( out ) ;
out < < ' T ' ;
SerializeHourMinSec ( out ) ;
out < < ' Z ' ;
}
template < class CStringType >
@ -771,8 +787,20 @@ const CStringType * after;
bool result = false ;
if ( ParseYearMonthDay ( str , & after ) )
{
SkipWhite ( after ) ;
if ( * after = = ' T ' )
{
// ISO 8601 format
// https://en.wikipedia.org/wiki/ISO_8601
// at the moment skip the 'T' character only
after + = 1 ;
}
if ( ParseHourMinSec ( after , & after ) )
result = true ;
}
SetAfter ( after , str_after ) ;