54 m_uValue.Pointer =
TNULL;
60 m_uValue.Int = a_iValue;
66 m_uValue.Bool = a_bValue;
72 m_uValue.Float = a_fValue;
78 m_uValue.UInt32 = a_uiValue;
84 m_uValue.String =
new TCHAR[ Toshi::TStringManager::String8Length( a_pchValue ) + 1 ];
85 Toshi::TStringManager::String8Copy( m_uValue.String, a_pchValue );
91 m_uValue.String =
new TCHAR[ a_sValue.Length() + 1 ];
92 Toshi::TStringManager::String8Copy( m_uValue.String, a_sValue );
98 m_uValue.UInt32 = a_strValue.
uiIndex;
104 m_uValue.Properties = a_pProperties;
110 m_uValue.Array = a_pArray;
125 return m_uValue.Pointer;
131 return m_uValue.Bool;
149 return m_uValue.UInt32;
155 return m_uValue.UInt32;
161 return m_uValue.String;
164#ifdef __TOSHI_TPSTRING8_H__
165 Toshi::TPString8 GetTPString8()
const
168 return Toshi::TPString8( m_uValue.String );
175 return m_uValue.Properties;
181 return m_uValue.Array;
187 return m_uValue.Properties;
193 return m_uValue.Array;
199 return &m_uValue.Bool;
205 return &m_uValue.Float;
211 return &m_uValue.Int;
217 return &m_uValue.UInt32;
248 m_uValue.Int = a_iValue;
255 m_uValue.Bool = a_bValue;
262 m_uValue.Float = a_fValue;
269 m_uValue.UInt32 = a_uiValue;
279 m_uValue.String =
new TCHAR[ a_sValue.Length() + 1 ];
280 Toshi::TStringManager::String8Copy( m_uValue.String, a_sValue );
403#ifdef __TOSHI_TPSTRING8_H__
427 if ( other.m_iSize != 0 )
431 for (
TSIZE i = 0; i < other.m_iSize; i++ )
432 m_pValues[ i ] = other.m_pValues[ i ];
439 m_iSize = other.m_iSize;
444 m_pValues = other.m_pValues;
445 m_iSize = other.m_iSize;
446 other.m_pValues =
TNULL;
458 return &m_pValues[ a_iIndex ];
464 return &m_pValues[ a_iIndex ];
519 if (
this != &other )
523 if ( other.m_iSize != 0 )
527 for (
TSIZE i = 0; i < other.m_iSize; i++ )
528 m_pValues[ i ] = other.m_pValues[ i ];
530 m_iSize = other.m_iSize;
537 if (
this != &other )
541 m_pValues = other.m_pValues;
542 m_iSize = other.m_iSize;
543 other.m_pValues =
TNULL;
551 if ( m_pValues !=
TNULL )
555 for (
TSIZE i = 0; i < m_iSize; i++ )
556 newValues[ i ] = std::move( m_pValues[ i ] );
559 m_pValues = newValues;
565 m_pValues =
new PBPropertyValue[ 1 ];
569 m_pValues[ m_iSize - 1 ] = std::move( a_Value );
570 return &m_pValues[ m_iSize - 1 ];
580 PBPropertyValue* m_pValues;
597 m_szName =
new TCHAR[ a_sName.Length() + 1 ];
598 Toshi::TStringManager::String8Copy( m_szName, a_sName );
603 m_szName =
new TCHAR[ Toshi::TStringManager::String8Length( other.m_szName ) + 1 ];
604 Toshi::TStringManager::String8Copy( m_szName, other.m_szName );
609 m_szName = other.m_szName;
610 other.m_szName =
TNULL;
618 void SetName(
const Toshi::TString8& a_sName )
622 m_szName =
new TCHAR[ a_sName.Length() + 1 ];
623 Toshi::TStringManager::String8Copy( m_szName, a_sName );
633 return Toshi::TStringManager::String8Compare( m_szName, a_pName->m_szName ) == 0;
638 return Toshi::TStringManager::String8Compare( m_szName, a_szName ) == 0;
645 m_szName =
new TCHAR[ a_sName.Length() + 1 ];
646 Toshi::TStringManager::String8Copy( m_szName, a_sName );
699 PBProperty(
const Toshi::TString8& a_sName,
const Toshi::TString8& a_sValue )
731 m_pName = other.m_pName;
732 m_pValue = other.m_pValue;
733 other.m_pName =
TNULL;
734 other.m_pValue =
TNULL;
776 m_pName = other.m_pName;
777 m_pValue = other.m_pValue;
778 other.m_pName =
TNULL;
779 other.m_pValue =
TNULL;
807 m_pProperties =
TNULL;
813 m_pParent = other.m_pParent;
815 if ( other.m_pProperties !=
TNULL )
817 m_pProperties =
new PBProperty[ other.m_iCount ];
819 for (
TSIZE i = 0; i < other.m_iCount; i++ )
821 m_pProperties[ i ] = other.m_pProperties[ i ];
822 auto pValue = m_pProperties[ i ].
GetValue();
826 pValue->GetProperties()->m_pParent =
this;
832 m_pProperties = other.m_pProperties;
835 m_iCount = other.m_iCount;
840 m_pParent = other.m_pParent;
841 m_pProperties = other.m_pProperties;
842 m_iCount = other.m_iCount;
843 other.m_pParent =
TNULL;
844 other.m_pProperties =
TNULL;
855 return m_pProperties;
860 return m_pProperties + m_iCount;
865 return m_pProperties;
870 return m_pProperties + m_iCount;
875 TASSERT( m_iCount > a_iIndex );
876 return &m_pProperties[ a_iIndex ];
886 for (
TSIZE i = 0; i < m_iCount; i++ )
888 if ( m_pProperties[ i ].GetName() == a_szName )
890 return m_pProperties[ i ].GetValue();
897 template <
typename T>
905 a_rOutValue = pFoundProperty->
GetFloat();
911 a_rOutValue = pFoundProperty->
GetUINT32();
913 a_rOutValue = pFoundProperty->
GetString();
916 void* rawValue = pFoundProperty->
GetRaw();
917 a_rOutValue = *(T*)( &rawValue );
938 return AllocProperty(
PBProperty( a_Name, a_iValue ) );
943 return AllocProperty(
PBProperty( a_Name, a_strLocaleString ) );
948 return AllocProperty(
PBProperty( a_Name, a_bValue ) );
953 return AllocProperty(
PBProperty( a_Name, a_fValue ) );
958 return AllocProperty(
PBProperty( a_Name, a_uiValue ) );
963 return AllocProperty(
PBProperty( a_Name, a_sValue ) );
969 pProperties->m_pParent =
this;
971 return AllocProperty(
PBProperty( a_Name, pProperties ) );
978 return AllocProperty(
PBProperty( a_Name, pArray ) );
981#ifdef __TOSHI_TTRB_H__
994 Toshi::TString8 symbolName = a_szFileName;
995 symbolName.MakeLower();
1004 Toshi::TString8 symbolName = a_szFileName;
1005 symbolName.MakeLower();
1016 if ( m_pProperties !=
TNULL )
1018 auto newProperties =
new PBProperty[ m_iCount + 1 ];
1020 for (
TSIZE i = 0; i < m_iCount; i++ )
1021 newProperties[ i ] = std::move( m_pProperties[ i ] );
1024 m_pProperties = newProperties;
1034 m_pProperties[ m_iCount - 1 ] = std::move( a_Property );
1035 return &m_pProperties[ m_iCount - 1 ];
1040 if ( m_pProperties )
1041 delete[] m_pProperties;
1050inline void PBPropertyValue::Delete()
1052 if ( m_uValue.Pointer )
1055 delete m_uValue.Array;
1057 delete m_uValue.Properties;
1059 delete[] m_uValue.String;
1065 m_eType = other.m_eType;
1066 m_uValue.Pointer =
TNULL;
1075 m_uValue = other.m_uValue;
1080 m_eType = other.m_eType;
1081 m_uValue.Pointer = other.m_uValue.Pointer;
1082 other.m_uValue.Pointer =
TNULL;
1089 m_eType = other.m_eType;
1098 m_uValue = other.m_uValue;
1107 m_eType = other.m_eType;
1108 m_uValue.Pointer = other.m_uValue.Pointer;
1109 other.m_uValue.Pointer =
TNULL;
Main header file for the Toshi game engine.
Char string implementation for the Toshi engine.
constexpr PBPropertyLocaleString(TUINT a_uiIndex)
constexpr PBPropertyLocaleString()
PBPropertyLocaleString & operator=(TUINT a_uiIndex)
class PBPropertyValueArray * Array
class PBPropertyValueArray * GetArray()
TBOOL * GetBooleanPointer()
PBPropertyValue & operator=(TBOOL a_bValue)
const class PBProperties * GetProperties() const
PBPropertyValue(TBOOL a_bValue)
void SetInt(TINT a_iValue)
TFLOAT * GetFloatPointer()
TUINT32 * GetUINT32Pointer()
PBPropertyValue & operator=(TUINT32 a_uiValue)
PBPropertyValue(TINT a_iValue)
PBPropertyValue(PBPropertyLocaleString a_strValue)
PBPropertyValue & operator=(TFLOAT a_fValue)
PBPropertyValue(class PBPropertyValueArray *a_pArray)
PBPropertyValue(TUINT32 a_uiValue)
void SetString(const Toshi::TString8 &a_sValue)
PBPropertyLocaleString GetLocaleString() const
const class PBPropertyValueArray * GetArray() const
PBPropertyValue(const Toshi::TString8 &a_sValue)
TUINT32 GetUINT32() const
void SetBool(TBOOL a_bValue)
friend class PPropertiesWriter
void SetFloat(TFLOAT a_fValue)
class PBProperties * Properties
PBPropertyValue & operator=(TINT a_iValue)
PBPropertyValue(const TCHAR *a_pchValue)
void SetUINT32(TUINT32 a_uiValue)
PBPropertyValue & operator=(const Toshi::TString8 &a_sValue)
TINT * GetIntegerPointer()
PBPropertyValue(class PBProperties *a_pProperties)
PBPropertyValue(TFLOAT a_fValue)
const TCHAR * GetString() const
class PBProperties * GetProperties()
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
static constexpr PBPropertyValue::Type type
PBPropertyValue * GetValue(TSIZE a_iIndex)
PBPropertyValueArray(PBPropertyValueArray &&other) noexcept
PBPropertyValue * Add(const TCHAR *a_pchValue)
PBPropertyValueArray & operator=(PBPropertyValueArray &&other) noexcept
PBPropertyValue * Add(TINT a_iValue)
friend class PPropertiesWriter
PBPropertyValue * Add(TFLOAT a_fValue)
PBPropertyValue * operator[](TSIZE a_iIndex)
PBPropertyValue * Add(const Toshi::TString8 &a_sValue)
PBPropertyValue * Add(TBOOL a_bValue)
PBPropertyValueArray & operator=(const PBPropertyValueArray &other)
const PBPropertyValue * GetValue(TSIZE a_iIndex) const
const PBPropertyValue * operator[](TSIZE a_iIndex) const
PBPropertyValueArray(const PBPropertyValueArray &other)
PBPropertyValue * Add(TUINT32 a_uiValue)
PBPropertyValue * Add(PBPropertyLocaleString a_strLocaleString)
void SetName(const Toshi::TString8 &a_sName)
const TCHAR * GetString() const
PBPropertyName(const Toshi::TString8 &a_sName)
TBOOL operator==(PBPropertyName *a_pName) const
PBPropertyName operator=(const Toshi::TString8 &a_sName)
PBPropertyName(PBPropertyName &&other) noexcept
friend class PPropertiesWriter
TBOOL operator==(const TCHAR *a_szName) const
PBPropertyName(const PBPropertyName &other)
const PBProperties * GetParentProperties() const
PBProperty * AddPropertyBool(const Toshi::TString8 &a_Name, TBOOL a_bValue)
PBProperty * AddPropertyArray(const Toshi::TString8 &a_Name)
TUINT32 GetPropertyCount() const
PBProperty * AddProperty(const Toshi::TString8 &a_Name, TINT a_iValue)
static constexpr const TCHAR * TRB_SECTION_NAME
PBProperties(PBProperties &&other) noexcept
PBProperty * AddProperty(const Toshi::TString8 &a_Name, TFLOAT a_fValue)
PBProperty * AddProperty(const Toshi::TString8 &a_Name, PBPropertyLocaleString a_strLocaleString)
PBProperties(const PBProperties &other)
PBProperty * AddProperty(const Toshi::TString8 &a_Name, TUINT32 a_uiValue)
const PBPropertyValue * GetPropertyValue(TSIZE a_iIndex) const
const PBProperty * Begin() const
friend class PPropertiesWriter
const PBProperty * End() const
const PBPropertyValue * GetProperty(const TCHAR *a_szName) const
PBProperty * AddProperty(const Toshi::TString8 &a_Name, const Toshi::TString8 &a_sValue)
PBProperty * AddProperties(const Toshi::TString8 &a_Name)
TBOOL GetOptionalPropertyValue(T &a_rOutValue, const TCHAR *a_szName) const
const PBProperty * GetPropertyByIndex(TSIZE a_iIndex) const
PBProperty & operator=(const PBProperty &other)
PBProperty(const Toshi::TString8 &a_sName, TBOOL a_bValue)
PBProperty & operator=(PBProperty &&other) noexcept
PBProperty(const Toshi::TString8 &a_sName, const Toshi::TString8 &a_sValue)
const PBPropertyValue * GetValue() const
PBProperty(const PBProperty &other)
PBProperty(const Toshi::TString8 &a_sName, TFLOAT a_fValue)
PBProperty(const Toshi::TString8 &a_sName, TUINT32 a_uiValue)
PBPropertyValue * GetValue()
PBProperty(const Toshi::TString8 &a_sName, TINT a_iValue)
friend class PPropertiesWriter
PBProperty(const Toshi::TString8 &a_sName, PBProperties *a_pProperties)
const PBPropertyName & GetName() const
PBPropertyName & GetName()
PBProperty(const Toshi::TString8 &a_sName, PBPropertyLocaleString a_strLocaleString)
PBProperty(const Toshi::TString8 &a_sName, PBPropertyValueArray *a_pArray)
PBProperty(PBProperty &&other) noexcept