|
@@ -48,7 +48,7 @@
|
|
|
#include "console/simObjectRef.h"
|
|
|
#endif
|
|
|
#ifndef TINYXML_INCLUDED
|
|
|
- #include "tinyXML/tinyxml.h"
|
|
|
+ #include "tinyxml.h"
|
|
|
#endif
|
|
|
|
|
|
/// @file
|
|
@@ -212,7 +212,7 @@ public:
|
|
|
///
|
|
|
/// @param conIdPtr Pointer to the static S32 console ID.
|
|
|
/// @param conTypeName Console type name.
|
|
|
- AbstractClassRep( S32* conIdPtr, const char* typeName )
|
|
|
+ AbstractClassRep( S32* conIdPtr, const char* typeName )
|
|
|
: Parent( sizeof( void* ), conIdPtr, typeName )
|
|
|
{
|
|
|
VECTOR_SET_ASSOCIATION( mFieldList );
|
|
@@ -323,13 +323,13 @@ public:
|
|
|
|
|
|
/// Return the namespace that contains the methods of this class.
|
|
|
Namespace* getNameSpace() const { return mNamespace; }
|
|
|
-
|
|
|
+
|
|
|
/// Return the AbstractClassRep of the class that this class is derived from.
|
|
|
AbstractClassRep* getParentClass() const { return parentClass; }
|
|
|
|
|
|
virtual AbstractClassRep* getContainerChildClass(const bool recurse) = 0;
|
|
|
virtual WriteCustomTamlSchema getCustomTamlSchema(void) = 0;
|
|
|
-
|
|
|
+
|
|
|
/// Return the size of instances of this class in bytes.
|
|
|
S32 getSizeof() const { return mClassSizeof; }
|
|
|
|
|
@@ -396,7 +396,7 @@ protected:
|
|
|
Namespace * mNamespace;
|
|
|
|
|
|
/// @}
|
|
|
-
|
|
|
+
|
|
|
public:
|
|
|
|
|
|
bool mIsRenderEnabled;
|
|
@@ -404,23 +404,23 @@ public:
|
|
|
|
|
|
bool isRenderEnabled() const { return mIsRenderEnabled; }
|
|
|
bool isSelectionEnabled() const { return mIsSelectionEnabled; }
|
|
|
-
|
|
|
+
|
|
|
/// @name Categories
|
|
|
/// @{
|
|
|
-
|
|
|
+
|
|
|
protected:
|
|
|
|
|
|
const char* mCategory;
|
|
|
const char* mDescription;
|
|
|
-
|
|
|
+
|
|
|
public:
|
|
|
|
|
|
/// Return the space separated category path for the class.
|
|
|
const char* getCategory() const { return mCategory; }
|
|
|
-
|
|
|
+
|
|
|
/// Return a short description string suitable for displaying in tooltips.
|
|
|
const char* getDescription() const { return mDescription; }
|
|
|
-
|
|
|
+
|
|
|
/// @}
|
|
|
|
|
|
/// @name Fields
|
|
@@ -434,16 +434,12 @@ public:
|
|
|
/// This is a function pointer typedef to support optional writing for fields.
|
|
|
typedef bool(*WriteDataNotify)(void* obj, StringTableEntry pFieldName);
|
|
|
|
|
|
- /// Allows the writing of a custom TAML schema.
|
|
|
- typedef void(*WriteCustomTamlSchema)(const AbstractClassRep* pClassRep, TiXmlElement* pParentElement);
|
|
|
-
|
|
|
-
|
|
|
/// These are special field type values used to mark
|
|
|
/// groups and arrays in the field list.
|
|
|
/// @see Field::type
|
|
|
/// @see addArray, endArray
|
|
|
- /// @see addGroup, endGroup
|
|
|
- /// @see addGroup, endGroup
|
|
|
+ /// @see addGroup, endGroup
|
|
|
+ /// @see addGroup, endGroup
|
|
|
/// @see addDeprecatedField
|
|
|
enum ACRFieldTypes
|
|
|
{
|
|
@@ -451,35 +447,35 @@ public:
|
|
|
/// types greater or equal to this one are not
|
|
|
/// console data types.
|
|
|
ARCFirstCustomField = 0xFFFFFFFB,
|
|
|
-
|
|
|
+
|
|
|
/// Marks the start of a fixed size array of fields.
|
|
|
/// @see addArray
|
|
|
StartArrayFieldType = 0xFFFFFFFB,
|
|
|
-
|
|
|
+
|
|
|
/// Marks the end of a fixed size array of fields.
|
|
|
/// @see endArray
|
|
|
EndArrayFieldType = 0xFFFFFFFC,
|
|
|
-
|
|
|
+
|
|
|
/// Marks the beginning of a group of fields.
|
|
|
/// @see addGroup
|
|
|
StartGroupFieldType = 0xFFFFFFFD,
|
|
|
-
|
|
|
+
|
|
|
/// Marks the beginning of a group of fields.
|
|
|
/// @see endGroup
|
|
|
EndGroupFieldType = 0xFFFFFFFE,
|
|
|
-
|
|
|
- /// Marks a field that is depreciated and no
|
|
|
+
|
|
|
+ /// Marks a field that is depreciated and no
|
|
|
/// longer stores a value.
|
|
|
/// @see addDeprecatedField
|
|
|
DeprecatedFieldType = 0xFFFFFFFF
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
enum FieldFlags
|
|
|
{
|
|
|
FIELD_HideInInspectors = BIT( 0 ), ///< Do not show the field in inspectors.
|
|
|
};
|
|
|
|
|
|
- struct Field
|
|
|
+ struct Field
|
|
|
{
|
|
|
Field()
|
|
|
: pFieldname( NULL ),
|
|
@@ -525,10 +521,10 @@ public:
|
|
|
|
|
|
/// @name Console Type Interface
|
|
|
/// @{
|
|
|
-
|
|
|
+
|
|
|
virtual void* getNativeVariable() { return new ( AbstractClassRep* ); } // Any pointer-sized allocation will do.
|
|
|
virtual void deleteNativeVariable( void* var ) { delete reinterpret_cast< AbstractClassRep** >( var ); }
|
|
|
-
|
|
|
+
|
|
|
/// @}
|
|
|
|
|
|
/// @name Abstract Class Database
|
|
@@ -574,10 +570,10 @@ template< class T >
|
|
|
class ConcreteClassRep : public AbstractClassRep
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
+
|
|
|
static EnginePropertyTable _smPropertyTable;
|
|
|
static EnginePropertyTable& smPropertyTable;
|
|
|
-
|
|
|
+
|
|
|
ConcreteClassRep( const char* name,
|
|
|
const char* conTypeName,
|
|
|
S32* conTypeIdPtr,
|
|
@@ -591,10 +587,10 @@ class ConcreteClassRep : public AbstractClassRep
|
|
|
mClassName = StringTable->insert( name );
|
|
|
mCategory = T::__category();
|
|
|
mTypeInfo = _MAPTYPE< T >();
|
|
|
-
|
|
|
+
|
|
|
if( mTypeInfo )
|
|
|
const_cast< EngineTypeInfo* >( mTypeInfo )->mPropertyTable = &smPropertyTable;
|
|
|
-
|
|
|
+
|
|
|
if( &T::__description != parentDesc )
|
|
|
mDescription = T::__description();
|
|
|
|
|
@@ -642,7 +638,7 @@ class ConcreteClassRep : public AbstractClassRep
|
|
|
// Get handle to our parent class, if any, and ourselves (we are our parent's child).
|
|
|
AbstractClassRep *parent = T::getParentStaticClassRep();
|
|
|
AbstractClassRep *child = T::getStaticClassRep();
|
|
|
-
|
|
|
+
|
|
|
// If we got reps, then link those namespaces! (To get proper inheritance.)
|
|
|
if(parent && child)
|
|
|
Con::classLinkNamespaces(parent->getNameSpace(), child->getNameSpace());
|
|
@@ -657,7 +653,7 @@ class ConcreteClassRep : public AbstractClassRep
|
|
|
|
|
|
/// Wrap constructor.
|
|
|
ConsoleObject* create() const { return new T; }
|
|
|
-
|
|
|
+
|
|
|
/// @name Console Type Interface
|
|
|
/// @{
|
|
|
|
|
@@ -671,16 +667,16 @@ class ConcreteClassRep : public AbstractClassRep
|
|
|
else
|
|
|
Con::errorf( "Cannot set multiple args to a single ConsoleObject*.");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
virtual const char* getData( void* dptr, const EnumTable* tbl, BitSet32 flag )
|
|
|
{
|
|
|
T** obj = ( T** ) dptr;
|
|
|
return Con::getReturnBuffer( T::__getObjectId( *obj ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
virtual const char* getTypeClassName() { return mClassName; }
|
|
|
virtual const bool isDatablock() { return T::__smIsDatablock; };
|
|
|
-
|
|
|
+
|
|
|
/// @}
|
|
|
};
|
|
|
|
|
@@ -751,7 +747,7 @@ bool defaultProtectedWriteFn(void* obj, StringTableEntry pFieldName);
|
|
|
class ConsoleObject : public EngineObject
|
|
|
{
|
|
|
DECLARE_ABSTRACT_CLASS( ConsoleObject, EngineObject );
|
|
|
-
|
|
|
+
|
|
|
protected:
|
|
|
|
|
|
/// @deprecated This is disallowed.
|
|
@@ -760,7 +756,7 @@ protected:
|
|
|
public:
|
|
|
|
|
|
ConsoleObject() {}
|
|
|
-
|
|
|
+
|
|
|
/// Get a reference to a field by name.
|
|
|
const AbstractClassRep::Field *findField(StringTableEntry fieldName) const;
|
|
|
|
|
@@ -769,7 +765,7 @@ public:
|
|
|
|
|
|
/// Set the value of a field.
|
|
|
bool setField(const char *fieldName, const char *value);
|
|
|
-
|
|
|
+
|
|
|
public:
|
|
|
|
|
|
/// @name Object Creation
|
|
@@ -799,11 +795,11 @@ public:
|
|
|
static void endGroup(const char* in_pGroupname);
|
|
|
|
|
|
/// Marks the start of a fixed size array of fields.
|
|
|
- /// @see console_autodoc
|
|
|
+ /// @see console_autodoc
|
|
|
static void addArray( const char *arrayName, S32 count );
|
|
|
|
|
|
/// Marks the end of an array of fields.
|
|
|
- /// @see console_autodoc
|
|
|
+ /// @see console_autodoc
|
|
|
static void endArray( const char *arrayName );
|
|
|
|
|
|
/// Register a complex field.
|
|
@@ -928,16 +924,16 @@ public:
|
|
|
static bool removeField(const char* in_pFieldname);
|
|
|
|
|
|
/// @}
|
|
|
-
|
|
|
+
|
|
|
/// @name Logging
|
|
|
/// @{
|
|
|
-
|
|
|
+
|
|
|
/// Overload this in subclasses to change the message formatting.
|
|
|
/// @param fmt A printf style format string.
|
|
|
/// @param args A va_list containing the args passed ot a log function.
|
|
|
/// @note It is suggested that you use String::VToString.
|
|
|
virtual String _getLogMessage(const char* fmt, va_list args) const;
|
|
|
-
|
|
|
+
|
|
|
/// @}
|
|
|
|
|
|
public:
|
|
@@ -946,16 +942,16 @@ public:
|
|
|
/// These functions will try to print out a message along the lines
|
|
|
/// of "ObjectClass - ObjectName(ObjectId) - formatted message"
|
|
|
/// @{
|
|
|
-
|
|
|
+
|
|
|
/// Logs with Con::printf.
|
|
|
void logMessage(const char* fmt, ...) const;
|
|
|
-
|
|
|
+
|
|
|
/// Logs with Con::warnf.
|
|
|
void logWarning(const char* fmt, ...) const;
|
|
|
-
|
|
|
+
|
|
|
/// Logs with Con::errorf.
|
|
|
void logError(const char* fmt, ...) const;
|
|
|
-
|
|
|
+
|
|
|
/// @}
|
|
|
|
|
|
/// Register dynamic fields in a subclass of ConsoleObject.
|
|
@@ -1016,16 +1012,16 @@ public:
|
|
|
|
|
|
static const char* __category() { return ""; }
|
|
|
static const char* __description() { return ""; }
|
|
|
-
|
|
|
+
|
|
|
/// Subclasses of ConsoleObjects that are datablocks should redefine this static member variable
|
|
|
/// and set it to true.
|
|
|
static const bool __smIsDatablock = false;
|
|
|
-
|
|
|
+
|
|
|
/// @name Object IDs and lookup.
|
|
|
/// For a subclass hierarchy based on ConsoleObject to become functional for use as a console object type,
|
|
|
/// the hierarchy must implement a naming scheme and indexing function for looking up objects by name.
|
|
|
/// @{
|
|
|
-
|
|
|
+
|
|
|
static ConsoleObject* __findObject( const char* ) { return NULL; }
|
|
|
static const char* __getObjectId( ConsoleObject* ) { return ""; }
|
|
|
};
|
|
@@ -1120,11 +1116,11 @@ inline bool& ConsoleObject::getDynamicGroupExpand()
|
|
|
static SimObjectRefConsoleBaseType< className > ptrRefType; \
|
|
|
static AbstractClassRep::WriteCustomTamlSchema getStaticWriteCustomTamlSchema(); \
|
|
|
static AbstractClassRep* getContainerChildStaticClassRep(); \
|
|
|
- virtual AbstractClassRep* getClassRep() const
|
|
|
-
|
|
|
+ virtual AbstractClassRep* getClassRep() const
|
|
|
+
|
|
|
#define DECLARE_CATEGORY( string ) \
|
|
|
static const char* __category() { return string; }
|
|
|
-
|
|
|
+
|
|
|
#define DECLARE_DESCRIPTION( string ) \
|
|
|
static const char* __description() { return string; }
|
|
|
|
|
@@ -1199,7 +1195,7 @@ inline bool& ConsoleObject::getDynamicGroupExpand()
|
|
|
AbstractClassRep* className::getContainerChildStaticClassRep() { return NULL; } \
|
|
|
AbstractClassRep::WriteCustomTamlSchema className::getStaticWriteCustomTamlSchema() { return NULL; } \
|
|
|
ConcreteClassRep<className> className::dynClassRep(#className, "Type" #className, &_smTypeId, NetClassGroupGameMask, NetClassTypeDataBlock, 0, className::getParentStaticClassRep(), &Parent::__description )
|
|
|
-
|
|
|
+
|
|
|
// Support for adding properties to classes CONOBJECT style.
|
|
|
#define PROPERTY_TABLE( className ) \
|
|
|
namespace { namespace _ ## className { \
|
|
@@ -1209,13 +1205,13 @@ inline bool& ConsoleObject::getDynamicGroupExpand()
|
|
|
ConcreteClassRep< className >::smPropertyTable = _ ## className::_propTable; \
|
|
|
namespace { namespace _ ## className { \
|
|
|
EnginePropertyTable::Property _props[] = {
|
|
|
-
|
|
|
+
|
|
|
#define END_PROPERTY_TABLE \
|
|
|
{ NULL } \
|
|
|
}; \
|
|
|
EnginePropertyTable _propTable( sizeof( _props ) / sizeof( _props[ 0 ] ) - 1, _props ); \
|
|
|
} }
|
|
|
-
|
|
|
+
|
|
|
/// Add an auto-doc for a class.
|
|
|
#define ConsoleDocClass( className, docString ) \
|
|
|
CLASSDOC( className, docString )
|
|
@@ -1225,7 +1221,7 @@ inline bool& ConsoleObject::getDynamicGroupExpand()
|
|
|
//------------------------------------------------------------------------------
|
|
|
// Protected field default get/set functions
|
|
|
//
|
|
|
-// The reason for these functions is that it will save one branch per console
|
|
|
+// The reason for these functions is that it will save one branch per console
|
|
|
// data request and script functions will still execute at the same speed as
|
|
|
// before the modifications to allow protected static fields. These will just
|
|
|
// inline and the code should be roughly the same size, and just as fast as
|