Public Types | |
typedef std::pair< CField *, CDataObject * > | Field |
This type represents a pair of field and data object where the field is applicable. | |
typedef std::set< Field > | Fields |
Set of the fields. | |
typedef std::set< FID > | Fids |
Set of field identifiers. | |
Get method types | |
typedef CString(CDataObject::* | pfnGetMfcString )() const |
Get-method of the CString type. | |
typedef TString(CDataObject::* | pfnGetStlString )() const |
Get-method of the STL string type. | |
typedef char(CDataObject::* | pfnGetChar )() const |
Get-method of the char type. | |
typedef unsigned char(CDataObject::* | pfnGetUChar )() const |
Get-method of the unsigned char type. | |
typedef short(CDataObject::* | pfnGetShort )() const |
Get-method of the short type. | |
typedef unsigned short(CDataObject::* | pfnGetUShort )() const |
Get-method of the unsigned short type. | |
typedef long(CDataObject::* | pfnGetLong )() const |
Get-method of the long type. | |
typedef unsigned long(CDataObject::* | pfnGetULong )() const |
Get-method of the unsigned long type. | |
typedef int64(CDataObject::* | pfnGetInt64 )() const |
Get-method of the __int64 type. | |
typedef bool(CDataObject::* | pfnGetBool )() const |
Get-method of the bool type. | |
typedef float(CDataObject::* | pfnGetFloat )() const |
Get-method of the float type. | |
typedef double(CDataObject::* | pfnGetDouble )() const |
Get-method of the double type. | |
typedef CDataObject *(CDataObject::* | pfnGetObjectPtr )() const |
Get-method of CDataObject pointer type. | |
Set method types | |
typedef void(CDataObject::* | pfnSetMfcString )(const CString &) |
Set-method of the CString type. | |
typedef void(CDataObject::* | pfnSetStlString )(const TString &) |
Set-method of the string type. | |
typedef void(CDataObject::* | pfnSetChar )(char) |
Set-method of the char type. | |
typedef void(CDataObject::* | pfnSetUChar )(unsigned char) |
Set-method of the unsigned char type. | |
typedef void(CDataObject::* | pfnSetShort )(short) |
Set-method of the short type. | |
typedef void(CDataObject::* | pfnSetUShort )(unsigned short) |
Set-method of the unsigned short type. | |
typedef void(CDataObject::* | pfnSetLong )(long) |
Set-method of the long type. | |
typedef void(CDataObject::* | pfnSetULong )(unsigned long) |
Set-method of the unsigned long type. | |
typedef void(CDataObject::* | pfnSetInt64 )(int64) |
Set-method of the __int64 type. | |
typedef void(CDataObject::* | pfnSetBool )(bool) |
Set-method of the bool type. | |
typedef void(CDataObject::* | pfnSetFloat )(float) |
Set-method of the float type. | |
typedef void(CDataObject::* | pfnSetDouble )(double) |
Set-method of the double type. | |
typedef void(CDataObject::* | pfnSetObjectPtr )(CDataObject *) |
Set-method of CDataObject pointer type. | |
Public Member Functions | |
Field accessors | |
virtual const Field | GetField (FID fid) const |
Gets a field of the data object. | |
virtual void | GetAllFields (Fields &fields) const |
The function copies all the fields declared in the derived classes. | |
virtual void | GetAllFids (Fids &fields) const |
Gets all the integer identifiers supported by the data object. | |
virtual const CFieldMap * | GetFieldMap () const =0 |
Gets data object fields. | |
virtual bool | HasGetMethod (FID fid) const |
Indicates whether Get- method is presented. | |
virtual bool | HasSetMethod (FID fid) const |
Checks if Set function can be called to set non-formatted value by the specified field identifier. | |
virtual EnType | GetFieldType (FID fid) const |
Gets a field type. | |
virtual TString | GetFieldName (FID fid) const |
Gets a field name, set during CFieldMap initialization. | |
virtual const CFormat * | GetFormat (FID fid) const |
Gets format to transmit non-formatted value to the string and back. | |
Get methods | |
virtual CString | GetMfcString (FID fid) const |
Calls Get-method in the derived class by its field identifier to get CString value. | |
virtual TString | GetStlString (FID fid) const |
Calls Get-method in the derived class by its field identifier to get STL string value. | |
virtual char | GetChar (FID fid) const |
Calls Get-method in the derived class by its field identifier to get char value. | |
virtual unsigned char | GetUChar (FID fid) const |
Calls Get-method in the derived class by its field identifier to get unsigned char value. | |
virtual short | GetShort (FID fid) const |
Calls Get-method in the derived class by its field identifier to get short value. | |
virtual unsigned short | GetUShort (FID fid) const |
Calls Get-method in the derived class by its field identifier to get unsigned short value. | |
virtual long | GetLong (FID fid) const |
Calls Get-method in the derived class by its field identifier to get long value. | |
virtual unsigned long | GetULong (FID fid) const |
Calls Get-method in the derived class by its field identifier to get unsigned long value. | |
virtual int64 | GetInt64 (FID fid) const |
Calls Get-method in the derived class by its field identifier to get __int64 value. | |
virtual bool | GetBool (FID fid) const |
Calls Get-method in the derived class by its field identifier to get bool value. | |
virtual float | GetFloat (FID fid) const |
Calls Get-method in the derived class by its field identifier to get float value. | |
virtual double | GetDouble (FID fid) const |
Calls Get-method in the derived class by its field identifier to get double value. | |
virtual CDataObject * | GetObjectPtr (FID fid) const |
Calls Get-method in the derived class by its field identifier to get CDataObject pointer. | |
virtual CValue | GetValue (FID fid) const |
Calls Get-method in the derived class by its field identifier to get CValue object. | |
Set methods | |
virtual bool | SetMfcString (FID fid, const CString &val) |
Calls Set-method in the derived class by its field identifier to set CString value. | |
virtual bool | SetStlString (FID fid, const TString &val) |
Calls Set-method in the derived class by its field identifier to set STL string value. | |
virtual bool | SetChar (FID fid, char val) |
Calls Set-method in the derived class by its field identifier to set char value. | |
virtual bool | SetUChar (FID fid, unsigned char val) |
Calls Set-method in the derived class by its field identifier to set unsigned char value. | |
virtual bool | SetShort (FID fid, short val) |
Calls Set-method in the derived class by its field identifier to set short value. | |
virtual bool | SetUShort (FID fid, unsigned short val) |
Calls Set-method in the derived class by its field identifier to set unsigned short value. | |
virtual bool | SetLong (FID fid, long val) |
Calls Set-method in the derived class by its field identifier to set long value. | |
virtual bool | SetULong (FID fid, unsigned long val) |
Calls Set-method in the derived class by its field identifier to set unsigned long value. | |
virtual bool | SetInt64 (FID fid, int64 val) |
Calls Set-method in the derived class by its field identifier to set __int64 value. | |
virtual bool | SetBool (FID fid, bool val) |
Calls Set-method in the derived class by its field identifier to set bool value. | |
virtual bool | SetFloat (FID fid, float val) |
Calls Set-method in the derived class by its field identifier to set float value. | |
virtual bool | SetDouble (FID fid, double val) |
Calls Set-method in the derived class by its field identifier to set double value. | |
virtual bool | SetObjectPtr (FID fid, CDataObject *val) |
Calls Set-method in the derived class by its field identifier to set CDataObject pointer. | |
virtual bool | SetValue (FID fid, const CValue &val) |
Calls Set-method in the derived class by its field identifier to set CValue object. | |
Formatted strings | |
virtual CString | GetFormattedMfcString (FID fid, const CFormat *defaultFormat) const |
Gets a formatted string by calling corresponding function in the derived class. | |
virtual bool | SetFormattedMfcString (FID fid, const CString &str, const CFormat *defaultFormat) |
Sets a formatted string by calling corresponding function in the derived class. | |
virtual TString | GetFormattedStlString (FID fid, const CFormat *defaultFormat) const |
Gets a formatted string by calling corresponding function in the derived class. | |
virtual bool | SetFormattedStlString (FID fid, const TString &str, const CFormat *defaultFormat) |
Sets a formatted string by calling corresponding function in the derived class. | |
Serialization | |
virtual const TString & | GetSerializationName () const |
Gets serialization name. | |
virtual bool | IsSerializableType () const |
Indicates whether the object is serializable. | |
virtual void | Serialize (CSerializer &serializer) |
Serializes the object into the serializer. | |
Notifications | |
void | AddSink (ISink *sink) |
Adds a new listener. | |
void | RemoveSink (ISink *sink) |
Removes a specified listener. | |
void | NotifyUpdate (FID fid) |
Sends notification to the listeners, that the field was changed. | |
void | NotifyUpdate (const Fids &fids) |
Sends notification to the listeners with a list of the modified fields. | |
Static Public Member Functions | |
static int | GetSerializeVertion () |
Protected Member Functions | |
void | NotifyDelete () |
Sends the notification, that the object ends its life cycle. | |
Classes | |
class | ISink |
Interface to receive notifications from CDataObject. More... |
The data object represents the mechanism of separating data from its presentation on the class level. The data object can return unformatted values like char, long, double by calling the appropriate function of the derived class by its integer identifier, and permits to transform unformatted data to the string through the appropriate format and vice-versa. To make separation of data from its presentation possible, the table of functions is organized. These functions can be called by their identifiers. The macro DF_DECLARE_FIELD_MAP() declares this table in the derived class. If there is an inheritance chain, each derived class can organize its own table. The table instantiation occurs in cpp file with DF_BEGIN_FIELD_MAP() and DF_END_FIELD_MAP() macros.
Integer identifiers are used to insert data into the table. Within one table these identifiers should not recur and should not be equal to Common::allFields (-1) or Common:: fieldNotSpecified (-2). If there is an inheritance chain, the identifiers of derived classes and base classes can be the same. This can be used to enable polymorphic behavior of a data object in GUI::CGrid. Each record in the table is presented in the form of an object of CField type. The table itself is represented by the object of CFieldMap class. Table initialization takes place at the start of the application. The table is not changed during the application running, and it enables organizing access from different threads. If there is a large quantity of declared fields (more than 50), it is recommended to use DF_END_HASH_FIELD_MAP() instead of the DF_END_FIELD_MAP() macro in order to accelerate access to class functions by their identifiers.
CDataObject provides CDataObject::ISink callback interface to inform the subscribers about change of its internal state. AddSink() function is used for subscription to the events. RemoveSink() function should be called to remove the subscribers from CDataObject. Notifications are sent by calling NotifyUpdate(). implementation of the container that stores the subscriber list and is thread-safe. NotifyUpdate() function is implemented without taking a synchronization object during function call. This prevents deadlocks between two and more threads. Usually NotifyUpdate function is called after data object state modification.
The data object offers an interface for data serialization. The macro DF_DECLARE_SERIALIZABLE_TYPE() is used to declare a serializable type.
Read What is a data object? article to get more information.
The article How to install the MFC grid and compile the first application? explains all steps of installing and compiling your first application.
const CDataObject::Field GetField | ( | FID | fid | ) | const [virtual] |
Gets a field of the data object.
It performs a field search in the derived classes according to its numeric identifier. When there is a chain of inheritance, the search is performed in the last derived class first, then in the preceding class, etc. up to the first. If the corresponding field is found, CDataObject::Field type object is returned
[in] | fid | Field identifier |
Reimplemented in CDelegate, and CDynamicObject.
void GetAllFields | ( | Fields & | fields | ) | const [virtual] |
The function copies all the fields declared in the derived classes.
[in,out] | fields | Container, into which all data object fields are copied |
void GetAllFids | ( | Fids & | fids | ) | const [virtual] |
Gets all the integer identifiers supported by the data object.
[in,out] | fids | Container, into which identifiers are inserted |
const CFieldMap * GetFieldMap | ( | ) | const [pure virtual] |
Gets data object fields.
Purely virtual function that gets the table containing CDataObject fields. This table is usually declared in derived classes by the macro DF_DECLARE_FIELD_MAP() and is implemented by DF_BEGIN_FIELD_MAP() and DF_END_FIELD_MAP(). This table can be formed for dynamic objects during object creation. Usually the last declared table in hierarchy is returned. CFieldMap::GetParentMap() function can be used to get tables of the basic classes.
Implemented in CDynamicObject.
bool HasGetMethod | ( | FID | fid | ) | const [virtual] |
Indicates whether Get- method is presented.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
bool HasSetMethod | ( | FID | fid | ) | const [virtual] |
Checks if Set function can be called to set non-formatted value by the specified field identifier.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
EnType GetFieldType | ( | FID | fid | ) | const [virtual] |
Gets a field type.
Field type is determined by non-formatted value that we can get and set by calling the corresponding function in derived classes by their identifier
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
TString GetFieldName | ( | FID | fid | ) | const [virtual] |
Gets a field name, set during CFieldMap initialization.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
const CFormat * GetFormat | ( | FID | fid | ) | const [virtual] |
Gets format to transmit non-formatted value to the string and back.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
TString GetStlString | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get STL string value.
The function is trying to get string type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
char GetChar | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get char value.
The function is trying to get char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
unsigned char GetUChar | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get unsigned char value.
The function is trying to get unsigned char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
short GetShort | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get short value.
The function is trying to get short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
unsigned short GetUShort | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get unsigned short value.
The function is trying to get unsigned short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
long GetLong | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get long value.
The function is trying to get long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
unsigned long GetULong | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get unsigned long value.
The function is trying to get unsigned long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
int64 GetInt64 | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get __int64 value.
The function is trying to get __int64 type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
bool GetBool | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get bool value.
The function is trying to get bool type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
float GetFloat | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get float value.
The function is trying to get float type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
double GetDouble | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get double value.
The function is trying to get double type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
CDataObject * GetObjectPtr | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get CDataObject pointer.
The function is trying to get CDataObject pointer. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
CValue GetValue | ( | FID | fid | ) | const [virtual] |
Calls Get-method in the derived class by its field identifier to get CValue object.
The function is trying to get CValue type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
Reimplemented in CDynamicObject.
bool SetMfcString | ( | FID | fid, | |
const CString & | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set CString value.
The function is trying to set MFC string non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted string |
Reimplemented in CDynamicObject.
bool SetStlString | ( | FID | fid, | |
const TString & | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set STL string value.
The function is trying to set STL string non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted string |
Reimplemented in CDynamicObject.
bool SetChar | ( | FID | fid, | |
char | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set char value.
The function is trying to set char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetUChar | ( | FID | fid, | |
unsigned char | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set unsigned char value.
The function is trying to set unsigned char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetShort | ( | FID | fid, | |
short | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set short value.
The function is trying to set short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetUShort | ( | FID | fid, | |
unsigned short | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set unsigned short value.
The function is trying to set unsigned short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetLong | ( | FID | fid, | |
long | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set long value.
The function is trying to set long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetULong | ( | FID | fid, | |
unsigned long | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set unsigned long value.
The function is trying to set unsigned long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetInt64 | ( | FID | fid, | |
int64 | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set __int64 value.
The function is trying to set __int64 type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetBool | ( | FID | fid, | |
bool | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set bool value.
The function is trying to set bool type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetFloat | ( | FID | fid, | |
float | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set float value.
The function is trying to set float type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetDouble | ( | FID | fid, | |
double | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set double value.
The function is trying to set double type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetObjectPtr | ( | FID | fid, | |
CDataObject * | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set CDataObject pointer.
The function is trying to set pointer to the CDataObject value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
bool SetValue | ( | FID | fid, | |
const CValue & | val | |||
) | [virtual] |
Calls Set-method in the derived class by its field identifier to set CValue object.
The function is trying to set CValue type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | val | Unformatted value |
Reimplemented in CDynamicObject.
CString GetFormattedMfcString | ( | FID | fid, | |
const CFormat * | defaultFormat | |||
) | const [virtual] |
Gets a formatted string by calling corresponding function in the derived class.
The function is trying to get a formatted MFC string for the specified field. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called. After, the value is transformed via the format to the formatted string.
[in] | fid | Field identifier |
[in] | defaultFormat | Format to transmit value to a formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call. |
Reimplemented in CDynamicObject.
bool SetFormattedMfcString | ( | FID | fid, | |
const CString & | str, | |||
const CFormat * | defaultFormat | |||
) | [virtual] |
Sets a formatted string by calling corresponding function in the derived class.
The function is trying to set formatted MFC string to the specified field. For this purpose the formatted string is transformed via the format to the unformatted value. Then, a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | str | Formatted string |
[in] | defaultFormat | Format to get value from the formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call. |
Reimplemented in CDynamicObject.
TString GetFormattedStlString | ( | FID | fid, | |
const CFormat * | defaultFormat | |||
) | const [virtual] |
Gets a formatted string by calling corresponding function in the derived class.
The function is trying to get a formatted STL string for the specified field. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called. After, the value is transformed via the format to the formatted string.
[in] | fid | Field identifier |
[in] | defaultFormat | Format to transmit value to a formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call. |
Reimplemented in CDynamicObject.
bool SetFormattedStlString | ( | FID | fid, | |
const TString & | str, | |||
const CFormat * | defaultFormat | |||
) | [virtual] |
Sets a formatted string by calling corresponding function in the derived class.
The function is trying to set formatted STL string to the specified field. For this purpose the formatted string is transformed via the format to the unformatted value. After that, a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.
[in] | fid | Field identifier |
[in] | str | Formatted string |
[in] | defaultFormat | Format to get value from the formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call. |
Reimplemented in CDynamicObject.
const TString & GetSerializationName | ( | ) | const [virtual] |
Gets serialization name.
The macro DF_DECLARE_SERIALIZABLE_TYPE() may be used to declare class as serializable.
bool IsSerializableType | ( | ) | const [virtual] |
Indicates whether the object is serializable.
The macro DF_DECLARE_SERIALIZABLE_TYPE() may be used to declare class as serializable.
void Serialize | ( | CSerializer & | serializer | ) | [virtual] |
Serializes the object into the serializer.
Serializes the object to the serializer. To reduce Common library dependence on external libraries (including MFC) CSerializer class have been added that resembles CArchive class, existing in MFC library.
[in] | serializer | An object, into which data object is serialized. Serialization direction is determined by CSerializer::GetMode() function. |
int GetSerializeVertion | ( | ) | [static] |
Returns current serialization version of CDataObject class.
void AddSink | ( | ISink * | sink | ) |
Adds a new listener.
The function adds a subscriber to subscription list. The subscriber gets notification when CDataObject::NotifyUpdate or CDataObject::NotifyDelete functions are called (typically during Set- function call or in the destructor of CDataObject). The subscribtion list is protected against multiple threads accessing. The functions CDataObject::AddSink, CDataObject::RemoveSink, CDataObject::NotifyUpdate and CDataObject::NotifyDelete are thread-safe. CDataObject notifies the listeners without critical section or mutex objects taking at the moment of notification that prevents dead-lock between two or more threads.
[in] | sink | Callback interface to receive notifications. During insertion it is checked if the specified interface wasn't inserted before. If it has been already inserted, repeated insertion does not occur. |
void RemoveSink | ( | ISink * | sink | ) |
Removes a specified listener.
[in] | sink | Callback interface to remove from the subscription list. |
void NotifyUpdate | ( | FID | fid | ) |
Sends notification to the listeners, that the field was changed.
The function sends identifier of the field which was modified to each listener. Typically this happens when Set- function of CDataObject is called.
[in] | fid | Field identificator. |
void NotifyUpdate | ( | const Fids & | fids | ) |
Sends notification to the listeners with a list of the modified fields.
The function sends to each listener a list of field identificators. Typically this happens when Set- functions of CDataObject are called.
[in] | fids | List of field identificators. |
void NotifyDelete | ( | ) | [protected] |
Sends the notification, that the object ends its life cycle.
The function notifies the remained subscribers on CDataObject life ending. This usually happens when the destructor of CDataObject is called. The subscribers list is usually empty. After callback the function clears the subscription list and its repeated calls will be ineffective.
Copyright Dapfor 2007-2009 | Generated on Wed Jul 7 03:24:43 2010 for MFCGrid by 1.5.5 |