MFC Grid manual

CLongMsecTimeFormat Class Reference

Format for long-type values representing time in milliseconds. More...

#include <Dapfor/Common/LongMsecTimeFormat.h>

Inheritance diagram for CLongMsecTimeFormat:

CFormat

List of all members.


Public Types

enum  Style {
  day = 0x01, hour = 0x02, minute = 0x04, second = 0x08,
  millisec = 0x10, time = hour | minute | second, day_time = day | time, mstime = time | millisec,
  day_mstime = day | mstime
}
 Format styles. More...

Public Member Functions

 CLongMsecTimeFormat (unsigned long style, bool showNonSignificative=false, const TString &timeSuffix=_T(""), const TString &daySuffix=_T(""))
 Constructor.
 ~CLongMsecTimeFormat ()
 Virtual destructor.
virtual TString FormatStl (long val, const CDataObject *pDO) const
 The function converts non-formatted value of long type to the formatted string.
virtual bool ParseStl (const TString &str, long &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of long type.
virtual CString FormatMfc (long val, const CDataObject *pDO) const
 The function converts non-formatted value of long type to the formatted MFC string.
virtual bool ParseMfc (const CString &str, long &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted long-type value.
virtual CFormatClone () 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 a style of a format.
virtual void Serialize (CSerializer &serializer)
 Serializes a format.

Static Public Member Functions

static int GetSerializeVertion ()
 Serialization version.

Detailed Description

Format for long-type values representing time in milliseconds.

The time is stored as long value. Therefore for signed values, the format will wrap interval around -24,86 .. 24.86 days and for unsigned values around to zero for 49.7 days.

 Format examples:

 1. CLongMsecTimeFormat(CLongMsecTimeFormat::time).FormatStl(1234567, 0);
 2. CLongMsecTimeFormat(CLongMsecTimeFormat::day_time).FormatStl(1234567, 0);
 3. CLongMsecTimeFormat(CLongMsecTimeFormat::mstime).FormatStl(1234567, 0);
 4. CLongMsecTimeFormat(CLongMsecTimeFormat::day_mstime).FormatStl(1234567890, 0);

 5. CLongMsecTimeFormat(CLongMsecTimeFormat::time, true).FormatStl(1234567, 0);
 6. CLongMsecTimeFormat(CLongMsecTimeFormat::day_time, true).FormatStl(1234567, 0);
 7. CLongMsecTimeFormat(CLongMsecTimeFormat::mstime, true).FormatStl(1234567, 0);
 8. CLongMsecTimeFormat(CLongMsecTimeFormat::day_mstime, true).FormatStl(1234567890, 0);


 Output strings:
 1. 20:34
 2. 20:34
 3. 20:34.567
 4. 14 6:56:07.890

 5. 00:20:34
 6. 0 00:20:34
 7. 00:20:34.567
 8. 14 06:56:07.890

Member Enumeration Documentation

enum Style

Format styles.

Enumerator:
day  dd 1..31
hour  hh 0..23
minute  mm 0..59
second  ss 0..59
millisec  xxx 0..999
time  hh:mm:ss
day_time  dd hh:mm:ss
mstime  hh:mm:ss.xxx
day_mstime  dd hh:mm:ss.xxx


Constructor & Destructor Documentation

CLongMsecTimeFormat ( unsigned long  style,
bool  showNonSignificative = false,
const TString &  timeSuffix = _T(""),
const TString &  daySuffix = _T("") 
)

Constructor.

Parameters:
[in] style Combination of CLongMsecTimeFormat::Style enumeration.
[in] showNonSignificative Indicates whether it should show non-significant zeros
[in] timeSuffix Suffix following time.
[in] daySuffix Suffix following days.


Member Function Documentation

TString FormatStl ( long  val,
const CDataObject pDO 
) const [virtual]

The function converts non-formatted value of long type to the formatted string.

Parameters:
[in] val Non formatted value of long type.
[in] pDO Pointer to CDataObject. This parameter is optional and may be zero.
Returns:
Formatted string that is a result of conversion.

Reimplemented from CFormat.

bool ParseStl ( const TString &  str,
long &  val,
const CDataObject pDO 
) const [virtual]

The function converts the formatted string to the non-formatted value of long type.

Parameters:
[in] str Formatted string.
[in,out] val Value of long type that is a result of conversion.
[in] pDO Pointer to CDataObject. This parameter is optional and may be zero.
Returns:
True, if the string has been successfully parsed. Otherwise false.

Reimplemented from CFormat.

CString FormatMfc ( long  val,
const CDataObject pDO 
) const [virtual]

The function converts non-formatted value of long type to the formatted MFC string.

Parameters:
[in] val Non-formatted MFC string to be formatted.
[in] pDO Pointer to CDataObject. This parameter is optional and may be zero.
Returns:
Formatted string that is a result of conversion.

Reimplemented from CFormat.

bool ParseMfc ( const CString &  str,
long &  val,
const CDataObject pDO 
) const [virtual]

The function converts the formatted MFC string to the non-formatted long-type value.

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the long type that is a result of the parsing.
[in] pDO Pointer to CDataObject. This parameter is optional and may be zero.
Returns:
True, if the string has been successfully parsed. Otherwise false.

Reimplemented from CFormat.

CFormat * Clone (  )  const [virtual]

Creates a deep copy of a format.

Returns:
Deep copy of a format object.

Implements CFormat.

bool IsDate (  )  const [virtual]

Indicates whether the format presents a date.

Returns:
Always true

Reimplemented from CFormat.

unsigned long GetStyle (  )  const [virtual]

Gets a style of a format.

Returns:
Combination of CLongMsecTimeFormat::Style enumeration.

void Serialize ( CSerializer serializer  )  [virtual]

Serializes a format.

Parameters:
[in] serializer Object, into which a format object is serialized.

Reimplemented from CFormat.