Public Member Functions | |
CDynamicObject (bool canNotify) | |
virtual | ~CDynamicObject () |
virtual const Field | GetField (FID fid) const |
Gets a data object field. | |
virtual void | GetAllFields (Fields &fields) const |
The function copies all declared fields. | |
virtual void | GetAllFids (Fids &fids) const |
Gets all the integer identifiers supported by the object. | |
virtual const CFieldMap * | GetFieldMap () const |
Gets data object fields. | |
virtual bool | DeclareField (CField *field) |
Declares a new field. | |
Set methods | |
virtual bool | SetMfcString (FID fid, const CString &val) |
Sets a MFC string value in the field specified by the identifier. | |
virtual bool | SetStlString (FID fid, const TString &val) |
Sets a STL string value in the field specified by the identifier. | |
virtual bool | SetChar (FID fid, char val) |
Sets char value in the field specified by the identifier. | |
virtual bool | SetUChar (FID fid, unsigned char val) |
Sets unsigned char value in the field specified by the identifier. | |
virtual bool | SetShort (FID fid, short val) |
Sets short value in the field specified by the identifier. | |
virtual bool | SetUShort (FID fid, unsigned short val) |
Sets unsigned short value in the field specified by the identifier. | |
virtual bool | SetLong (FID fid, long val) |
Sets long value in the field specified by the identifier. | |
virtual bool | SetULong (FID fid, unsigned long val) |
Sets unsigned long value in the field specified by the identifier. | |
virtual bool | SetInt64 (FID fid, int64 val) |
Sets __int64 value in the field specified by the identifier. | |
virtual bool | SetBool (FID fid, bool val) |
Sets bool value in the field specified by the identifier. | |
virtual bool | SetFloat (FID fid, float val) |
Sets float value in the field specified by the identifier. | |
virtual bool | SetDouble (FID fid, double val) |
Sets double value in the field specified by the identifier. | |
virtual bool | SetObjectPtr (FID fid, CDataObject *val) |
Sets a pointer to CDataObject in the field specified by the identifier. | |
virtual bool | SetValue (FID fid, const CValue &val) |
Sets CValue in the field specified by the identifier. | |
Get methods | |
virtual CString | GetMfcString (FID fid) const |
Gets MFC string value from the field specified by the identifier. | |
virtual TString | GetStlString (FID fid) const |
Gets STL string value from the field specified by the identifier. | |
virtual char | GetChar (FID fid) const |
Gets char value from the field specified by the identifier. | |
virtual unsigned char | GetUChar (FID fid) const |
Gets unsigned char value from the field specified by the identifier. | |
virtual short | GetShort (FID fid) const |
Gets short value from the field specified by the identifier. | |
virtual unsigned short | GetUShort (FID fid) const |
Gets unsigned short value from the field specified by the identifier. | |
virtual long | GetLong (FID fid) const |
Gets long value from the field specified by the identifier. | |
virtual unsigned long | GetULong (FID fid) const |
Gets unsigned long value from the field specified by the identifier. | |
virtual int64 | GetInt64 (FID fid) const |
Gets __int64 value from the field specified by the identifier. | |
virtual bool | GetBool (FID fid) const |
Gets bool value from the field specified by the identifier. | |
virtual float | GetFloat (FID fid) const |
Gets float value from the field specified by the identifier. | |
virtual double | GetDouble (FID fid) const |
Gets double value from the field specified by the identifier. | |
virtual CDataObject * | GetObjectPtr (FID fid) const |
Gets a pointer to CDataObject from the field specified by the identifier. | |
virtual CValue | GetValue (FID fid) const |
Formatted strings | |
virtual CString | GetFormattedMfcString (FID fid, const CFormat *defaultFormat) const |
Gets a formatted MFC string. | |
virtual bool | SetFormattedMfcString (FID fid, const CString &val, const CFormat *defaultFormat) |
Sets a formatted MFC string. | |
virtual TString | GetFormattedStlString (FID fid, const CFormat *defaultFormat) const |
Gets a formatted STL string. | |
virtual bool | SetFormattedStlString (FID fid, const TString &val, const CFormat *defaultFormat) |
Sets a formatted STL string. | |
Field accessors | |
virtual bool | HasGetMethod (FID fid) const |
Indicates whether the object has Get- method. | |
virtual bool | HasSetMethod (FID fid) const |
Indicates whether the object has Set- method. | |
virtual EnType | GetFieldType (FID fid) const |
Gets a field type. | |
virtual TString | GetFieldName (FID fid) const |
Gets the field name, set during CField registration. | |
virtual const CFormat * | GetFormat (FID fid) const |
Gets the format to convert non-formatted value to the string and back. |
CDynamicObject provides access to values stored in the table. This table can be changed at run time in contrast to the static tables organized with DF_DECLARE_FIELD_MAP(), DF_BEGIN_FIELD_MAP(), DF_BEGIN_FIELD_MAP_EX(), DF_END_FIELD_MAP() macros. In this case memory consumption for dynamic data objects increases greatly. CDynamicObject is usually used if data object type is unknown beforehand. (For example, if data is imported from another application using drag&drop or copy/paste). If the object type is known, it is recommended to use static declaration. CDynamicObject doesn't contain Get- and Set- methods To simulate standard behavior of the data object, all the functions working with unformatted and formatted data were redefined. Every CDynamicObject contains two tables.
1. CFieldMap table to store information about formats for transformation of data into a string and back.
2. Container that stores unformatted data which are accessible by its identifier.
During the first call of any Set- method, CDynamicObject adds a new value corresponding to the identifier to the table of unformatted values. To transform the value into the string with custom format, this format can be registered in CFieldMap with DeclareField() function. CDynamicObject in its destructor destroys all registered fields. In multi-threaded applications essential mechanisms were implemented in order to enable simultaneous access from different threads.
CDynamicObject | ( | bool | canNotify | ) |
Constructor
[in] | canNotify | Indicates whether a dynamic object will send notifications to the subscribers via CDataObject::ISink interface if Set- method is called. |
~CDynamicObject | ( | ) | [virtual] |
Destructor
const CFieldMap * GetFieldMap | ( | ) | const [virtual] |
Gets data object fields.
Retrieves the field map. Const version.
Implements CDataObject.
bool DeclareField | ( | CField * | field | ) | [virtual] |
Declares a new field.
Declares a new field for the dynamic object. The field mustn't have Set- or Get- methods that can be called, because they are an attribute of class and not object. So they should be set to zero. The field identifier can't be equal to Common::allFields(-1) or Common::fieldNotSpecified(-2).
[in] | field | A new field |
bool SetMfcString | ( | FID | fid, | |
const CString & | val | |||
) | [virtual] |
Sets a MFC string value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New MFC string value |
Reimplemented from CDataObject.
bool SetStlString | ( | FID | fid, | |
const TString & | val | |||
) | [virtual] |
Sets a STL string value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New STL string value |
Reimplemented from CDataObject.
bool SetChar | ( | FID | fid, | |
char | val | |||
) | [virtual] |
Sets char value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New char value |
Reimplemented from CDataObject.
bool SetUChar | ( | FID | fid, | |
unsigned char | val | |||
) | [virtual] |
Sets unsigned char value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New unsigned char value |
Reimplemented from CDataObject.
bool SetShort | ( | FID | fid, | |
short | val | |||
) | [virtual] |
Sets short value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New short value |
Reimplemented from CDataObject.
bool SetUShort | ( | FID | fid, | |
unsigned short | val | |||
) | [virtual] |
Sets unsigned short value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New unsigned short value |
Reimplemented from CDataObject.
bool SetLong | ( | FID | fid, | |
long | val | |||
) | [virtual] |
Sets long value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New long value |
Reimplemented from CDataObject.
bool SetULong | ( | FID | fid, | |
unsigned long | val | |||
) | [virtual] |
Sets unsigned long value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New unsigned long value |
Reimplemented from CDataObject.
bool SetInt64 | ( | FID | fid, | |
int64 | val | |||
) | [virtual] |
Sets __int64 value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New __int64 value |
Reimplemented from CDataObject.
bool SetBool | ( | FID | fid, | |
bool | val | |||
) | [virtual] |
Sets bool value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New boolean value |
Reimplemented from CDataObject.
bool SetFloat | ( | FID | fid, | |
float | val | |||
) | [virtual] |
Sets float value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New float value |
Reimplemented from CDataObject.
bool SetDouble | ( | FID | fid, | |
double | val | |||
) | [virtual] |
Sets double value in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New double value |
Reimplemented from CDataObject.
bool SetObjectPtr | ( | FID | fid, | |
CDataObject * | val | |||
) | [virtual] |
Sets a pointer to CDataObject in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New pointer to CDataObject |
Reimplemented from CDataObject.
bool SetValue | ( | FID | fid, | |
const CValue & | val | |||
) | [virtual] |
Sets CValue in the field specified by the identifier.
[in] | fid | Field identifier |
[in] | val | New CValue object |
Reimplemented from CDataObject.
CString GetMfcString | ( | FID | fid | ) | const [virtual] |
Gets MFC string value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
TString GetStlString | ( | FID | fid | ) | const [virtual] |
Gets STL string value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
char GetChar | ( | FID | fid | ) | const [virtual] |
Gets char value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
unsigned char GetUChar | ( | FID | fid | ) | const [virtual] |
Gets unsigned char value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
short GetShort | ( | FID | fid | ) | const [virtual] |
Gets short value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
unsigned short GetUShort | ( | FID | fid | ) | const [virtual] |
Gets unsigned short value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
long GetLong | ( | FID | fid | ) | const [virtual] |
Gets long value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
unsigned long GetULong | ( | FID | fid | ) | const [virtual] |
Gets unsigned long value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
int64 GetInt64 | ( | FID | fid | ) | const [virtual] |
Gets __int64 value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
bool GetBool | ( | FID | fid | ) | const [virtual] |
Gets bool value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
float GetFloat | ( | FID | fid | ) | const [virtual] |
Gets float value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
double GetDouble | ( | FID | fid | ) | const [virtual] |
Gets double value from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
CDataObject * GetObjectPtr | ( | FID | fid | ) | const [virtual] |
Gets a pointer to CDataObject from the field specified by the identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
CValue GetValue | ( | FID | fid | ) | const [virtual] |
CString GetFormattedMfcString | ( | FID | fid, | |
const CFormat * | defaultFormat | |||
) | const [virtual] |
Gets a formatted MFC string.
[in] | fid | Field identifier |
[in] | defaultFormat | Format, which is applied to convert value to a MFC string. If the format is not specified, the function looks for the format, declared with DeclareField() function. If it also is not found, the format returned by CFormat::GetDefaultFormat() is applied. |
Reimplemented from CDataObject.
bool SetFormattedMfcString | ( | FID | fid, | |
const CString & | str, | |||
const CFormat * | defaultFormat | |||
) | [virtual] |
Sets a formatted MFC string.
[in] | fid | Field identifier |
[in] | str | Formatted string |
[in] | defaultFormat | Format, which is applied to convert the formatted MFC string to the value. If the format is not specified, the function looks for the format, declared with DeclareField() function. If it also is not found, the output value is considered as MfcString type. |
Reimplemented from CDataObject.
TString GetFormattedStlString | ( | FID | fid, | |
const CFormat * | defaultFormat | |||
) | const [virtual] |
Gets a formatted STL string.
[in] | fid | Field identifier |
[in] | defaultFormat | Format, which is applied to convert value to a STL string. If the format is not specified, the function looks for the format, declared with DeclareField() function. If it also is not found, the format returned by CFormat::GetDefaultFormat() is applied. |
Reimplemented from CDataObject.
bool SetFormattedStlString | ( | FID | fid, | |
const TString & | str, | |||
const CFormat * | defaultFormat | |||
) | [virtual] |
Sets a formatted STL string.
[in] | fid | Field identifier |
[in] | str | Formatted string |
[in] | defaultFormat | Format, which is applied to convert the formatted string to the value. If the format is not specified, the function looks for the format, declared with DeclareField() function. If it also is not found, the output value is considered as StlString type. |
Reimplemented from CDataObject.
bool HasGetMethod | ( | FID | fid | ) | const [virtual] |
Indicates whether the object has Get- method.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
bool HasSetMethod | ( | FID | fid | ) | const [virtual] |
Indicates whether the object has Set- method.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
EnType GetFieldType | ( | FID | fid | ) | const [virtual] |
Gets a field type.
An field type is determined by non-formatted value, which is returned by the field with the specified identifier.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
TString GetFieldName | ( | FID | fid | ) | const [virtual] |
Gets the field name, set during CField registration.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
const CFormat * GetFormat | ( | FID | fid | ) | const [virtual] |
Gets the format to convert non-formatted value to the string and back.
[in] | fid | Field identifier |
Reimplemented from CDataObject.
Copyright Dapfor 2007-2009 | Generated on Wed Jul 7 03:24:43 2010 for MFCGrid by 1.5.5 |