3 #include "Core/Global.h"
4 #include "Core/Utils/StringUtils.h"
6 #include "Threading/LockGuard/LockGuard.h"
86 std::map<std::string, CJsonObject> m_aoData;
91 void addObject(
const std::string &i_stName,
CJsonObject &&i_oObject);
95 void setType(
const EJsonType i_eType) { this->m_eType = i_eType; }
108 std::vector<std::string>
getKeys();
118 return this->m_oMutex;
161 inline bool toBool()
const {
return (*
this ==
"t" || *
this ==
"1"); }
176 return this->
operator=(std::string(i_stValue));
181 std::string::operator=(i_stValue);
187 std::string::operator=(std::to_string(i_nValue));
193 std::string::operator=(std::to_string(i_nValue));
199 std::string::operator=(std::to_string(i_nValue));
205 std::string::operator=(std::to_string(i_fValue));
211 std::string::operator=(std::to_string(i_dValue));
217 std::string::operator=(std::to_string(i_nValue));
231 Threading::RecursiveLockGuard(this->m_oMutex);
232 return this->m_aoData.operator[](std::string(i_stKey));
This file contains a series of type definitions for the codebase.
unsigned int uint
An unsigned integer type.
Definition: Typedef.h:19
unsigned long long uint64
A 64-bit unsigned integer type.
Definition: Typedef.h:11
long long int64
A 64-bit integer type.
Definition: Typedef.h:7
A thread-safe array class for Json objects.
Definition: JsonArray.h:41
A class for representing and handling a JSON document.
Definition: JsonDocument.h:35
A class that encapsulates a JSON object.
Definition: JsonObject.h:50
void setNull()
Sets the type of the JSON object to null.
Definition: JsonObject.h:132
bool isNull() const
Checks if the JSON object is null.
Definition: JsonObject.h:165
CJsonObject(const CJsonObject &i_oOther)
Copy constructor.
Definition: JsonObject.h:59
bool toBool() const
Converts the JSON object to a boolean.
Definition: JsonObject.h:161
CJsonObject & operator[](const std::string_view i_stKey)
Subscript operator overload for string key.
Definition: JsonObject.h:230
EJsonType type() const
Returns the type of the JSON object.
Definition: JsonObject.h:123
double toDouble() const
Converts the JSON object to a double.
Definition: JsonObject.h:157
int64 toInt64() const
Converts the JSON object to a 64-bit signed integer.
Definition: JsonObject.h:141
float toFloat() const
Converts the JSON object to a float.
Definition: JsonObject.h:153
int toInt() const
Converts the JSON object to an integer.
Definition: JsonObject.h:145
CJsonObject()
Default constructor.
Definition: JsonObject.cpp:4
uint toUInt() const
Converts the JSON object to an unsigned integer.
Definition: JsonObject.h:149
uint64 toUInt64() const
Converts the JSON object to a 64-bit unsigned integer.
Definition: JsonObject.h:137
CJsonObject & operator=(const CJsonObject &i_oOther)
Assignment operator overloads for various data types including CJsonObject, CJsonArray,...
Definition: JsonObject.cpp:52
CJsonObject(CJsonObject &&i_oOther) noexcept
Move constructor.
Definition: JsonObject.h:65
virtual ~CJsonObject()
Virtual destructor.
Definition: JsonObject.cpp:7
CJsonArray toArray() const
Converts the JSON object to a JSON array.
Definition: JsonObject.cpp:44
CJsonObject * find(std::string_view i_stName)
Finds a value in the JSON object.
Definition: JsonObject.cpp:17
std::vector< std::string > getKeys()
Returns the keys of the JSON object.
Definition: JsonObject.cpp:32
CJsonObject & get(const std::string_view i_stName)
Gets the value associated with the specified name.
Definition: JsonObject.h:128
Threading::CMutex & mutex()
Returns a reference to the mutex.
Definition: JsonObject.h:117
A class for handling recursive mutexes.
Definition: Mutex.h:47
The namespace encapsulating I/O related classes and functions in the Devel framework.
EJsonType
Enumerates the possible types of JSON value.
Definition: JsonObject.h:17
@ JTArray
An array type (an ordered collection of values).
@ JTObject
An object type (an unordered set of name/value pairs).
@ JTBoolean
A boolean type.
float ToFloat(const std::string &i_stBuffer)
Converts a string to a float.
Definition: StringUtils.h:256
long long ToInt64(const std::string &i_sBuffer)
Converts a string to a 64-bit integer.
Definition: StringUtils.h:222
int ToInt(const std::string &i_sBuffer)
Converts a string to an integer.
Definition: StringUtils.h:239
double ToDouble(const std::string &i_stBuffer)
Converts a string to a double.
Definition: StringUtils.h:265
unsigned long long ToUInt64(const std::string &i_sBuffer)
Converts a string to an unsigned 64-bit integer.
Definition: StringUtils.h:231