engineExports.cpp
Engine/source/console/engineExports.cpp
Public Functions
IMPLEMENT_NONINSTANTIABLE_CLASS(EngineExport , "Abstract base class of entities exported through the engine API." )
IMPLEMENT_NONINSTANTIABLE_CLASS(EngineExportScope , "A scope contained <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> collection of exported engine API entities." )
IMPLEMENT_SCOPE(ReflectionAPI , Reflection , "Metadata <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the exported engine API." )
Detailed Description
Public Functions
IMPLEMENT_NONINSTANTIABLE_CLASS(EngineExport , "Abstract base class of entities exported through the engine API." )
IMPLEMENT_NONINSTANTIABLE_CLASS(EngineExportScope , "A scope contained <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> collection of exported engine API entities." )
IMPLEMENT_SCOPE(ReflectionAPI , Reflection , "Metadata <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the exported engine API." )
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#include "console/engineExports.h" 25#include "console/engineTypeInfo.h" 26#include "console/engineAPI.h" 27 28 29IMPLEMENT_SCOPE( ReflectionAPI, Reflection,, 30 "Metadata for the exported engine API." ); 31 32IMPLEMENT_NONINSTANTIABLE_CLASS( EngineExport, 33 "Abstract base class of entities exported through the engine API." ) 34END_IMPLEMENT_CLASS; 35IMPLEMENT_NONINSTANTIABLE_CLASS( EngineExportScope, 36 "A scope contained <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> collection of exported engine API entities." ) 37END_IMPLEMENT_CLASS; 38 39EngineExportScope EngineExportScope::smGlobalScope; 40 41 42//----------------------------------------------------------------------------- 43 44EngineExport::EngineExport( const char* name, EngineExportKind kind, EngineExportScope* scope, const char* docString ) 45 : mExportName( name ), 46 mExportKind( kind ), 47 mExportScope( scope ), 48 mDocString( docString ), 49 mNextExport( NULL ) 50{ 51 AssertFatal( name != NULL, "EngineExport - export without name!" ); 52 AssertFatal( scope != NULL, avar( "EngineExport - export '%s' is in no scope" ) ); 53 54 // Link to scope's export chain. 55 56 mNextExport = scope->mExports; 57 scope->mExports = this; 58} 59 60//----------------------------------------------------------------------------- 61 62String EngineExport::getFullyQualifiedExportName() const 63{ 64 if( getExportScope() ) 65 { 66 String parentQualifiedName = getExportScope()->getFullyQualifiedExportName(); 67 if( parentQualifiedName.isEmpty() ) 68 return getExportName(); 69 70 return String::ToString( "%s::%s", parentQualifiedName.c_str(), getExportName() ); 71 } 72 73 return getExportName(); 74} 75 76//----------------------------------------------------------------------------- 77 78EngineExportScope::EngineExportScope( const char* name, EngineExportScope* scope, const char* docString ) 79 : SuperType( name, EngineExportKindScope, scope, docString ) 80{ 81 // Do *NOT* initialize mExports here. EngineExportScopes should be 82 // instantiated globally and by not initializing the field, we allow 83 // exports to link themselves to their scope without being order dependent 84 // on our constructor. 85} 86