OpenBarnyard
 
Loading...
Searching...
No Matches
PBPropertyValue Class Reference

#include <PBProperties.h>

Public Types

enum class  Type {
  Int , UInt32 , Float , Bool ,
  Properties , PropertyName , Array , String ,
  LocaleString
}
 

Public Member Functions

 PBPropertyValue ()
 
 PBPropertyValue (TINT a_iValue)
 
 PBPropertyValue (TBOOL a_bValue)
 
 PBPropertyValue (TFLOAT a_fValue)
 
 PBPropertyValue (TUINT32 a_uiValue)
 
 PBPropertyValue (const TCHAR *a_pchValue)
 
 PBPropertyValue (const Toshi::TString8 &a_sValue)
 
 PBPropertyValue (PBPropertyLocaleString a_strValue)
 
 PBPropertyValue (class PBProperties *a_pProperties)
 
 PBPropertyValue (class PBPropertyValueArray *a_pArray)
 
 PBPropertyValue (const PBPropertyValue &other)
 
 PBPropertyValue (PBPropertyValue &&other) noexcept
 
 ~PBPropertyValue ()
 
Type GetType () const
 
void * GetRaw () const
 
TBOOL GetBoolean () const
 
TFLOAT GetFloat () const
 
TINT GetInteger () const
 
TUINT32 GetUINT32 () const
 
PBPropertyLocaleString GetLocaleString () const
 
const TCHARGetString () const
 
const class PBPropertiesGetProperties () const
 
const class PBPropertyValueArrayGetArray () const
 
class PBPropertiesGetProperties ()
 
class PBPropertyValueArrayGetArray ()
 
TBOOLGetBooleanPointer ()
 
TFLOATGetFloatPointer ()
 
TINTGetIntegerPointer ()
 
TUINT32GetUINT32Pointer ()
 
void SetInt (TINT a_iValue)
 
void SetBool (TBOOL a_bValue)
 
void SetFloat (TFLOAT a_fValue)
 
void SetUINT32 (TUINT32 a_uiValue)
 
void SetString (const Toshi::TString8 &a_sValue)
 
PBPropertyValueoperator= (TINT a_iValue)
 
PBPropertyValueoperator= (TBOOL a_bValue)
 
PBPropertyValueoperator= (TFLOAT a_fValue)
 
PBPropertyValueoperator= (TUINT32 a_uiValue)
 
PBPropertyValueoperator= (const Toshi::TString8 &a_sValue)
 
PBPropertyValueoperator= (const PBPropertyValue &other)
 
PBPropertyValueoperator= (PBPropertyValue &&other) noexcept
 

Friends

class PPropertiesWriter
 

Detailed Description

Definition at line 32 of file PBProperties.h.

Member Enumeration Documentation

◆ Type

enum class PBPropertyValue::Type
strong
Enumerator
Int 
UInt32 
Float 
Bool 
Properties 
PropertyName 
Array 
String 
LocaleString 

Definition at line 35 of file PBProperties.h.

36 {
37 Int,
38 UInt32,
39 Float,
40 Bool,
41 Properties,
42 PropertyName,
43 Array,
44 String,
45 LocaleString
46 };

Constructor & Destructor Documentation

◆ PBPropertyValue() [1/12]

PBPropertyValue::PBPropertyValue ( )
inline

Definition at line 51 of file PBProperties.h.

52 {
53 m_eType = Type::Int;
54 m_uValue.Pointer = TNULL;
55 }
#define TNULL
Definition Typedefs.h:23

◆ PBPropertyValue() [2/12]

PBPropertyValue::PBPropertyValue ( TINT a_iValue)
inline

Definition at line 57 of file PBProperties.h.

58 {
59 m_eType = Type::Int;
60 m_uValue.Int = a_iValue;
61 }

◆ PBPropertyValue() [3/12]

PBPropertyValue::PBPropertyValue ( TBOOL a_bValue)
inline

Definition at line 63 of file PBProperties.h.

64 {
65 m_eType = Type::Bool;
66 m_uValue.Bool = a_bValue;
67 }

◆ PBPropertyValue() [4/12]

PBPropertyValue::PBPropertyValue ( TFLOAT a_fValue)
inline

Definition at line 69 of file PBProperties.h.

70 {
71 m_eType = Type::Float;
72 m_uValue.Float = a_fValue;
73 }

◆ PBPropertyValue() [5/12]

PBPropertyValue::PBPropertyValue ( TUINT32 a_uiValue)
inline

Definition at line 75 of file PBProperties.h.

76 {
77 m_eType = Type::UInt32;
78 m_uValue.UInt32 = a_uiValue;
79 }

◆ PBPropertyValue() [6/12]

PBPropertyValue::PBPropertyValue ( const TCHAR * a_pchValue)
inline

Definition at line 81 of file PBProperties.h.

82 {
83 m_eType = Type::String;
84 m_uValue.String = new TCHAR[ Toshi::TStringManager::String8Length( a_pchValue ) + 1 ];
85 Toshi::TStringManager::String8Copy( m_uValue.String, a_pchValue );
86 }
char TCHAR
Definition Typedefs.h:20

◆ PBPropertyValue() [7/12]

PBPropertyValue::PBPropertyValue ( const Toshi::TString8 & a_sValue)
inline

Definition at line 88 of file PBProperties.h.

89 {
90 m_eType = Type::String;
91 m_uValue.String = new TCHAR[ a_sValue.Length() + 1 ];
92 Toshi::TStringManager::String8Copy( m_uValue.String, a_sValue );
93 }

◆ PBPropertyValue() [8/12]

PBPropertyValue::PBPropertyValue ( PBPropertyLocaleString a_strValue)
inline

Definition at line 95 of file PBProperties.h.

96 {
97 m_eType = Type::LocaleString;
98 m_uValue.UInt32 = a_strValue.uiIndex;
99 }

◆ PBPropertyValue() [9/12]

PBPropertyValue::PBPropertyValue ( class PBProperties * a_pProperties)
inline

Definition at line 101 of file PBProperties.h.

102 {
103 m_eType = Type::Properties;
104 m_uValue.Properties = a_pProperties;
105 }

◆ PBPropertyValue() [10/12]

PBPropertyValue::PBPropertyValue ( class PBPropertyValueArray * a_pArray)
inline

Definition at line 107 of file PBProperties.h.

108 {
109 m_eType = Type::Array;
110 m_uValue.Array = a_pArray;
111 }

◆ PBPropertyValue() [11/12]

PBPropertyValue::PBPropertyValue ( const PBPropertyValue & other)
inline

Definition at line 1063 of file PBProperties.h.

1064{
1065 m_eType = other.m_eType;
1066 m_uValue.Pointer = TNULL;
1067
1068 if ( other.m_eType == Type::Array )
1069 m_uValue.Array = new PBPropertyValueArray( *other.m_uValue.Array );
1070 else if ( other.m_eType == Type::Properties )
1071 m_uValue.Properties = new PBProperties( *other.m_uValue.Properties );
1072 else if ( other.m_eType == Type::String )
1073 SetString( other.m_uValue.String );
1074 else
1075 m_uValue = other.m_uValue;
1076}
class PBPropertyValueArray * Array
void SetString(const Toshi::TString8 &a_sValue)
class PBProperties * Properties

◆ PBPropertyValue() [12/12]

PBPropertyValue::PBPropertyValue ( PBPropertyValue && other)
inlinenoexcept

Definition at line 1078 of file PBProperties.h.

1079{
1080 m_eType = other.m_eType;
1081 m_uValue.Pointer = other.m_uValue.Pointer;
1082 other.m_uValue.Pointer = TNULL;
1083}

◆ ~PBPropertyValue()

PBPropertyValue::~PBPropertyValue ( )
inline

Definition at line 1114 of file PBProperties.h.

1115{
1116 Delete();
1117}

Member Function Documentation

◆ GetArray() [1/2]

class PBPropertyValueArray * PBPropertyValue::GetArray ( )
inline

Definition at line 190 of file PBProperties.h.

191 {
192 TASSERT( m_eType == Type::Array );
193 return m_uValue.Array;
194 }
#define TASSERT(X,...)
Definition Defines.h:138

◆ GetArray() [2/2]

const class PBPropertyValueArray * PBPropertyValue::GetArray ( ) const
inline

Definition at line 178 of file PBProperties.h.

179 {
180 TASSERT( m_eType == Type::Array );
181 return m_uValue.Array;
182 }

◆ GetBoolean()

TBOOL PBPropertyValue::GetBoolean ( ) const
inline

Definition at line 128 of file PBProperties.h.

129 {
130 TASSERT( m_eType == Type::Bool );
131 return m_uValue.Bool;
132 }

◆ GetBooleanPointer()

TBOOL * PBPropertyValue::GetBooleanPointer ( )
inline

Definition at line 196 of file PBProperties.h.

197 {
198 TASSERT( m_eType == Type::Bool );
199 return &m_uValue.Bool;
200 }

◆ GetFloat()

TFLOAT PBPropertyValue::GetFloat ( ) const
inline

Definition at line 134 of file PBProperties.h.

135 {
136 TASSERT( m_eType == Type::Float || m_eType == Type::Int );
137 return m_eType == Type::Float ? m_uValue.Float : TFLOAT( m_uValue.Int );
138 }
float TFLOAT
Definition Typedefs.h:4

◆ GetFloatPointer()

TFLOAT * PBPropertyValue::GetFloatPointer ( )
inline

Definition at line 202 of file PBProperties.h.

203 {
204 TASSERT( m_eType == Type::Float );
205 return &m_uValue.Float;
206 }

◆ GetInteger()

TINT PBPropertyValue::GetInteger ( ) const
inline

Definition at line 140 of file PBProperties.h.

141 {
142 TASSERT( m_eType == Type::Int );
143 return m_uValue.Int;
144 }

◆ GetIntegerPointer()

TINT * PBPropertyValue::GetIntegerPointer ( )
inline

Definition at line 208 of file PBProperties.h.

209 {
210 TASSERT( m_eType == Type::Int );
211 return &m_uValue.Int;
212 }

◆ GetLocaleString()

PBPropertyLocaleString PBPropertyValue::GetLocaleString ( ) const
inline

Definition at line 152 of file PBProperties.h.

153 {
154 TASSERT( m_eType == Type::LocaleString );
155 return m_uValue.UInt32;
156 }

◆ GetProperties() [1/2]

class PBProperties * PBPropertyValue::GetProperties ( )
inline

Definition at line 184 of file PBProperties.h.

185 {
186 TASSERT( m_eType == Type::Properties );
187 return m_uValue.Properties;
188 }

◆ GetProperties() [2/2]

const class PBProperties * PBPropertyValue::GetProperties ( ) const
inline

Definition at line 172 of file PBProperties.h.

173 {
174 TASSERT( m_eType == Type::Properties );
175 return m_uValue.Properties;
176 }

◆ GetRaw()

void * PBPropertyValue::GetRaw ( ) const
inline

Definition at line 123 of file PBProperties.h.

124 {
125 return m_uValue.Pointer;
126 }

◆ GetString()

const TCHAR * PBPropertyValue::GetString ( ) const
inline

Definition at line 158 of file PBProperties.h.

159 {
160 TASSERT( m_eType == Type::String );
161 return m_uValue.String;
162 }

◆ GetType()

Type PBPropertyValue::GetType ( ) const
inline

Definition at line 118 of file PBProperties.h.

119 {
120 return m_eType;
121 }

◆ GetUINT32()

TUINT32 PBPropertyValue::GetUINT32 ( ) const
inline

Definition at line 146 of file PBProperties.h.

147 {
148 TASSERT( m_eType == Type::UInt32 );
149 return m_uValue.UInt32;
150 }

◆ GetUINT32Pointer()

TUINT32 * PBPropertyValue::GetUINT32Pointer ( )
inline

Definition at line 214 of file PBProperties.h.

215 {
216 TASSERT( m_eType == Type::LocaleString );
217 return &m_uValue.UInt32;
218 }

◆ operator=() [1/7]

PBPropertyValue & PBPropertyValue::operator= ( const PBPropertyValue & other)
inline

Definition at line 1085 of file PBProperties.h.

1086{
1087 Delete();
1088
1089 m_eType = other.m_eType;
1090
1091 if ( other.m_eType == Type::Array )
1092 m_uValue.Array = new PBPropertyValueArray( *other.m_uValue.Array );
1093 else if ( other.m_eType == Type::Properties )
1094 m_uValue.Properties = new PBProperties( *other.m_uValue.Properties );
1095 else if ( other.m_eType == Type::String )
1096 SetString( other.m_uValue.String );
1097 else
1098 m_uValue = other.m_uValue;
1099
1100 return *this;
1101}

◆ operator=() [2/7]

PBPropertyValue & PBPropertyValue::operator= ( const Toshi::TString8 & a_sValue)
inline

Definition at line 273 of file PBProperties.h.

274 {
275 TASSERT( m_eType == Type::String );
276
277 Delete();
278
279 m_uValue.String = new TCHAR[ a_sValue.Length() + 1 ];
280 Toshi::TStringManager::String8Copy( m_uValue.String, a_sValue );
281 return *this;
282 }

◆ operator=() [3/7]

PBPropertyValue & PBPropertyValue::operator= ( PBPropertyValue && other)
inlinenoexcept

Definition at line 1103 of file PBProperties.h.

1104{
1105 Delete();
1106
1107 m_eType = other.m_eType;
1108 m_uValue.Pointer = other.m_uValue.Pointer;
1109 other.m_uValue.Pointer = TNULL;
1110
1111 return *this;
1112}

◆ operator=() [4/7]

PBPropertyValue & PBPropertyValue::operator= ( TBOOL a_bValue)
inline

Definition at line 252 of file PBProperties.h.

253 {
254 TASSERT( m_eType == Type::Bool );
255 m_uValue.Bool = a_bValue;
256 return *this;
257 }

◆ operator=() [5/7]

PBPropertyValue & PBPropertyValue::operator= ( TFLOAT a_fValue)
inline

Definition at line 259 of file PBProperties.h.

260 {
261 TASSERT( m_eType == Type::Float );
262 m_uValue.Float = a_fValue;
263 return *this;
264 }

◆ operator=() [6/7]

PBPropertyValue & PBPropertyValue::operator= ( TINT a_iValue)
inline

Definition at line 245 of file PBProperties.h.

246 {
247 TASSERT( m_eType == Type::Int );
248 m_uValue.Int = a_iValue;
249 return *this;
250 }

◆ operator=() [7/7]

PBPropertyValue & PBPropertyValue::operator= ( TUINT32 a_uiValue)
inline

Definition at line 266 of file PBProperties.h.

267 {
268 TASSERT( m_eType == Type::LocaleString );
269 m_uValue.UInt32 = a_uiValue;
270 return *this;
271 }

◆ SetBool()

void PBPropertyValue::SetBool ( TBOOL a_bValue)
inline

Definition at line 225 of file PBProperties.h.

226 {
227 this->operator=( a_bValue );
228 }
PBPropertyValue & operator=(TINT a_iValue)

◆ SetFloat()

void PBPropertyValue::SetFloat ( TFLOAT a_fValue)
inline

Definition at line 230 of file PBProperties.h.

231 {
232 this->operator=( a_fValue );
233 }

◆ SetInt()

void PBPropertyValue::SetInt ( TINT a_iValue)
inline

Definition at line 220 of file PBProperties.h.

221 {
222 this->operator=( a_iValue );
223 }

◆ SetString()

void PBPropertyValue::SetString ( const Toshi::TString8 & a_sValue)
inline

Definition at line 240 of file PBProperties.h.

241 {
242 this->operator=( a_sValue );
243 }

◆ SetUINT32()

void PBPropertyValue::SetUINT32 ( TUINT32 a_uiValue)
inline

Definition at line 235 of file PBProperties.h.

236 {
237 this->operator=( a_uiValue );
238 }

Friends And Related Symbol Documentation

◆ PPropertiesWriter

friend class PPropertiesWriter
friend

Definition at line 48 of file PBProperties.h.

Member Data Documentation

◆ Array

class PBPropertyValueArray* PBPropertyValue::Array

Definition at line 302 of file PBProperties.h.

◆ Bool

TBOOL PBPropertyValue::Bool

Definition at line 298 of file PBProperties.h.

◆ Float

TFLOAT PBPropertyValue::Float

Definition at line 297 of file PBProperties.h.

◆ Int

TINT PBPropertyValue::Int

Definition at line 299 of file PBProperties.h.

◆ Pointer

void* PBPropertyValue::Pointer

Definition at line 295 of file PBProperties.h.

◆ Properties

class PBProperties* PBPropertyValue::Properties

Definition at line 301 of file PBProperties.h.

◆ String

TCHAR* PBPropertyValue::String

Definition at line 296 of file PBProperties.h.

◆ UInt32

TUINT32 PBPropertyValue::UInt32

Definition at line 300 of file PBProperties.h.


The documentation for this class was generated from the following file: