MFC Grid manual

CFormat Class Reference

Base class for all the formats that transform the unformatted value returned by CDataObject to its text presentation and vice versa. More...

#include <Dapfor/Common/Format.h>

Inheritance diagram for CFormat:

CBoolFormat CCharFormat CDefaultMfcStringFormat CDefaultStlStringFormat CDoubleFormat CEmptyFormat CFloatFormat CInt64DateFormat CInt64Format CLongDateFormat CLongEnumFormat CLongFormat CLongMsecTimeFormat CShortFormat CUCharFormat CULongFormat CUShortFormat

List of all members.

virtual bool IsDate () const
 Indicates whether the format presents a date.
virtual bool IsEnum () const
 Indicates whether the format presents an enumeration.
virtual CFormatClone () const =0
 Creates a deep copy of a format.
virtual TString GetFormatName () const
 Gets format name.
virtual bool IsSerializableType () const
 Indicates whether the format is serializable.
virtual void Serialize (CSerializer &serializer)
 Serializes a format.
static CFormatGetDefaultFormat (EnType nType)
 Gets a default format.
static int GetSerializeVertion ()
 Serialization version.

Public Member Functions

virtual ~CFormat ()
 Virtual destructor.
EnType GetType () const
 Gets a format type.
Format methods
virtual CString FormatMfc (const CString &val, const CDataObject *pDO) const
 The function converts non-formatted value of MFC string type to the formatted MFC string.
virtual CString FormatMfc (const TString &val, const CDataObject *pDO) const
 The function converts non-formatted value of STL string type to the formatted MFC string.
virtual CString FormatMfc (char val, const CDataObject *pDO) const
 The function converts non-formatted value of char type to the formatted MFC string.
virtual CString FormatMfc (unsigned char val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned char type to the formatted MFC string.
virtual CString FormatMfc (short val, const CDataObject *pDO) const
 The function converts non-formatted value of short type to the formatted MFC string.
virtual CString FormatMfc (unsigned short val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned short type to the formatted MFC string.
virtual CString FormatMfc (long val, const CDataObject *pDO) const
 The function converts non-formatted value of long type to the formatted MFC string.
virtual CString FormatMfc (unsigned long val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned long type to the formatted MFC string.
virtual CString FormatMfc (int64 val, const CDataObject *pDO) const
 The function converts non-formatted value of __int64 type to the formatted MFC string.
virtual CString FormatMfc (bool val, const CDataObject *pDO) const
 The function converts non-formatted value of bool type to the formatted MFC string.
virtual CString FormatMfc (float val, const CDataObject *pDO) const
 The function converts non-formatted value of float type to the formatted MFC string.
virtual CString FormatMfc (double val, const CDataObject *pDO) const
 The function converts non-formatted value of double type to the formatted MFC string.
virtual CString FormatMfc (CDataObject *val, const CDataObject *pDO) const
 The function converts non-formatted value of CDataObject* type to the formatted MFC string.
virtual CString FormatMfc (const CValue &val, const CDataObject *pDO) const
 The function converts the non-formatted value presented by CValue object to the formatted MFC string.
virtual TString FormatStl (const CString &val, const CDataObject *pDO) const
 The function converts non-formatted value of CString type to the formatted STL string.
virtual TString FormatStl (const TString &val, const CDataObject *pDO) const
 The function converts non-formatted value of STL string type to the formatted STL string.
virtual TString FormatStl (char val, const CDataObject *pDO) const
 The function converts non-formatted value of char type to the formatted string.
virtual TString FormatStl (unsigned char val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned char type to the formatted string.
virtual TString FormatStl (short val, const CDataObject *pDO) const
 The function converts non-formatted value of short type to the formatted string.
virtual TString FormatStl (unsigned short val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned short type to the formatted string.
virtual TString FormatStl (long val, const CDataObject *pDO) const
 The function converts non-formatted value of long type to the formatted string.
virtual TString FormatStl (unsigned long val, const CDataObject *pDO) const
 The function converts non-formatted value of unsigned long type to the formatted string.
virtual TString FormatStl (int64 val, const CDataObject *pDO) const
 The function converts non-formatted value of __int64 type to the formatted string.
virtual TString FormatStl (bool val, const CDataObject *pDO) const
 The function converts non-formatted value of bool type to the formatted string.
virtual TString FormatStl (float val, const CDataObject *pDO) const
 The function converts non-formatted value of float type to the formatted string.
virtual TString FormatStl (double val, const CDataObject *pDO) const
 The function converts non-formatted value of double type to the formatted string.
virtual TString FormatStl (CDataObject *val, const CDataObject *pDO) const
 The function converts non-formatted value which is a pointer to CDataObject type to the formatted string.
virtual TString FormatStl (const CValue &val, const CDataObject *pDO) const
 The function converts the non-formatted value presented by CValue object to the formatted STL string.
Parse methods
virtual bool ParseMfc (const CString &str, CString &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted MFC string.
virtual bool ParseMfc (const CString &str, TString &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted STL string.
virtual bool ParseMfc (const CString &str, char &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted char-type value.
virtual bool ParseMfc (const CString &str, unsigned char &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted unsigned char-type value.
virtual bool ParseMfc (const CString &str, short &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted unsigned short-type value.
virtual bool ParseMfc (const CString &str, unsigned short &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted unsigned unsigned short-type value.
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 bool ParseMfc (const CString &str, unsigned long &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted unsigned long-type value.
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 bool ParseMfc (const CString &str, bool &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted bool-type value.
virtual bool ParseMfc (const CString &str, float &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted float-type value.
virtual bool ParseMfc (const CString &str, CDataObject *&val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted CDataObject* -type value.
virtual bool ParseMfc (const CString &str, double &val, const CDataObject *pDO) const
 The function converts the formatted MFC string to the non-formatted double -type value.
virtual bool ParseMfc (const CString &str, CValue &val, const CDataObject *pDO) const
 The function parses the formatted MFC string to the value presented by CValue object.
virtual bool ParseStl (const TString &str, CString &val, const CDataObject *pDO) const
 The function converts the formatted STL string to the non-formatted MFC string.
virtual bool ParseStl (const TString &str, TString &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of string type.
virtual bool ParseStl (const TString &str, char &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of char type.
virtual bool ParseStl (const TString &str, unsigned char &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of unsigned char type.
virtual bool ParseStl (const TString &str, short &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of short type.
virtual bool ParseStl (const TString &str, unsigned short &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of unsigned short type.
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 bool ParseStl (const TString &str, unsigned long &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of unsigned long type.
virtual bool ParseStl (const TString &str, int64 &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of __int64 type.
virtual bool ParseStl (const TString &str, bool &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of bool type.
virtual bool ParseStl (const TString &str, float &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of float type.
virtual bool ParseStl (const TString &str, CDataObject *&val, const CDataObject *pDO) const
 The function converts the formatted string to the pointer to CDataObject.
virtual bool ParseStl (const TString &str, double &val, const CDataObject *pDO) const
 The function converts the formatted string to the non-formatted value of double type.
virtual bool ParseStl (const TString &str, CValue &val, const CDataObject *pDO) const
 The function parses the formatted string to the value presented by CValue object.

Protected Member Functions

 CFormat (EnType nType)
 Constructor.
 CFormat (const CFormat &)
 Copy constructor.

Detailed Description

Base class for all the formats that transform the unformatted value returned by CDataObject to its text presentation and vice versa.

Thread safety
Thread safety depends on implementation in children objects. Usually the formats are not thread-safe. But if they are used in the static field maps, organized by the macros DF_DECLARE_FIELD_MAP(), etc, their usage is safe.
Example
//Values returned by C++ objects and inserted into the grid, can be 
//presented in cells in various ways. The type of presentation depends 
//on format that transforms value to formatted string and vice versa.
//Below you can see example of implementing a custom format. This format 
//can be set in the mapping table or in the Dapfor::GUI::CColumn class.

//CustomLongFormat.h file

//Custom format that transforms long value to a string and vice versa
class CCustomLongFormat : public Dapfor::Common::CFormat
{
public:
    CCustomLongFormat();

    //Pair of format and parse functions
    virtual std::string Format(long val, const Dapfor::Common::CDataObject* pDO) const;
    virtual bool Parse(const std::string& str, long& val, const Dapfor::Common::CDataObject* pDO) const;

    //An object of this class can be cloned.
    virtual Dapfor::Common::CFormat* Clone() const;
};



//CustomLongFormat.cpp file

//Constructor. Format type is Dapfor::Common::Long
CCustomLongFormat::CCustomLongFormat() : Dapfor::Common::CFormat(Dapfor::Common::Long)
{
}

//Format implementation -> transforms a long value to a string
std::string CCustomLongFormat::Format(long val, const Dapfor::Common::CDataObject* pDO) const
{
    switch(val)
    {
        case 0: return "Zero";
        case 1: return "One";
        case 2: return "Two";
    }
    return "";
}

//Parse implementation -> transforms a string to a long value
bool CCustomLongFormat::Parse(const std::string& str, long& val, const Dapfor::Common::CDataObject* pDO) const
{
    if(str == "Zero") 
    {
        val = 0;
        return true;
    }
    if(str == "One") 
    {
        val = 1;
        return true;
    }
    if(str == "Two") 
    {
        val = 2;
        return true;
    }
    return false;
}

//Clone implementation
Dapfor::Common::CFormat* CCustomLongFormat::Clone() const
{
    return new CCustomLongFormat();
}


//How to use the format:
DF_BEGIN_FIELD_MAP(CMyClass)
    ...
    DF_LONG_ID  (MyFid,     "Custom format",     &CMyClass::GetMyLong,   0,  new CCustomLongFormat())
    ...
DF_END_FIELD_MAP()

Member Function Documentation

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

The function converts non-formatted value of MFC string 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 in CDefaultMfcStringFormat, and CEmptyFormat.

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

The function converts non-formatted value of STL string 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 in CDefaultStlStringFormat, and CEmptyFormat.

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

The function converts non-formatted value of char 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 in CCharFormat, and CEmptyFormat.

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

The function converts non-formatted value of unsigned char 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 in CEmptyFormat, and CUCharFormat.

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

The function converts non-formatted value of short 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 in CEmptyFormat, and CShortFormat.

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

The function converts non-formatted value of unsigned short 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 in CEmptyFormat, and CUShortFormat.

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 in CEmptyFormat, CLongDateFormat, CLongEnumFormat, CLongFormat, and CLongMsecTimeFormat.

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

The function converts non-formatted value of unsigned 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 in CEmptyFormat, and CULongFormat.

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

The function converts non-formatted value of __int64 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 in CEmptyFormat, CInt64DateFormat, and CInt64Format.

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

The function converts non-formatted value of bool 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 in CBoolFormat, and CEmptyFormat.

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

The function converts non-formatted value of float 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 in CEmptyFormat, and CFloatFormat.

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

The function converts non-formatted value of double 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 in CDoubleFormat, and CEmptyFormat.

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

The function converts non-formatted value of CDataObject* 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 in CEmptyFormat.

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

The function converts the non-formatted value presented by CValue object to the formatted MFC string.

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

Reimplemented in CEmptyFormat.

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

The function converts the formatted MFC string to the non-formatted MFC string.

Parameters:
[in] str MFC string to be formatted.
[in,out] val MFC string 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 in CDefaultMfcStringFormat, and CEmptyFormat.

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

The function converts the formatted MFC string to the non-formatted STL string.

Parameters:
[in] str MFC string to be formatted.
[in,out] val STL string 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 in CDefaultStlStringFormat, and CEmptyFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the char 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 in CCharFormat, and CEmptyFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the unsigned char 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 in CEmptyFormat, and CUCharFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the short 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 in CEmptyFormat, and CShortFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the unsigned short 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 in CEmptyFormat, and CUShortFormat.

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 in CEmptyFormat, CLongDateFormat, CLongEnumFormat, CLongFormat, and CLongMsecTimeFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the unsigned 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 in CEmptyFormat, and CULongFormat.

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.

Parameters:
[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.
Returns:
True, if the string has been successfully parsed. Otherwise false.

Reimplemented in CEmptyFormat, CInt64DateFormat, and CInt64Format.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the bool 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 in CBoolFormat, and CEmptyFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the float 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 in CEmptyFormat, and CFloatFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the CDataObject* 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 in CEmptyFormat.

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

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

Parameters:
[in] str MFC string to be formatted.
[in,out] val A value of the double 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 in CDoubleFormat, and CEmptyFormat.

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

The function parses the formatted MFC string to the value presented by CValue object.

Parameters:
[in] str Formatted string.
[in,out] val object of CValue class 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 in CEmptyFormat.

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

The function converts non-formatted value of CString type to the formatted STL 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 in CDefaultMfcStringFormat, and CEmptyFormat.

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

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

Parameters:
[in] val Non-formatted 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 in CDefaultStlStringFormat, and CEmptyFormat.

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

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

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

Reimplemented in CCharFormat, and CEmptyFormat.

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

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

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

Reimplemented in CEmptyFormat, and CUCharFormat.

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

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

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

Reimplemented in CEmptyFormat, and CShortFormat.

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

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

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

Reimplemented in CEmptyFormat, and CUShortFormat.

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 in CEmptyFormat, CLongDateFormat, CLongEnumFormat, CLongFormat, and CLongMsecTimeFormat.

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

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

Parameters:
[in] val Non formatted value of unsigned 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 in CEmptyFormat, and CULongFormat.

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

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

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

Reimplemented in CEmptyFormat, CInt64DateFormat, and CInt64Format.

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

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

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

Reimplemented in CBoolFormat, and CEmptyFormat.

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

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

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

Reimplemented in CEmptyFormat, and CFloatFormat.

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

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

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

Reimplemented in CDoubleFormat, and CEmptyFormat.

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

The function converts non-formatted value which is a pointer to CDataObject type to the formatted string.

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

Reimplemented in CEmptyFormat.

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

The function converts the non-formatted value presented by CValue object to the formatted STL string.

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

Reimplemented in CEmptyFormat.

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

The function converts the formatted STL string to the non-formatted MFC string.

Parameters:
[in] str STL string to be formatted.
[in,out] val MFC string that is a resunt 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 in CDefaultMfcStringFormat, and CEmptyFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of string 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 in CDefaultStlStringFormat, and CEmptyFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of char 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 in CCharFormat, and CEmptyFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of unsigned char 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 in CEmptyFormat, and CUCharFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of short 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 in CEmptyFormat, and CShortFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of unsigned short 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 in CEmptyFormat, and CUShortFormat.

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 in CEmptyFormat, CLongDateFormat, CLongEnumFormat, CLongFormat, and CLongMsecTimeFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of unsigned 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 in CEmptyFormat, and CULongFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of __int64 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 in CEmptyFormat, CInt64DateFormat, and CInt64Format.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of bool 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 in CBoolFormat, and CEmptyFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of float 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 in CEmptyFormat, and CFloatFormat.

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

The function converts the formatted string to the pointer to CDataObject.

Parameters:
[in] str Formatted string.
[in,out] val pointer to CDataObject 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 in CEmptyFormat.

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

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

Parameters:
[in] str Formatted string.
[in,out] val Value of double 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 in CDoubleFormat, and CEmptyFormat.

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

The function parses the formatted string to the value presented by CValue object.

Parameters:
[in] str Formatted string.
[in,out] val object of CValue class that accepts the 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 in CEmptyFormat.

bool IsDate (  )  const [virtual]

Indicates whether the format presents a date.

Returns:
True if the format represents a date. Otherwise false.

Reimplemented in CInt64DateFormat, CLongDateFormat, and CLongMsecTimeFormat.

bool IsEnum (  )  const [virtual]

Indicates whether the format presents an enumeration.

Returns:
True if the format represents an enumeration. Otherwise false.

Reimplemented in CLongEnumFormat.

CFormat * Clone (  )  const [pure virtual]

Creates a deep copy of a format.

Returns:
Deep copy of a format object.

Implemented in CBoolFormat, CCharFormat, CDefaultStlStringFormat, CDefaultMfcStringFormat, CDoubleFormat, CEmptyFormat, CFloatFormat, CInt64DateFormat, CInt64Format, CLongDateFormat, CLongEnumFormat, CLongFormat, CLongMsecTimeFormat, CShortFormat, CUCharFormat, CULongFormat, and CUShortFormat.

CFormat & GetDefaultFormat ( EnType  nType  )  [static]

Gets a default format.

Parameters:
[in] nType Format type.
Returns:
Reference to the appropriate format. These formats are listed below:
Format type Fromat class
Common::MfcString Common::CDefaultMfcStringFormat()
Common::StlString Common::CDefaultStlStringFormat()
Common::Char Common::CCharFormat()
Common::UChar Common::CUCharFormat()
Common::Short Common::CShortFormat()
Common::UShort Common::CUShortFormat()
Common::Long Common::CLongFormat()
Common::ULong Common::CULongFormat()
Common::Int64 Common::CInt64Format()
Common::Bool Common::CBoolFormat()
Common::Float Common::CFloatFormat()
Common::Double Common::CDoubleFormat()
Common::ObjectPtr Common::CEmptyFormat(Common::ObjectPtr)
Thread safety
The function is thread safe

TString GetFormatName (  )  const [virtual]

Gets format name.

Usually it is used for serialisation reasons. To declare the format class as serialisable, the macros DF_DECLARE_FORMAT() and DF_IMPLEMENT_FORMAT() can be used.

Returns:
Format name.

bool IsSerializableType (  )  const [virtual]

Indicates whether the format is serializable.

Indicates whether the object of CFormat class is serializable.

Returns:
True the format is serializable. Otherwise false.

void Serialize ( CSerializer serializer  )  [virtual]

Serializes a format.

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

Reimplemented in CBoolFormat, CCharFormat, CDefaultStlStringFormat, CDefaultMfcStringFormat, CDoubleFormat, CEmptyFormat, CFloatFormat, CInt64DateFormat, CInt64Format, CLongDateFormat, CLongEnumFormat, CLongFormat, CLongMsecTimeFormat, CShortFormat, CUCharFormat, CULongFormat, and CUShortFormat.