CppAsset.h
Engine/source/T3D/assets/CppAsset.h
Classes:
class
Public Functions
DefineConsoleType(TypeCppAssetPtr , CppAsset )
Detailed Description
Public Functions
DefineConsoleType(TypeCppAssetPtr , CppAsset )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2013 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#ifndef CPP_ASSET_H 24#define CPP_ASSET_H 25#pragma once 26 27#ifndef _ASSET_BASE_H_ 28#include "assets/assetBase.h" 29#endif 30 31#ifndef _ASSET_DEFINITION_H_ 32#include "assets/assetDefinition.h" 33#endif 34 35#ifndef _STRINGUNIT_H_ 36#include "string/stringUnit.h" 37#endif 38 39#ifndef _ASSET_FIELD_TYPES_H_ 40#include "assets/assetFieldTypes.h" 41#endif 42 43//----------------------------------------------------------------------------- 44class CppAsset : public AssetBase 45{ 46 typedef AssetBase Parent; 47 48 StringTableEntry mCodeFile; 49 StringTableEntry mCodePath; 50 StringTableEntry mHeaderFile; 51 StringTableEntry mHeaderPath; 52 53public: 54 CppAsset(); 55 virtual ~CppAsset(); 56 57 /// Engine. 58 static void initPersistFields(); 59 virtual void copyTo(SimObject* object); 60 61 /// Declare Console Object. 62 DECLARE_CONOBJECT(CppAsset); 63 64 void setCppFile(const char* pCppFile); 65 inline StringTableEntry getCppFile(void) const { return mCodeFile; }; 66 67 void setHeaderFile(const char* pHeaderFile); 68 inline StringTableEntry getHeaderFile(void) const { return mHeaderFile; }; 69 70protected: 71 virtual void initializeAsset(void); 72 virtual void onAssetRefresh(void); 73 74 static bool setCppFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setCppFile(data); return false; } 75 static const char* getCppFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getCppFile(); } 76 77 inline StringTableEntry getCppFilePath(void) const { return mCodePath; }; 78 inline StringTableEntry getHeaderFilePath(void) const { return mHeaderPath; }; 79 80 static bool setHeaderFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setHeaderFile(data); return false; } 81 static const char* getHeaderFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getHeaderFile(); } 82}; 83 84DefineConsoleType(TypeCppAssetPtr, CppAsset) 85 86#endif // _ASSET_BASE_H_ 87 88