3#include <system/version.h>
5#include <system/type_info.h>
6#include <system/type_code.h>
7#include <system/timespan.h>
8#include <system/scope_guard.h>
9#include <system/object_ext.h>
10#include <system/nullable.h>
11#include <system/guid.h>
12#include <system/diagnostics/debug.h>
13#include <system/details/pointer_collection_helpers.h>
14#include <system/details/patterns.h>
15#include <system/default.h>
16#include <system/date_time_offset.h>
17#include <system/date_time.h>
20#include "system/text/json/document/json_value_kind.h"
21#include "system/text/json/throw_helper.h"
22#include "system/text/json/nodes/json_node_options.h"
23#include "system/text/json/nodes/json_value.h"
24#include "system/text/json/document/json_element.h"
35template <
typename>
class JsonValueCustomized;
36class JsonValueOfElement;
37template <
typename>
class JsonValuePrimitive;
51template<
typename TValue>
57 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
58 RTTI_INFO_TEMPLATE_CLASS(
ThisType, ThisTypeBaseTypesInfo);
72 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
73 RTTI_INFO_TEMPLATE_CLASS(
ThisType, ThisTypeBaseTypesInfo);
81 return _node->ToJsonString();
86 return System::ExplicitCast<JsonNode>(_node)->GetPath();
101 #ifdef ASPOSE_GET_SHARED_MEMBERS
102 void GetSharedMembers(System::Object::shared_members_type& result)
const override
104 Object::GetSharedMembers(result);
106 result.Add(
"System::Text::Json::Nodes::JsonValueBase::DebugView::_node", this->_node);
126 if (System::Is<T>(
Value, returnValue))
135 return System::Default<T>();
143 if (System::Is<T>(
Value, returnValue))
152 value = System::Default<T>();
161 System::Details::CollectionHelpers::SetWeakPointer(
Value);
171 System::Details::ThisProtector __local_self_ref(
this);
180 #ifdef ASPOSE_GET_SHARED_MEMBERS
181 void GetSharedMembers(System::Object::shared_members_type& result)
const override
183 JsonValueBase::GetSharedMembers(result);
185 result.Add(
"System::Text::Json::Nodes::JsonValueBase::Value", this->Value);
195 CODEPORTING_DEBUG_ASSERT2(!(s_valueKind ==
nullptr), u
"Should only be invoked for types that are supported primitives.");
197 return DetermineValueKindImpl(value, std::is_same<TValue, bool>());
200 static JsonValueKind DetermineValueKindImpl(TValue value, std::true_type)
206 static JsonValueKind DetermineValueKindImpl(TValue, std::false_type)
211 static Nullable<JsonValueKind> DetermineValueKindForType(
const TypeInfo& type)
213 if (type.get_IsEnum())
223 return DetermineValueKindForType(underlyingType);
226 if (type.Equals<DateTime>() || type.Equals<DateTimeOffset>() || type.Equals<TimeSpan>() || type.Equals<Guid>() || type.Equals<Uri>() || type.Equals<Version>())
231 if (type.Equals<
bool>())
236 if (type.Equals<int8_t>() || type.Equals<uint8_t>() ||
237 type.Equals<int16_t>() || type.Equals<uint16_t>() ||
238 type.Equals<int32_t>() || type.Equals<uint32_t>() ||
239 type.Equals<int64_t>() || type.Equals<uint64_t>() ||
240 type.Equals<
float>() || type.Equals<
double>() ||
241 type.Equals<Decimal>())
246 if (type.Equals<String>() || type.Equals<
char16_t>())
254 static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
258template<
typename TValue>
259Nullable<JsonValueKind> JsonValue<TValue>::s_valueKind;
Forward declaration.
Definition: nullable.h:75
T get_Value() const
Returns a copy of the value represented by the current object.
Definition: nullable.h:144
bool get_HasValue() const
Determines whether the current object represents any value.
Definition: nullable.h:162
static const System::TypeInfo & GetUnderlyingType(const System::TypeInfo &nullableType)
Returns the underlying type argument of the specified nullable type.
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:51
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:126
Definition: json_node.h:54
Definition: json_value.h:60
Definition: json_value_of_t_customized.h:49
Definition: json_value_of_t.h:53
virtual ~JsonValue()
Definition: json_value_of_t.h:176
static bool get_TypeIsSupportedPrimitive()
Definition: json_value_of_t.h:116
T GetValue()
Definition: json_value_of_t.h:122
TValue Value
Definition: json_value_of_t.h:114
bool TryGetValue(T &value)
Definition: json_value_of_t.h:139
void SetTemplateWeakPtr(uint32_t argument) override
Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containe...
Definition: json_value_of_t.h:156
JsonValue(TValue value, Nullable< JsonNodeOptions > options)
Definition: json_value_of_t.h:169
Definition: json_value_of_element.h:47
Definition: json_value_of_t_primitive.h:47
static void ThrowInvalidOperationException_NodeUnableToConvert(const TypeInfo &sourceType, const TypeInfo &destinationType)
@ Text
Defines color adjustment information for text.
@ TypeInfo
Specifies that the member is a type.
JsonValueKind
Definition: json_value_kind.h:12
Definition: db_command.h:9