DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
JsonElement.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "Common.h"
9#include "System/Object.h"
10#include "System/String.h"
11#include "System/SmartPointer.h"
12#include "System/Array.h"
13
14namespace DotNetDupe {
15 namespace System {
16 namespace Text {
17 namespace Json {
18
31
32 class JsonElementImpl;
33
39 class JsonElement : public Object {
40 public:
43
46
47 DOTNETDUPE_API JsonElement(const JsonElement& objOther);
49 DOTNETDUPE_API JsonElement(JsonElement&& objOther) noexcept;
50 DOTNETDUPE_API JsonElement& operator=(JsonElement&& objOther) noexcept;
51
55
58 DOTNETDUPE_API explicit JsonElement(bool bValue);
59
62 DOTNETDUPE_API explicit JsonElement(double dValue);
63
66 DOTNETDUPE_API explicit JsonElement(const String& sValue);
67
69 DOTNETDUPE_API explicit JsonElement(std::nullptr_t);
70
74
78 DOTNETDUPE_API bool GetBoolean() const;
79
83 DOTNETDUPE_API double GetDouble() const;
84
88 DOTNETDUPE_API int GetInt32() const;
89
93 DOTNETDUPE_API long long GetInt64() const;
94
99
103 DOTNETDUPE_API int GetArrayLength() const;
104
109
112 DOTNETDUPE_API void AddArrayElement(const JsonElement& objElement);
113
118 DOTNETDUPE_API bool TryGetProperty(const String& sPropertyName, JsonElement& objValue) const;
119
123 DOTNETDUPE_API void SetProperty(const String& sPropertyName, const JsonElement& objValue);
124
128
132
137 DOTNETDUPE_API static JsonElement Parse(const String& sJson);
138
139 private:
141 };
142
143 }
144 }
145 }
146}
Provides methods for creating, manipulating, searching, and sorting arrays.
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition Array.h:29
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
A unified smart pointer that supports both unique and shared ownership semantics.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
String GetString() const
Gets the value of the element as a string.
int GetArrayLength() const
Gets the number of values contained within the current JSON array value.
int GetInt32() const
Gets the current JSON number as a 32-bit signed integer.
Array< String > GetPropertyNames() const
Gets an array containing the names of all properties on the current JSON object.
JsonValueKind GetValueKind() const
Gets the type of the current JSON value.
JsonElement & operator=(const JsonElement &objOther)
bool TryGetProperty(const String &sPropertyName, JsonElement &objValue) const
Looks for a property named propertyName in the current JSON object.
String ToString() const
Serializes the element into a JSON string representation.
JsonElement GetArrayElement(int iIndex) const
Gets the value at the specified index in the current JSON array.
JsonElement()
Initializes a new instance of the JsonElement class representing undefined.
void AddArrayElement(const JsonElement &objElement)
Adds an element to the current JSON array.
long long GetInt64() const
Gets the current JSON number as a 64-bit signed integer.
bool GetBoolean() const
Gets the value of the element as a Boolean.
static JsonElement Parse(const String &sJson)
Parses text representing a single JSON value into a JsonElement.
void SetProperty(const String &sPropertyName, const JsonElement &objValue)
Sets or replaces a property on the current JSON object.
double GetDouble() const
Gets the current JSON number as a double.
JsonValueKind
Specifies the data type of a JSON value.
Definition JsonElement.h:21