Public Types | |
typedef std::set< CField * > | Fields |
list of the fields, declared in the field map | |
Public Member Functions | |
CFieldMap () | |
constructor | |
CFieldMap (CFieldMap *pParentMap) | |
Constructor that is applied in the inheritance chain. | |
virtual | ~CFieldMap () |
Frees all resources. It also destroys all declared fields. | |
bool | AddField (FID fid, CField *pField) |
Declares a new field. | |
CField * | GetField (FID fid) const |
Gets a declared field by its identifier. | |
void | GetAllFields (Fields &fields) const |
Gets a list of all declared fields. | |
CFieldMap * | GetParentMap () |
Gets a field map of the parent class in the inheritance chain. | |
const CFieldMap * | GetParentMap () const |
Gets a field map of the parent class, const version. | |
void | InitHash () |
Initializes hash. |
Fields are stored in a table in the form of key-value. An integer identifier is the key and an object of CField is the value. If the number of the fields is more than 50, then it is recommended to initialize a hash in order to accelerate an access to the data of the object. The class, that derives from CDataObject, can have only one table. The key in the table must be unique and it can't be equal to Common::allFields (-1) or Common::fieldNotSpecified (-2). If there is an inheritance chain, identifiers can be the same in different classes, but within one class, they must be unique. For the field identifiers it is recommended to use enumerations. There are some advantages of enumerations:
1. Friendly named identifiers instead of numeric values.
2. Identifiers can be grouped in class, to which they relate
3. These enumerations can be easily used in field declarations.
4. The same enumerations can be used in columns of GUI::CGrid.
5. If enumerations are used, the application does not depend on numeric value changes.
CFiemdMap is responsible for the live time of CField objects that are destroyed in the destructor of CFiemdMap.
Constructor that is applied in the inheritance chain.
[in] | pParentMap | Field map of the base class in the inheritance chain from CDataObject |
bool AddField | ( | FID | fid, | |
CField * | pField | |||
) | [inline] |
Declares a new field.
If a field with the similar identifier is already inserted, the function raises a warning in the debug version of the application, that will permit to find the ambiguity.
[in] | fid | Numeric identifier. The identifier in the table must be unique and it can't be equal to Common::allFields (-1) or Common::fieldNotSpecified (-2); |
[in] | pField | Pointer to a new field. |
CField * GetField | ( | FID | fid | ) | const |
Gets a declared field by its identifier.
[in] | fid | Field identifier |
void GetAllFields | ( | Fields & | fields | ) | const |
Gets a list of all declared fields.
[in,out] | fields | List of declared fields. |
CFieldMap * GetParentMap | ( | ) |
Gets a field map of the parent class in the inheritance chain.
const CFieldMap * GetParentMap | ( | ) | const |
Gets a field map of the parent class, const version.
void InitHash | ( | ) |
Initializes hash.
Copyright Dapfor 2007-2009 | Generated on Wed Jul 7 03:24:43 2010 for MFCGrid by 1.5.5 |