DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
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
14
namespace
DotNetDupe
{
15
namespace
System
{
16
namespace
Text
{
17
namespace
Json
{
18
21
enum class
JsonValueKind
{
22
Undefined
,
23
Object
,
24
Array
,
25
String
,
26
Number
,
27
True
,
28
False
,
29
Null
30
};
31
32
class
JsonElementImpl;
33
39
class
JsonElement
:
public
Object
{
40
public
:
42
DOTNETDUPE_API
JsonElement
();
43
45
DOTNETDUPE_API
~JsonElement
();
46
47
DOTNETDUPE_API
JsonElement
(
const
JsonElement
& objOther);
48
DOTNETDUPE_API
JsonElement
&
operator=
(
const
JsonElement
& objOther);
49
DOTNETDUPE_API
JsonElement
(
JsonElement
&& objOther)
noexcept
;
50
DOTNETDUPE_API
JsonElement
&
operator=
(
JsonElement
&& objOther)
noexcept
;
51
54
DOTNETDUPE_API
explicit
JsonElement
(
JsonValueKind
eKind);
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
73
DOTNETDUPE_API
JsonValueKind
GetValueKind
()
const
;
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
98
DOTNETDUPE_API
String
GetString
()
const
;
99
103
DOTNETDUPE_API
int
GetArrayLength
()
const
;
104
108
DOTNETDUPE_API
JsonElement
GetArrayElement
(
int
iIndex)
const
;
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
127
DOTNETDUPE_API
Array<String>
GetPropertyNames
()
const
;
128
131
DOTNETDUPE_API
String
ToString
()
const
;
132
137
DOTNETDUPE_API
static
JsonElement
Parse
(
const
String
& sJson);
138
139
private
:
140
SmartPointer<JsonElementImpl>
m_pImpl;
141
};
142
143
}
144
}
145
}
146
}
Array.h
Provides methods for creating, manipulating, searching, and sorting arrays.
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
DotNetDupe::System::Array
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition
Array.h:29
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::System::Text::Json::JsonElement::GetString
String GetString() const
Gets the value of the element as a string.
Definition
JsonElement.cpp:394
DotNetDupe::System::Text::Json::JsonElement::GetArrayLength
int GetArrayLength() const
Gets the number of values contained within the current JSON array value.
Definition
JsonElement.cpp:400
DotNetDupe::System::Text::Json::JsonElement::GetInt32
int GetInt32() const
Gets the current JSON number as a 32-bit signed integer.
Definition
JsonElement.cpp:384
DotNetDupe::System::Text::Json::JsonElement::GetPropertyNames
Array< String > GetPropertyNames() const
Gets an array containing the names of all properties on the current JSON object.
Definition
JsonElement.cpp:434
DotNetDupe::System::Text::Json::JsonElement::GetValueKind
JsonValueKind GetValueKind() const
Gets the type of the current JSON value.
Definition
JsonElement.cpp:366
DotNetDupe::System::Text::Json::JsonElement::operator=
JsonElement & operator=(const JsonElement &objOther)
Definition
JsonElement.cpp:302
DotNetDupe::System::Text::Json::JsonElement::TryGetProperty
bool TryGetProperty(const String &sPropertyName, JsonElement &objValue) const
Looks for a property named propertyName in the current JSON object.
Definition
JsonElement.cpp:418
DotNetDupe::System::Text::Json::JsonElement::ToString
String ToString() const
Serializes the element into a JSON string representation.
Definition
JsonElement.cpp:471
DotNetDupe::System::Text::Json::JsonElement::GetArrayElement
JsonElement GetArrayElement(int iIndex) const
Gets the value at the specified index in the current JSON array.
Definition
JsonElement.cpp:406
DotNetDupe::System::Text::Json::JsonElement::JsonElement
JsonElement()
Initializes a new instance of the JsonElement class representing undefined.
Definition
JsonElement.cpp:273
DotNetDupe::System::Text::Json::JsonElement::AddArrayElement
void AddArrayElement(const JsonElement &objElement)
Adds an element to the current JSON array.
Definition
JsonElement.cpp:412
DotNetDupe::System::Text::Json::JsonElement::GetInt64
long long GetInt64() const
Gets the current JSON number as a 64-bit signed integer.
Definition
JsonElement.cpp:389
DotNetDupe::System::Text::Json::JsonElement::GetBoolean
bool GetBoolean() const
Gets the value of the element as a Boolean.
Definition
JsonElement.cpp:371
DotNetDupe::System::Text::Json::JsonElement::Parse
static JsonElement Parse(const String &sJson)
Parses text representing a single JSON value into a JsonElement.
Definition
JsonElement.cpp:486
DotNetDupe::System::Text::Json::JsonElement::SetProperty
void SetProperty(const String &sPropertyName, const JsonElement &objValue)
Sets or replaces a property on the current JSON object.
Definition
JsonElement.cpp:424
DotNetDupe::System::Text::Json::JsonElement::GetDouble
double GetDouble() const
Gets the current JSON number as a double.
Definition
JsonElement.cpp:378
DotNetDupe::System::Text::Json
Definition
JsonElement.h:17
DotNetDupe::System::Text::Json::JsonValueKind
JsonValueKind
Specifies the data type of a JSON value.
Definition
JsonElement.h:21
DotNetDupe::System::Text::Json::JsonValueKind::Number
@ Number
Definition
JsonElement.h:26
DotNetDupe::System::Text::Json::JsonValueKind::Null
@ Null
Definition
JsonElement.h:29
DotNetDupe::System::Text::Json::JsonValueKind::Undefined
@ Undefined
Definition
JsonElement.h:22
DotNetDupe::System::Text::Json::JsonValueKind::True
@ True
Definition
JsonElement.h:27
DotNetDupe::System::Text::Json::JsonValueKind::False
@ False
Definition
JsonElement.h:28
DotNetDupe::System::Text
Definition
JsonElement.h:16
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
Text
Json
JsonElement.h
Generated by
1.18.0