VDataTable.h
Engine/source/Verve/Core/VDataTable.h
Classes:
class
Public Typedefs
VDataTableDataType
Public Functions
Detailed Description
Public Typedefs
typedef VDataTable::eDataType VDataTableDataType
Public Functions
DefineEnumType(VDataTableDataType )
1 2//----------------------------------------------------------------------------- 3// Verve 4// Copyright (C) 2014 - Violent Tulip 5// 6// Permission is hereby granted, free of charge, to any person obtaining a copy 7// of this software and associated documentation files (the "Software"), to 8// deal in the Software without restriction, including without limitation the 9// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10// sell copies of the Software, and to permit persons to whom the Software is 11// furnished to do so, subject to the following conditions: 12// 13// The above copyright notice and this permission notice shall be included in 14// all copies or substantial portions of the Software. 15// 16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22// IN THE SOFTWARE. 23//----------------------------------------------------------------------------- 24#ifndef _VT_VDATATABLE_H_ 25#define _VT_VDATATABLE_H_ 26 27#ifndef CORE_TDICTIONARY_H 28#include "core/util/tDictionary.h" 29#endif 30 31#ifndef _CONSOLE_H_ 32#include "console/console.h" 33#endif 34 35#ifndef _DYNAMIC_CONSOLETYPES_H_ 36#include "console/dynamicTypes.h" 37#endif 38 39#ifndef _STRINGTABLE_H_ 40#include "core/stringTable.h" 41#endif 42 43//----------------------------------------------------------------------------- 44 45class VDataTable 46{ 47public: 48 49 enum eDataType 50 { 51 k_TypeExpression, 52 k_TypeStatic, 53 k_TypeVariable, 54 55 k_TypeInvalid, 56 }; 57 58 struct sDataItem 59 { 60 eDataType Type; 61 String FieldName; 62 63 sDataItem( void ) : 64 Type( k_TypeInvalid ), 65 FieldName( String::EmptyString ) 66 { 67 // Void. 68 }; 69 70 sDataItem( eDataType pType, const String &pFieldName ) : 71 Type( pType ), 72 FieldName( pFieldName ) 73 { 74 // Void. 75 }; 76 }; 77 78 // Enum Lookup. 79 static VDataTable::eDataType getDataTypeEnum( const char *pLabel ); 80 static const char *getDataTypeDescription( const VDataTable::eDataType pEnum ); 81 82 // Map Type. 83 typedef Map<String, sDataItem> VDataMap; 84 85public: 86 87 VDataMap mDataMap; 88 89public: 90 91 VDataTable( void ); 92 ~VDataTable( void ); 93 94 // Data. 95 96 void insert( eDataType pType, const String &pFieldName ); 97 void clear( const String &pFieldName ); 98 void clear( void ); 99 100 // Reference. 101 102 S32 getCount( void ); 103 bool getItem( const S32 &pIndex, sDataItem *pDataItem = NULL ); 104 bool getItem( const String &pFieldName, sDataItem *pDataItem = NULL ); 105 106 bool getValue( SimObject *pObject, const String &pFieldName, String &pValue ); 107}; 108 109//----------------------------------------------------------------------------- 110 111// Define Types. 112typedef VDataTable::eDataType VDataTableDataType; 113 114// Declare Enum Types. 115DefineEnumType( VDataTableDataType ); 116 117//----------------------------------------------------------------------------- 118 119#endif // _VT_VDATATABLE_H_ 120