From 1909ad63ab20c0e46ca067fb07a2ac2011faf0e3 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:37:20 +0100 Subject: [PATCH] RTech: implement RSON array subvalues --- src/public/rtech/rson.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/public/rtech/rson.h b/src/public/rtech/rson.h index ad7db46d..c8628efd 100644 --- a/src/public/rtech/rson.h +++ b/src/public/rtech/rson.h @@ -35,10 +35,12 @@ public: union Value_t { inline Field_t* GetSubKey() const { return pSubKey; }; + inline Value_t* GetSubValue() const { return pSubValue; }; inline const char* GetString() const { return pszString; }; inline int64_t GetInt() const { return integerValue; }; Field_t* pSubKey; + Value_t* pSubValue; char* pszString; int64_t integerValue; }; @@ -53,6 +55,7 @@ public: Value_t m_Value; inline Field_t* GetFirstSubKey() const; + inline Value_t* GetArrayValue(const int index) const; // does not support finding a key in a different level of the tree inline Field_t* FindKey(const char* const pszKeyName) const; @@ -107,6 +110,11 @@ RSON::Field_t* RSON::Node_t::FindKey(const char* const pszKeyName) const return NULL; } +RSON::Value_t* RSON::Node_t::GetArrayValue(const int index) const +{ + assert(m_Type & eFieldType::RSON_ARRAY); + return m_Value.GetSubValue() + index; +} ///////////////////////////////////////////////////////////////////////////////