Public Types | |
enum | Style { year = 0x1, short_year = 0x2, month = 0x4, day = 0x8, hour = 0x10, minute = 0x20, second = 0x40, millisec = 0x80, date = day | month | year, short_date = day | month | short_year, time = hour | minute | second, mstime = time | millisec, datetime = date | time, datemstime = date | mstime, short_datetime = short_date | time, short_datemstime = short_date | mstime } |
Data or time types. More... | |
Public Member Functions | |
CInt64DateFormat (unsigned long nStyle) | |
Constructor. | |
CInt64DateFormat (const CInt64DateFormat &) | |
Copy constructor. | |
~CInt64DateFormat () | |
Destructor. | |
virtual TString | FormatStl (int64 val, const CDataObject *pDO) const |
The function converts non-formatted value of __int64 type to the string which presents the formatted date. | |
virtual bool | ParseStl (const TString &, int64 &val, const CDataObject *pDO) const |
The function converts the string which presents the formatted date to the non-formatted value of __int64 type. | |
virtual CString | FormatMfc (int64 val, const CDataObject *pDO) const |
The function converts non-formatted value of __int64 type to the formatted MFC string. | |
virtual bool | ParseMfc (const CString &str, int64 &val, const CDataObject *pDO) const |
The function converts the formatted MFC string to the non-formatted __int64-type value. | |
virtual CFormat * | Clone () const |
Creates a deep copy of a format. | |
virtual bool | IsDate () const |
Indicates whether the format presents a date. | |
virtual unsigned long | GetStyle () const |
Gets the format style that is a combination of CInt64DateFormat::Style enum. | |
virtual void | Serialize (CSerializer &serializer) |
Serializes a format. | |
Static Public Member Functions | |
static int64 | Now () |
Gets the local time that equals the number of 100-nanosecond intervals since January 1, 1601. | |
static int64 | UtcNow () |
static int64 | FileTimeToInt64 (FILETIME ft) |
static FILETIME | Int64ToFileTime (int64 ft) |
static int | GetSerializeVertion () |
Serialization version. | |
static TString | FormatStl (int64 val, const CDataObject *pDO, unsigned long style, CPreferences::DateType dateType) |
A helper-function, which transforms unformatted value of __int64 type into the formatted string, depending on the format style and the date type. | |
static bool | ParseStl (const TString &text, int64 &val, const CDataObject *pDO, unsigned long style, CPreferences::DateType dateType) |
A helper-function, which parses the formatted string which presents a date to the value of __int64 type, depending on the format style and the date type. |
To get current time, use the static function CInt64DateFormat::Now()
Format examples: CPreferences::SetDateFormat(CPreferences::DayMonthYear); 1. CInt64DateFormat(CInt64DateFormat::date).FormatStl(CInt64DateFormat::Now(), 0); 2. CInt64DateFormat(CInt64DateFormat::short_date).FormatStl(CInt64DateFormat::Now(), 0); 3. CInt64DateFormat(CInt64DateFormat::time).FormatStl(CInt64DateFormat::Now(), 0); 4. CInt64DateFormat(CInt64DateFormat::short_datemstime).FormatStl(CInt64DateFormat::Now(), 0); CPreferences::SetDateFormat(CPreferences::MonthDayYear); 5. CInt64DateFormat(CInt64DateFormat::date).FormatStl(CInt64DateFormat::Now(), 0); 6. CInt64DateFormat(CInt64DateFormat::short_date).FormatStl(CInt64DateFormat::Now(), 0); 7. CInt64DateFormat(CInt64DateFormat::time).FormatStl(CInt64DateFormat::Now(), 0); 8. CInt64DateFormat(CInt64DateFormat::short_datemstime).FormatStl(CInt64DateFormat::Now(), 0); CPreferences::SetDateFormat(CPreferences::MonthDayYear); CPreferences::SetDateSeparator(_T("-")); 9. CInt64DateFormat(CInt64DateFormat::date).FormatStl(CInt64DateFormat::Now(), 0); 10. CInt64DateFormat(CInt64DateFormat::short_date).FormatStl(CInt64DateFormat::Now(), 0); 11. CInt64DateFormat(CInt64DateFormat::time).FormatStl(CInt64DateFormat::Now(), 0); 12. CInt64DateFormat(CInt64DateFormat::short_datemstime).FormatStl(CInt64DateFormat::Now(), 0); Output strings: 1. 16/06/2007 2. 16/06/07 3. 12:39:10 4. 16/06/07 12:39:10.875 5. 06/16/2007 6. 06/16/07 7. 12:39:10 8. 06/16/07 12:39:10.875 9. 2007-06-16 10. 07-06-16 11. 12:39:10 12. 07-06-16 12:39:10.875
enum Style |
Data or time types.
CInt64DateFormat | ( | unsigned long | dateType | ) |
CInt64DateFormat | ( | const CInt64DateFormat & | format | ) |
Copy constructor.
[in] | format | Format to be copied |
TString FormatStl | ( | int64 | val, | |
const CDataObject * | pDO | |||
) | const [virtual] |
The function converts non-formatted value of __int64 type to the string which presents the formatted date.
[in] | val | Value of __int64 type to be formatted. |
[in] | pDO | Pointer to CDataObject. This parameter is optional and may be zero. |
Reimplemented from CFormat.
bool ParseStl | ( | const TString & | str, | |
int64 & | val, | |||
const CDataObject * | pDO | |||
) | const [virtual] |
The function converts the string which presents the formatted date to the non-formatted value of __int64 type.
[in] | str | Formatted date. |
[in,out] | val | Value of __int64 type that accepts the result of conversion. |
[in] | pDO | Pointer to CDataObject. This parameter is optional and may be zero. |
Reimplemented from CFormat.
CString FormatMfc | ( | int64 | val, | |
const CDataObject * | pDO | |||
) | const [virtual] |
The function converts non-formatted value of __int64 type to the formatted MFC string.
[in] | val | Non-formatted MFC string to be formatted. |
[in] | pDO | Pointer to CDataObject. This parameter is optional and may be zero. |
Reimplemented from CFormat.
bool ParseMfc | ( | const CString & | str, | |
int64 & | val, | |||
const CDataObject * | pDO | |||
) | const [virtual] |
The function converts the formatted MFC string to the non-formatted __int64-type value.
[in] | str | MFC string to be formatted. |
[in,out] | val | A value of the __int64 type that is a result of the parsing. |
[in] | pDO | Pointer to CDataObject. This parameter is optional and may be zero. |
Reimplemented from CFormat.
CFormat * Clone | ( | ) | const [virtual] |
bool IsDate | ( | ) | const [virtual] |
unsigned long GetStyle | ( | ) | const [virtual] |
Gets the format style that is a combination of CInt64DateFormat::Style enum.
int64 Now | ( | ) | [static] |
Gets the local time that equals the number of 100-nanosecond intervals since January 1, 1601.
int64 UtcNow | ( | ) | [static] |
int64 FileTimeToInt64 | ( | FILETIME | ft | ) | [static] |
[in] | ft | Time, represented by the FILETIME structure |
FILETIME Int64ToFileTime | ( | int64 | ft | ) | [static] |
[in] | ft | Time, represented by the 64-bit value. It has the same format that the FILETIME structure. |
void Serialize | ( | CSerializer & | serializer | ) | [virtual] |
Serializes a format.
[in] | serializer | Object, into which a format object is serialized. |
Reimplemented from CFormat.
TString FormatStl | ( | int64 | val, | |
const CDataObject * | pDO, | |||
unsigned long | style, | |||
CPreferences::DateType | dateType | |||
) | [static] |
A helper-function, which transforms unformatted value of __int64 type into the formatted string, depending on the format style and the date type.
[in] | val | Unformatted value |
[in] | pDO | Pointer to the data object |
[in] | style | Format style. Combination of CInt64DateFormat::Style enumeration |
[in] | dateType | Date type. |
bool ParseStl | ( | const TString & | str, | |
int64 & | val, | |||
const CDataObject * | pDO, | |||
unsigned long | style, | |||
CPreferences::DateType | dateType | |||
) | [static] |
A helper-function, which parses the formatted string which presents a date to the value of __int64 type, depending on the format style and the date type.
[in] | str | Date string |
[in,out] | val | Value to be filled. |
[in] | pDO | Pointer to the data object |
[in] | style | Format style. Combination of CInt64DateFormat::Style enumeration |
[in] | dateType | Date type. |
Copyright Dapfor 2007-2009 | Generated on Wed Jul 7 03:24:43 2010 for MFCGrid by 1.5.5 |