diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index 105b2f1ef3..58d69fef08 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -318,6 +318,10 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); } DECLARE_ENUM( type ); \ DefineConsoleType( Type ## type, type ); +#define DefineEnumType_R( type ) \ + DECLARE_ENUM_R( type ); \ + DefineConsoleType( Type ## type, type ); + #define _ConsoleEnumType( typeName, type, nativeType ) \ S32 type; \ ImplementConsoleTypeCasters( type, nativeType ) \ @@ -347,6 +351,10 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); } DECLARE_BITFIELD( type ); \ DefineConsoleType( Type ## type, type ); +#define DefineBitfieldType_R( type ) \ + DECLARE_BITFIELD_R( type ); \ + DefineConsoleType( Type ## type, type ); + #define _ConsoleBitfieldType( typeName, type, nativeType ) \ S32 type; \ ImplementConsoleTypeCasters( type, nativeType ) \ diff --git a/Engine/source/console/enginePrimitives.h b/Engine/source/console/enginePrimitives.h index e37fcfa4a5..72f1899e74 100644 --- a/Engine/source/console/enginePrimitives.h +++ b/Engine/source/console/enginePrimitives.h @@ -34,14 +34,14 @@ -DECLARE_PRIMITIVE( bool ); -DECLARE_PRIMITIVE( S8 ); -DECLARE_PRIMITIVE( U8 ); -DECLARE_PRIMITIVE( S32 ); -DECLARE_PRIMITIVE( U32 ); -DECLARE_PRIMITIVE( F32 ); -DECLARE_PRIMITIVE( F64 ); -DECLARE_PRIMITIVE( void* ); +DECLARE_PRIMITIVE_R( bool ); +DECLARE_PRIMITIVE_R(S8); +DECLARE_PRIMITIVE_R(U8); +DECLARE_PRIMITIVE_R(S32); +DECLARE_PRIMITIVE_R(U32); +DECLARE_PRIMITIVE_R(F32); +DECLARE_PRIMITIVE_R(F64); +DECLARE_PRIMITIVE_R(void*); //FIXME: this allows String to be used as a struct field type @@ -52,7 +52,7 @@ DECLARE_PRIMITIVE( void* ); // are considered to be owned by the API layer itself. The rule here is that such // a string is only valid until the next API call is made. Usually, control layers // will immediately copy and convert strings to their own string type. -_DECLARE_TYPE( String ); +_DECLARE_TYPE_R(String); template<> struct EngineTypeTraits< String > : public _EnginePrimitiveTypeTraits< String > { diff --git a/Engine/source/console/engineStructs.h b/Engine/source/console/engineStructs.h index c77530af16..00ea098ee6 100644 --- a/Engine/source/console/engineStructs.h +++ b/Engine/source/console/engineStructs.h @@ -41,11 +41,11 @@ class ColorI; class ColorF; -DECLARE_STRUCT( Vector< bool > ); -DECLARE_STRUCT( Vector< S32 > ); -DECLARE_STRUCT( Vector< F32 > ); -DECLARE_STRUCT( Torque::UUID ); -DECLARE_STRUCT( ColorI ); -DECLARE_STRUCT( ColorF ); +DECLARE_STRUCT_R(Vector< bool >); +DECLARE_STRUCT_R(Vector< S32 >); +DECLARE_STRUCT_R(Vector< F32 >); +DECLARE_STRUCT_R(Torque::UUID); +DECLARE_STRUCT_R(ColorI); +DECLARE_STRUCT_R(ColorF); #endif // !_ENGINESTRUCTS_H_ diff --git a/Engine/source/console/engineTypeInfo.h b/Engine/source/console/engineTypeInfo.h index 01ca40a769..88d78eed75 100644 --- a/Engine/source/console/engineTypeInfo.h +++ b/Engine/source/console/engineTypeInfo.h @@ -44,7 +44,7 @@ enum EngineTypeKind EngineTypeKindClass ///< Pointer to opaque EngineObject. }; -DECLARE_ENUM( EngineTypeKind ); +DECLARE_ENUM_R( EngineTypeKind ); /// Flags for an EngineTypeInfo. enum EngineTypeFlags diff --git a/Engine/source/console/engineTypes.h b/Engine/source/console/engineTypes.h index 400a05b502..482a097a61 100644 --- a/Engine/source/console/engineTypes.h +++ b/Engine/source/console/engineTypes.h @@ -416,6 +416,16 @@ namespace _Private { #define _DECLARE_TYPE( type ) \ + template<> const EngineTypeInfo* TYPE< type >(); \ + template<> struct _SCOPE< type > { \ + EngineExportScope& operator()() const { \ + return *static_cast< EngineExportScope* >( \ + const_cast< EngineTypeInfo* >( ( TYPE< type >() ) ) \ + ); \ + } \ + }; + +#define _DECLARE_TYPE_R( type ) \ template<> const EngineTypeInfo* TYPE< type >(); \ template<> struct _SCOPE< type > { \ EngineExportScope& operator()() const { \ @@ -432,22 +442,42 @@ namespace _Private { _DECLARE_TYPE( type ) \ template<> \ struct EngineTypeTraits< type > : public _EnginePrimitiveTypeTraits< type > {}; + +#define _DECLARE_PRIMITIVE_R( type ) \ + _DECLARE_TYPE_R( type ) \ + template<> \ + struct EngineTypeTraits< type > : public _EnginePrimitiveTypeTraits< type > {}; #define _DECLARE_ENUM( type ) \ _DECLARE_TYPE( type ) \ template<> \ struct _EngineTypeTraits< type > : public _EngineEnumTypeTraits< type > {}; - + +#define _DECLARE_ENUM_R( type ) \ + _DECLARE_TYPE_R( type ) \ + template<> \ + struct _EngineTypeTraits< type > : public _EngineEnumTypeTraits< type > {}; + #define _DECLARE_BITFIELD( type ) \ _DECLARE_TYPE( type ) \ template<> \ struct _EngineTypeTraits< type > : public _EngineBitfieldTypeTraits< type > {}; +#define _DECLARE_BITFIELD_R( type ) \ + _DECLARE_TYPE_R( type ) \ + template<> \ + struct _EngineTypeTraits< type > : public _EngineBitfieldTypeTraits< type > {}; + + #define _DECLARE_STRUCT( type ) \ _DECLARE_TYPE( type ) \ template<> \ struct _EngineTypeTraits< type > : public _EngineStructTypeTraits< type > {}; +#define _DECLARE_STRUCT_R( type ) \ + _DECLARE_TYPE_R( type ) \ + template<> \ + struct _EngineTypeTraits< type > : public _EngineStructTypeTraits< type > {}; #define _IMPLEMENT_TYPE( type, exportName ) \ template<> \ @@ -524,6 +554,10 @@ namespace _Private { #define DECLARE_PRIMITIVE( type ) \ _DECLARE_PRIMITIVE( type ) +/// +#define DECLARE_PRIMITIVE_R( type ) \ + _DECLARE_PRIMITIVE_R( type ) + /// #define IMPLEMENT_PRIMITIVE( type, exportName, scope, doc ) \ _IMPLEMENT_PRIMITIVE( type, exportName, scope, doc ) @@ -531,11 +565,19 @@ namespace _Private { /// #define DECLARE_ENUM( type ) \ _DECLARE_ENUM( type ) + +/// +#define DECLARE_ENUM_R( type ) \ + _DECLARE_ENUM_R( type ) /// #define DECLARE_BITFIELD( type ) \ _DECLARE_BITFIELD( type ) +/// +#define DECLARE_BITFIELD_R( type ) \ + _DECLARE_BITFIELD_R( type ) + /// #define IMPLEMENT_ENUM( type, exportName, scope, doc ) \ _IMPLEMENT_ENUM( type, exportName, scope, doc ) @@ -556,6 +598,10 @@ namespace _Private { #define DECLARE_STRUCT( type ) \ _DECLARE_STRUCT( type ) +/// +#define DECLARE_STRUCT_R( type ) \ + _DECLARE_STRUCT_R( type ) + /// #define IMPLEMENT_STRUCT( type, exportName, scope, doc ) \ _IMPLEMENT_STRUCT( type, exportName, scope, doc )