ISO8601: Removed the need for ::ambiguity
This commit is contained in:
@@ -45,15 +45,6 @@ ISO8601d::operator time_t () const
|
|||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// By default, ISO8601d allows ambiguous dates, such as YYYY, YYYYMMDD, HHMMSS.
|
|
||||||
// These are also valid numbers. Setting ambiguity to false inhibits the
|
|
||||||
// parsing of these as dates.
|
|
||||||
void ISO8601d::ambiguity (bool value)
|
|
||||||
{
|
|
||||||
_ambiguity = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Supported:
|
// Supported:
|
||||||
//
|
//
|
||||||
@@ -125,7 +116,6 @@ bool ISO8601d::parse (const std::string& input, std::string::size_type& start)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ISO8601d::clear ()
|
void ISO8601d::clear ()
|
||||||
{
|
{
|
||||||
_ambiguity = true;
|
|
||||||
_year = 0;
|
_year = 0;
|
||||||
_month = 0;
|
_month = 0;
|
||||||
_week = 0;
|
_week = 0;
|
||||||
@@ -279,15 +269,14 @@ bool ISO8601d::parse_time_ext (Nibbler& n)
|
|||||||
{
|
{
|
||||||
seconds += ss;
|
seconds += ss;
|
||||||
_seconds = seconds;
|
_seconds = seconds;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_ambiguity)
|
|
||||||
{
|
|
||||||
_seconds = seconds;
|
|
||||||
if (!Lexer::isDigit (n.next ()))
|
if (!Lexer::isDigit (n.next ()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_seconds = seconds;
|
||||||
|
if (!Lexer::isDigit (n.next ()))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = backup;
|
n = backup;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public:
|
|||||||
ISO8601d (const ISO8601d&); // Unimplemented
|
ISO8601d (const ISO8601d&); // Unimplemented
|
||||||
ISO8601d& operator= (const ISO8601d&); // Unimplemented
|
ISO8601d& operator= (const ISO8601d&); // Unimplemented
|
||||||
operator time_t () const;
|
operator time_t () const;
|
||||||
void ambiguity (bool);
|
|
||||||
bool parse (const std::string&, std::string::size_type&);
|
bool parse (const std::string&, std::string::size_type&);
|
||||||
void clear ();
|
void clear ();
|
||||||
void set_default_time (int, int, int);
|
void set_default_time (int, int, int);
|
||||||
@@ -55,7 +54,6 @@ private:
|
|||||||
void resolve ();
|
void resolve ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool _ambiguity;
|
|
||||||
int _year;
|
int _year;
|
||||||
int _month;
|
int _month;
|
||||||
int _week;
|
int _week;
|
||||||
|
|||||||
Reference in New Issue
Block a user