My Project
Public Types | Public Member Functions | Protected Attributes | List of all members
ParaEngine::CAttributeClass Class Reference

an attribute class is a collection of attribute fields. More...

#include <AttributeClass.h>

Inheritance diagram for ParaEngine::CAttributeClass:
ParaEngine::CAttributeClassImp< T >

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...
 
CAttributeFieldGetField (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)
 
CAttributeFieldGetField (const char *sFieldname)
 return NULL, if the field does not exists
 
CAttributeFieldGetField (const std::string &sFieldname)
 
virtual IAttributeFieldsCreate ()
 create an instance of this class object
 

Protected Attributes

int m_nClassID
 
const char * m_sClassName
 
const char * m_sClassDescription
 
vector< CAttributeFieldm_attributes
 
Field_Order m_nCurrentOrder
 
bool m_bSort
 

Detailed Description

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

Member Function Documentation

§ AddField()

void CAttributeClass::AddField ( const char *  sFieldname,
DWORD  Type,
void *  offsetSetFunc,
void *  offsetGetFunc,
const char *  sSchematics,
const char *  sHelpString,
bool  bOverride 
)

add a new field.

Parameters
sFieldnamefield name
Typethe field type. it may be one of the ATTRIBUTE_FIELDTYPE.
offsetSetFuncmust be __stdcall function pointer or NULL. The function prototype should match that of the Type.
offsetGetFuncmust be __stdcall function pointer or NULL. The function prototype should match that of the Type.
sSchematicsa string or NULL. The string pattern should match that of the Type.
sHelpStringa help string or NULL.
bOverridetrue 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.

§ AddField_Deprecated()

void CAttributeClass::AddField_Deprecated ( const char *  fieldName,
bool  bOverride = true 
)

use of deprecated field takes no effect and will output warning in the log.

§ GetField()

CAttributeField * CAttributeClass::GetField ( int  nIndex)

get field at the specified index.

NULL will be returned if index is out of range.

§ GetFieldIndex()

int CAttributeClass::GetFieldIndex ( const char *  sFieldname)

get field index of a given field name.

-1 will be returned if name not found.

Parameters
sFieldname
Returns

§ GetFieldNum()

int CAttributeClass::GetFieldNum ( )

get the total number of field.

§ GetOrder()

CAttributeClass::Field_Order CAttributeClass::GetOrder ( )

get which order fields are saved.

§ RemoveField()

bool CAttributeClass::RemoveField ( const char *  sFieldname)

remove a field, return true if moved.

false if field not found.

§ SetOrder()

void CAttributeClass::SetOrder ( Field_Order  order)

Set which order fields are saved.


The documentation for this class was generated from the following files: