183 Datum(int32_t value);
184#if PLATFORM_3DS || defined(POLYPHASE_PLATFORM_ADDON)
192 Datum(uint32_t value);
195 Datum(
const char* value);
196 Datum(
const std::string& value);
197 Datum(glm::vec2 value);
198 Datum(glm::vec3 value);
199 Datum(glm::vec4 value);
202 Datum(uint8_t value);
206 Datum(int16_t value);
215 for (uint32_t i = 0; i < arr.size(); ++i)
220 mForceScriptArray =
true;
228 for (uint32_t i = 0; i < arr.size(); ++i)
230 PushBack(arr[i].
Get());
233 mForceScriptArray =
true;
241 for (uint32_t i = 0; i < arr.size(); ++i)
243 PushBack(arr[i].
Get());
246 mForceScriptArray =
true;
250 operator int32_t()
const {
return GetInteger(); }
251 operator uint32_t()
const {
return (uint32_t)GetInteger(); }
253 operator bool()
const {
return GetBool(); }
254 operator const char*()
const {
return GetString().c_str(); }
255 operator std::string()
const {
return GetString(); }
256 operator glm::vec2()
const {
return (mType ==
DatumType::Color) ? glm::vec2(GetColor()) : GetVector2D(); }
257 operator glm::vec3()
const {
return (mType ==
DatumType::Color) ? glm::vec3(GetColor()) : GetVector(); }
258 operator glm::vec4()
const {
return GetColor(); }
259 operator Asset*()
const {
return GetAsset(); }
261 operator uint8_t()
const {
return (mType ==
DatumType::Integer) ? uint8_t(GetInteger()) : GetByte(); }
263 operator int16_t()
const {
return (mType ==
DatumType::Integer) ? int16_t(GetInteger()) : GetShort(); }
269 uint32_t GetCount()
const;
270 void SetCount(uint32_t count);
272 uint32_t GetDataTypeSize()
const;
273 uint32_t GetDataTypeSerializationSize(
bool net)
const;
275 bool IsExternal()
const;
276 bool IsValid()
const;
278 virtual void ReadStream(
Stream& stream, uint32_t version,
bool net,
bool external);
279 virtual void WriteStream(
Stream& stream,
bool net)
const;
280 virtual uint32_t GetSerializationSize(
bool net)
const;
282 void SetInteger(int32_t value, uint32_t index = 0);
283 void SetFloat(
float value, uint32_t index = 0);
284 void SetBool(
bool value, uint32_t index = 0);
285 void SetString(
const std::string& value, uint32_t index = 0);
286 void SetVector2D(
const glm::vec2& value, uint32_t index = 0);
287 void SetVector(
const glm::vec3& value, uint32_t index = 0);
288 void SetColor(
const glm::vec4& value, uint32_t index = 0);
289 void SetAsset(
const Asset* value, uint32_t index = 0);
290 void SetByte(uint8_t value, uint32_t index = 0);
291 void SetTableDatum(
const TableDatum& value, uint32_t index = 0);
292 void SetNode(
const WeakPtr<Node>& value, uint32_t index = 0);
293 void SetShort(int16_t value, uint32_t index = 0);
294 void SetFunction(
const ScriptFunc& value, uint32_t index = 0);
297 void SetValue(
const void* value, uint32_t index = 0, uint32_t count = 1);
298 void SetValueRaw(
const void* value, uint32_t index = 0);
300 void SetExternal(int32_t* data, uint32_t count = 1);
301 void SetExternal(
float* data, uint32_t count = 1);
302 void SetExternal(
bool* data, uint32_t count = 1);
303 void SetExternal(std::string* data, uint32_t count = 1);
304 void SetExternal(glm::vec2* data, uint32_t count = 1);
305 void SetExternal(glm::vec3* data, uint32_t count = 1);
306 void SetExternal(glm::vec4* data, uint32_t count = 1);
307 void SetExternal(
AssetRef* data, uint32_t count = 1);
308 void SetExternal(uint8_t* data, uint32_t count = 1);
309 void SetExternal(
TableDatum* data, uint32_t count = 1);
311 void SetExternal(int16_t* data, uint32_t count = 1);
312 void SetExternal(
ScriptFunc* data, uint32_t count = 1);
315 int32_t GetInteger(uint32_t index = 0)
const;
316 float GetFloat(uint32_t index = 0)
const;
317 bool GetBool(uint32_t index = 0)
const;
318 const std::string& GetString(uint32_t index = 0)
const;
319 const glm::vec2& GetVector2D(uint32_t index = 0)
const;
320 const glm::vec3& GetVector(uint32_t index = 0)
const;
321 const glm::vec4& GetColor(uint32_t index = 0)
const;
322 Asset* GetAsset(uint32_t index = 0)
const;
323 uint8_t GetByte(uint32_t index = 0)
const;
324 TableDatum& GetTableDatum(uint32_t index = 0);
325 const TableDatum& GetTableDatum(uint32_t index = 0)
const;
328 int16_t GetShort(uint32_t index = 0)
const;
329 const ScriptFunc& GetFunction(uint32_t index = 0)
const;
332 int32_t& GetIntegerRef(uint32_t index = 0);
333 float& GetFloatRef(uint32_t index = 0);
334 bool& GetBoolRef(uint32_t index = 0);
335 std::string& GetStringRef(uint32_t index = 0);
336 glm::vec2& GetVector2DRef(uint32_t index = 0);
337 glm::vec3& GetVectorRef(uint32_t index = 0);
338 glm::vec4& GetColorRef(uint32_t index = 0);
339 AssetRef& GetAssetRef(uint32_t index = 0);
340 uint8_t& GetByteRef(uint32_t index = 0);
342 int16_t& GetShortRef(uint32_t index = 0);
343 ScriptFunc& GetFunctionRef(uint32_t index = 0);
346 void PushBack(int32_t value);
347 void PushBack(
float value);
348 void PushBack(
bool value);
349 void PushBack(
const std::string& value);
350 void PushBack(
const char* value);
351 void PushBack(
const glm::vec2& value);
352 void PushBack(
const glm::vec3& value);
353 void PushBack(
const glm::vec4& value);
354 void PushBack(
Asset* value);
355 void PushBack(
const AssetRef& value);
356 void PushBack(uint8_t value);
360 void PushBack(
Node* node);
361 void PushBack(int16_t value);
365 void Erase(uint32_t index);
375 int32_t GetIntegerField(
const char* key);
376 float GetFloatField(
const char* key);
387 int32_t GetIntegerField(int32_t key);
388 float GetFloatField(int32_t key);
408 void SetTableField(
const char* key,
const TableDatum& value);
420 void SetTableField(int32_t key,
const TableDatum& value);
423 bool HasField(
const char* key);
424 bool HasField(int32_t key);
429 Datum& operator=(int32_t src);
430 Datum& operator=(
float src);
431 Datum& operator=(
bool src);
432 Datum& operator=(
const std::string& src);
433 Datum& operator=(
const char* src);
434 Datum& operator=(
const glm::vec2 src);
435 Datum& operator=(
const glm::vec3& src);
436 Datum& operator=(
const glm::vec4& src);
438 Datum& operator=(uint8_t src);
441 Datum& operator=(int16_t src);
445 bool operator==(
const Datum& other)
const;
447 bool operator==(
const int32_t& other)
const;
448 bool operator==(
const float& other)
const;
449 bool operator==(
const bool& other)
const;
450 bool operator==(
const std::string& other)
const;
451 bool operator==(
const char* other)
const;
452 bool operator==(
const glm::vec2& other)
const;
453 bool operator==(
const glm::vec3& other)
const;
454 bool operator==(
const glm::vec4& other)
const;
455 bool operator==(
const Asset*& other)
const;
456 bool operator==(
const uint32_t& other)
const;
457 bool operator==(
const uint8_t& other)
const;
458 bool operator==(
const Node*& other)
const;
461 bool operator==(
const int16_t& other)
const;
462 bool operator==(
const ScriptFunc& other)
const;
464 bool operator!=(
const Datum& other)
const;
466 bool operator!=(
const int32_t& other)
const;
467 bool operator!=(
const float& other)
const;
468 bool operator!=(
const bool& other)
const;
469 bool operator!=(
const std::string& other)
const;
470 bool operator!=(
const char* other)
const;
471 bool operator!=(
const glm::vec2& other)
const;
472 bool operator!=(
const glm::vec3& other)
const;
473 bool operator!=(
const glm::vec4& other)
const;
474 bool operator!=(
const Asset*& other)
const;
475 bool operator!=(
const uint32_t& other)
const;
476 bool operator!=(
const uint8_t& other)
const;
477 bool operator!=(
const Node*& other)
const;
480 bool operator!=(
const int16_t& other)
const;
481 bool operator!=(
const ScriptFunc& other)
const;
483 virtual bool IsProperty()
const;
484 virtual bool IsTableDatum()
const;
485 virtual void DeepCopy(
const Datum& src,
bool forceInternalStorage);
487 void* GetValue(uint32_t index);
494 void Reserve(uint32_t capacity);
496 void PreSet(uint32_t index,
DatumType type);
498 void PostSetExternal(
DatumType type, uint32_t count);
500 void PreGet(uint32_t index,
DatumType type)
const;
503 void ConstructData(
DatumData& dataUnion, uint32_t index);
504 void DestructData(
DatumData& dataUnion, uint32_t index);
507 virtual void Reset();
519 uint8_t mCapacity = 0;