Expand EngineAPI type definitions

This commit is contained in:
Lukas Joergensen 2019-08-03 12:39:41 +02:00 committed by Lukas Aldershaab
parent f5f0eb2bb4
commit a241d27b58
13 changed files with 284 additions and 36 deletions

View file

@ -29,6 +29,8 @@
#include "platform/platform.h"
#endif
#include <algorithm>
#include "console/engineTypes.h"
#include "console/engineTypeInfo.h"
//-----------------------------------------------------------------------------
// Helper definitions for the vector class.
@ -63,6 +65,7 @@ extern bool VectorResize(U32 *aSize, U32 *aCount, void **arrayPtr, U32 newCount,
template<class T>
class Vector
{
friend class VectorFieldEngineExport;
protected:
U32 mElementCount; ///< Number of elements currently in the Vector.
U32 mArraySize; ///< Number of elements allocated for the Vector.
@ -188,6 +191,29 @@ class Vector
/// @}
};
class VectorFieldEngineExport
{
public:
template <class T>
static EngineFieldTable::Field getElementCountField()
{
typedef Vector<T> ThisType;
return _FIELD(mElementCount, elementCount, 1, "");
};
template <class T>
static EngineFieldTable::Field getArraySizeField()
{
typedef Vector<T> ThisType;
return _FIELD(mArraySize, arraySize, 1, "");
};
template <class T>
static EngineFieldTable::Field getArrayField()
{
typedef Vector<T> ThisType;
return _FIELD(mArray, array, 1, "");
};
};
template<class T> inline Vector<T>::~Vector()
{
clear();
@ -966,7 +992,7 @@ public:
};
// Include vector specializations
#ifndef _VECTORSPEC_H_
#ifndef _TVECTORSPEC_H_
#include "core/util/tVectorSpecializations.h"
#endif

View file

@ -68,6 +68,7 @@
#include <ctype.h>
#include "core/util/md5.h"
#include "console/enginePrimitives.h"
#if defined (TORQUE_OS_MAC) && defined(TORQUE_CPU_X64)
typedef unsigned int unsigned32;
@ -451,3 +452,42 @@ namespace Torque
return ( a + b + c + d + e + f[ 0 ] + f[ 1 ] + f[ 2 ] + f[ 3 ] + f[ 4 ] + f[ 5 ] );
}
}
EngineFieldTable::Field Torque::UUIDEngineExport::getAField()
{
typedef UUID ThisType;
return _FIELD(a, a, 1, "");
}
EngineFieldTable::Field Torque::UUIDEngineExport::getBField()
{
typedef UUID ThisType;
return _FIELD(b, b, 1, "");
}
EngineFieldTable::Field Torque::UUIDEngineExport::getCField()
{
typedef UUID ThisType;
return _FIELD(c, c, 1, "");
}
EngineFieldTable::Field Torque::UUIDEngineExport::getDField()
{
typedef UUID ThisType;
return _FIELD(d, d, 1, "");
}
EngineFieldTable::Field Torque::UUIDEngineExport::getEField()
{
typedef UUID ThisType;
return _FIELD(e, e, 1, "");
}
EngineFieldTable::Field Torque::UUIDEngineExport::getFField()
{
typedef UUID ThisType;
return _FIELD_AS(U8, f, f, 6, "");
}

View file

@ -26,6 +26,7 @@
#ifndef _PLATFORM_H_
#include "platform/platform.h"
#endif
#include "console/engineTypeInfo.h"
namespace Torque
@ -33,6 +34,7 @@ namespace Torque
/// A universally unique identifier.
class UUID
{
friend class UUIDEngineExport;
public:
typedef void Parent;
@ -81,6 +83,17 @@ namespace Torque
return !( *this == uuid );
}
};
class UUIDEngineExport
{
public:
static EngineFieldTable::Field getAField();
static EngineFieldTable::Field getBField();
static EngineFieldTable::Field getCField();
static EngineFieldTable::Field getDField();
static EngineFieldTable::Field getEField();
static EngineFieldTable::Field getFField();
};
}
namespace DictHash