My Project
|
an attribute class is a collection of attribute fields. More...
#include <AttributeClass.h>
Public Types | |
enum | Field_Order { Sort_ByName, Sort_ByCategory, Sort_ByInstallOrder } |
Public Member Functions | |
CAttributeClass (int nClassID, const char *sClassName, const char *sClassDescription) | |
void | AddField (const char *sFieldname, DWORD Type, void *offsetSetFunc, void *offsetGetFunc, const char *sSchematics, const char *sHelpString, bool bOverride) |
add a new field. More... | |
void | AddField_Deprecated (const char *fieldName, bool bOverride=true) |
use of deprecated field takes no effect and will output warning in the log. More... | |
bool | RemoveField (const char *sFieldname) |
remove a field, return true if moved. More... | |
void | RemoveAllFields () |
int | GetClassID () const |
class ID | |
const char * | GetClassName () const |
class name | |
const char * | GetClassDescription () const |
class description | |
void | SetOrder (Field_Order order) |
Set which order fields are saved. More... | |
Field_Order | GetOrder () |
get which order fields are saved. More... | |
int | GetFieldNum () |
get the total number of field. More... | |
CAttributeField * | GetField (int nIndex) |
get field at the specified index. More... | |
int | GetFieldIndex (const char *sFieldname) |
get field index of a given field name. More... | |
int | GetFieldIndex (const std::string &sFieldname) |
CAttributeField * | GetField (const char *sFieldname) |
return NULL, if the field does not exists | |
CAttributeField * | GetField (const std::string &sFieldname) |
virtual IAttributeFields * | Create () |
create an instance of this class object | |
Protected Attributes | |
int | m_nClassID |
const char * | m_sClassName |
const char * | m_sClassDescription |
vector< CAttributeField > | m_attributes |
Field_Order | m_nCurrentOrder |
bool | m_bSort |
an attribute class is a collection of attribute fields.
the same attribute class is shared by all instances of a given IAttributeField derived class. see also, CAttributesManager
void CAttributeClass::AddField | ( | const char * | sFieldname, |
DWORD | Type, | ||
void * | offsetSetFunc, | ||
void * | offsetGetFunc, | ||
const char * | sSchematics, | ||
const char * | sHelpString, | ||
bool | bOverride | ||
) |
add a new field.
sFieldname | field name |
Type | the field type. it may be one of the ATTRIBUTE_FIELDTYPE. |
offsetSetFunc | must be __stdcall function pointer or NULL. The function prototype should match that of the Type. |
offsetGetFunc | must be __stdcall function pointer or NULL. The function prototype should match that of the Type. |
sSchematics | a string or NULL. The string pattern should match that of the Type. |
sHelpString | a help string or NULL. |
bOverride | true to override existing field if any. This is usually set to true, so that inherited class can override the fields installed previously by the base class. |
void CAttributeClass::AddField_Deprecated | ( | const char * | fieldName, |
bool | bOverride = true |
||
) |
use of deprecated field takes no effect and will output warning in the log.
CAttributeField * CAttributeClass::GetField | ( | int | nIndex | ) |
get field at the specified index.
NULL will be returned if index is out of range.
int CAttributeClass::GetFieldIndex | ( | const char * | sFieldname | ) |
get field index of a given field name.
-1 will be returned if name not found.
sFieldname |
int CAttributeClass::GetFieldNum | ( | ) |
get the total number of field.
CAttributeClass::Field_Order CAttributeClass::GetOrder | ( | ) |
get which order fields are saved.
bool CAttributeClass::RemoveField | ( | const char * | sFieldname | ) |
remove a field, return true if moved.
false if field not found.
void CAttributeClass::SetOrder | ( | Field_Order | order | ) |
Set which order fields are saved.