00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef TA_DESCRIPTORLANGUAGE_H
00013 #define TA_DESCRIPTORLANGUAGE_H
00014
00015 #ifndef TA_TYPES_H
00016 #include "Types.h"
00017 #endif // TA_TYPES_H
00018
00019 #ifndef TA_STRING_H
00020 #include "String.h"
00021 #endif // TA_STRING_H
00022
00023 #ifndef TA_DEBUG_H
00024 #include "Debug.h"
00025 #endif // TA_DEBUG_H
00026
00027 #ifndef TA_MEMORYMGR_H
00028 #include "MemoryMgr.h"
00029 #endif // TA_MEMORYMGR_H
00030
00031 #ifndef TA_DESCRIPTORITEMNUMERIC_H
00032 #include "DescriptorItemNumeric.h"
00033 #endif // TA_DESCRIPTORITEMNUMERIC_H
00034
00035 #ifndef TA_DESCRIPTORITEMLIST_H
00036 #include "DescriptorItemList.h"
00037 #endif // TA_DESCRIPTORITEMLIST_H
00038
00039 namespace TA
00040 {
00041
00042 class Descriptor;
00043 class DescriptorItem;
00044 class DescriptorItemLabel;
00045
00046 class TACOMMON_CLASS DescriptorLanguage
00047 {
00048 public:
00049 DescriptorLanguage();
00050 virtual ~DescriptorLanguage();
00051
00052 void Initialise(const String& strName, const String& strFileName);
00053 void Finalise();
00054
00055 bool IsInitialised() const { return m_bIsInitialised; }
00056
00057 void InitialiseDescriptor(Descriptor& descriptor);
00058
00059 DescriptorItem* GetRootItem() { TA_ASSERT(m_pParent); TA_ASSERT((u32)m_pParent == (u32)m_pRoot); return m_pParent; }
00060
00061 void BeginDescGroup(const Char* szGroupName);
00062 void EndDescGroup();
00063
00064 void AddDescItem(
00065 const Char* szName,
00066 Descriptor* pDescriptor,
00067 String& strVar,
00068 const Char* szDefault,
00069 const Char* szDescription);
00070
00071 void AddDescItem(
00072 const Char* szName,
00073 void (*SetVar)(const String&, void* pData),
00074 const String& (*GetVar)(void* pData),
00075 const Char* szDefault,
00076 const Char* szDescription);
00077
00078 template <class Type>
00079 void AddDescItem(
00080 const Char* szName,
00081 Descriptor* pDescriptor,
00082 Type& var,
00083 Type defaultValue,
00084 Type min,
00085 Type max,
00086 const Char* szDescription)
00087 {
00088
00089 DescriptorItemNumericOfType<Type>* pItem;
00090 TA_MEMORY_MGR_NEW(pItem, DescriptorItemNumericOfType<Type>);
00091 pItem->Initialise(
00092 szName,
00093 pDescriptor,
00094 var,
00095 defaultValue,
00096 min,
00097 max,
00098 szDescription);
00099 TA_ASSERT(m_pParent);
00100 m_pParent->AddChild(pItem);
00101 }
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 void AddDescItem(
00128 const Char* szName,
00129 void (*SetVar)(float, void* pData),
00130 float (*GetVar)(void* pData),
00131 float defaultValue,
00132 float min,
00133 float max,
00134 const Char* szDescription);
00135
00136 void AddDescItem(
00137 const Char* szName,
00138 void (*SetVar)(int, void* pData),
00139 int (*GetVar)(void* pData),
00140 int defaultValue,
00141 int min,
00142 int max,
00143 const Char* szDescription);
00144
00145 template <class Type>
00146 void AddDescItem(
00147 const Char* szName,
00148 Descriptor* pDescriptor,
00149 DescriptorList<Type>& var,
00150 const Char* szDescription)
00151 {
00152
00153 DescriptorItemListOfType<Type>* pItem;
00154 TA_MEMORY_MGR_NEW(pItem, DescriptorItemListOfType<Type>);
00155 pItem->Initialise(
00156 szName,
00157 pDescriptor,
00158 var,
00159 szDescription);
00160 TA_ASSERT(m_pParent);
00161 m_pParent->AddChild(pItem);
00162 }
00163
00164
00165
00166 private:
00167 bool m_bIsInitialised;
00168 String m_strFileName;
00169 DescriptorItemLabel* m_pRoot;
00170 DescriptorItem* m_pParent;
00171
00172 void InitialiseDescriptorInternal(DescriptorItem* pRoot, Descriptor& descriptor);
00173 };
00174
00175 };
00176
00177
00178
00179
00180 #endif // TA_DESCRIPTORLANGUAGE_H
© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.