fieldBrushObject.h
Engine/source/console/fieldBrushObject.h
Classes:
class
FieldBrushObject for static-field copying/pasting.
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _FIELDBRUSHOBJECT_H_ 25#define _FIELDBRUSHOBJECT_H_ 26 27#ifndef _SIM_H_ 28 #include "console/simObject.h" 29#endif 30#ifndef _SIMFIELDDICTIONARY_H_ 31 #include "console/simFieldDictionary.h" 32#endif 33#ifndef _CONSOLEINTERNAL_H_ 34 #include "console/consoleInternal.h" 35#endif 36#ifndef _TDICTIONARY_H_ 37 #include "core/util/tDictionary.h" 38#endif 39 40 41//----------------------------------------------------------------------------- 42// Field Brush Object. 43//----------------------------------------------------------------------------- 44 45/// FieldBrushObject for static-field copying/pasting. 46/// 47class FieldBrushObject : public SimObject 48{ 49private: 50 typedef SimObject Parent; 51 52 // Destroy Fields. 53 void destroyFields( void ); 54 55 StringTableEntry mDescription; ///< Description. 56 StringTableEntry mSortName; ///< Sort Name. 57 58public: 59 FieldBrushObject(); 60 61 void copyFields( SimObject* pSimObject, const char* fieldList ); 62 void pasteFields( SimObject* pSimObject ); 63 64 static bool setDescription( void *object, const char *index, const char *data ) 65 { static_cast<FieldBrushObject*>(object)->setDescription(data); return false; }; 66 void setDescription( const char* description ) { mDescription = StringTable->insert(description); } 67 StringTableEntry getDescription(void) const { return mDescription; } 68 69 static bool setSortName( void *object, const char *index, const char *data ) 70 { static_cast<FieldBrushObject*>(object)->setSortName(data); return false; }; 71 void setSortName( const char* sortName ) { mSortName = StringTable->insert(sortName); } 72 StringTableEntry getSortName(void) const { return mSortName; } 73 74 static void initPersistFields(); ///< Persist Fields. 75 virtual void onRemove(); ///< Called when the object is removed from the sim. 76 77 DECLARE_CONOBJECT(FieldBrushObject); 78}; 79 80#endif 81