added:
Date(const char * str); Date(const wchar_t * str); Date(const std::string & str); Date(const std::wstring & str); Date & operator=(const char * str); Date & operator=(const wchar_t * str); Date & operator=(const std::string & str); Date & operator=(const std::wstring & str); void Swap(Date&); removed: templates cctors and operators= it is better to have directly char*, wchar_t and string, wstring git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@414 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -62,12 +62,44 @@ Date::Date(time_t t)
|
||||
FromTime(t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Date::Date(const tm & t)
|
||||
{
|
||||
FromTm(t);
|
||||
}
|
||||
|
||||
|
||||
Date::Date(const char * str)
|
||||
{
|
||||
// parsing can be break in the middle of the string (if errors)
|
||||
// and some values would not be initialized
|
||||
Clear();
|
||||
Parse(str);
|
||||
}
|
||||
|
||||
|
||||
Date::Date(const wchar_t * str)
|
||||
{
|
||||
Clear();
|
||||
Parse(str);
|
||||
}
|
||||
|
||||
|
||||
Date::Date(const std::string & str)
|
||||
{
|
||||
Clear();
|
||||
Parse(str);
|
||||
}
|
||||
|
||||
|
||||
Date::Date(const std::wstring & str)
|
||||
{
|
||||
Clear();
|
||||
Parse(str);
|
||||
}
|
||||
|
||||
|
||||
Date & Date::operator=(const Date & d)
|
||||
{
|
||||
year = d.year;
|
||||
@@ -89,6 +121,8 @@ return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Date & Date::operator=(const tm & t)
|
||||
{
|
||||
FromTm(t);
|
||||
@@ -97,6 +131,41 @@ return *this;
|
||||
}
|
||||
|
||||
|
||||
Date & Date::operator=(const char * str)
|
||||
{
|
||||
Parse(str);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Date & Date::operator=(const wchar_t * str)
|
||||
{
|
||||
Parse(str);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Date & Date::operator=(const std::string & str)
|
||||
{
|
||||
Parse(str);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Date & Date::operator=(const std::wstring & str)
|
||||
{
|
||||
Parse(str);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Date Date::operator+(time_t t) const
|
||||
{
|
||||
time_t t0 = ToTime();
|
||||
@@ -133,6 +202,15 @@ return *this;
|
||||
}
|
||||
|
||||
|
||||
void Date::Swap(Date & date)
|
||||
{
|
||||
Date temp(*this);
|
||||
|
||||
*this = date;
|
||||
date = temp;
|
||||
}
|
||||
|
||||
|
||||
time_t Date::operator-(const Date & d) const
|
||||
{
|
||||
time_t t0 = ToTime();
|
||||
|
Reference in New Issue
Block a user