added: to Date:

bool ParseMonthDayTime(const CStringType * str, const CStringType ** str_after = 0);
       parsing: MM:DD HH[:MM[:SS]]



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@416 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-05-30 21:48:44 +00:00
parent e775728f6b
commit d77db196ee
1 changed files with 48 additions and 1 deletions

View File

@ -407,7 +407,7 @@ public:
this method doesn't test if the values are correct
use IsCorrectDate() to check
*/
*/
template<class CStringType>
bool ParseTime(const CStringType * str, const CStringType ** str_after = 0);
@ -415,6 +415,28 @@ public:
bool ParseTime(const StringType & str);
/*
parsing month, day, hour and minutes (if exists) and seconds (if exists)
the input string can be as follows:
"10-23 14" -- only month, day and hour given (min and sec will be zero)
"10-23 14:10" -- month, day and hour with minutes (sec will be zero)
"10-23 14:10:35" -- month, day, hour, minutes and seconds
white characters are ommited so these are valid strings too:
" 10 - 23 14 : 10 : 35 "
" 10 - 23 14 : 10 : 35some text "
a white character means a space or a tab
this method doesn't test if the values are correct
use IsCorrectDate() to check
*/
template<class CStringType>
bool ParseMonthDayTime(const CStringType * str, const CStringType ** str_after = 0);
template<class StringType>
bool ParseMonthDayTime(const StringType & str);
/*
parsing year/month/day hour:min:sec
the input strings can be as follows:
@ -685,6 +707,31 @@ bool Date::ParseTime(const StringType & str)
template<class CStringType>
bool Date::ParseMonthDayTime(const CStringType * str, const CStringType ** str_after)
{
const CStringType * after;
bool result = false;
if( ParseMonthDay(str, &after) )
if( ParseTime(after, &after) )
result = true;
SetAfter(after, str_after);
return result;
}
template<class StringType>
bool Date::ParseMonthDayTime(const StringType & str)
{
return ParseMonthDayTime(str.c_str());
}
template<class CStringType>
bool Date::Parse(const CStringType * str, const CStringType ** str_after)
{