3#include <system/type_info.h>
4#include <system/object_ext.h>
5#include <system/default.h>
6#include <system/details/patterns.h>
9#include "system/text/json/serialization/json_serializer_options.h"
13template <
typename>
class ReadOnlySpan;
21class JsonSerializerOptions;
24template <
typename>
class JsonValuePrimitive;
32template <
typename,
typename>
class ArrayConverter;
33template <
typename>
class CastingConverter;
34template <
typename,
typename,
typename>
class DictionaryOfTKeyTValueConverter;
35template <
typename>
class IListConverter;
36template <
typename>
class JsonMetadataServicesConverter;
37template <
typename>
class LargeObjectWithParameterizedConstructorConverter;
38template <
typename,
typename>
class ListOfTConverter;
39template <
typename>
class NullableConverter;
41template <
typename>
class ObjectDefaultConverter;
42template <
typename>
class ObjectWithParameterizedConstructorConverter;
44template <
typename,
typename>
class JsonCollectionConverter;
50class JsonMetadataServices;
51class JsonPropertyInfoBase;
52class JsonTypeInfoBase;
53class PolymorphicTypeResolver;
54template <
typename>
class JsonPropertyInfo;
55template <
typename>
class JsonTypeInfo;
72namespace Serialization {
74template <
typename>
class JsonConverter;
80 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
81 ASPOSECPP_SHARED_RTTI_INFO_DECL();
155 template<
typename TTarget>
193 #ifdef ASPOSE_GET_SHARED_MEMBERS
194 void GetSharedMembers(System::Object::shared_members_type& result)
const override;
200 bool _converterStrategyInitialized;
201 bool pr_CanUseDirectReadOrWrite;
202 bool pr_CanBePolymorphic;
203 bool pr_SupportsMultipleTokenTypes;
204 bool pr_RequiresReadAhead;
206 bool pr_IsRootLevelMultiContentStreamingConverter;
207 bool pr_UsesDefaultHandleNull;
209 ASPOSECPP_SHARED_API
void set_UsesDefaultHandleNull(
bool value);
211 bool pr_HandleNullOnRead;
213 ASPOSECPP_SHARED_API
void init_HandleNullOnRead(
bool value);
215 bool pr_HandleNullOnWrite;
217 ASPOSECPP_SHARED_API
void init_HandleNullOnWrite(
bool value);
220 bool pr_IsInternalConverter;
221 bool pr_IsInternalConverterForNumberType;
222 bool pr_ConstructorIsParameterized;
242 if (
value ==
nullptr)
244 if (!System::IsNull(System::Default<T>()))
249 return System::Default<T>();
253 if (System::Is<T>(
value, typedValue))
259 return System::Default<T>();
265 if (
value ==
nullptr && !System::IsNull(System::Default<T>()))
270 return System::ExplicitCast<T>(
value);
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:51
static std::enable_if< std::is_fundamental< T >::value &&!std::is_enum< T >::value, constSystem::TypeInfo & >::type GetType()
Implements typeof() translation. Overload for primitive types.
Definition: object_type.h:94
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_serializer_helpers.h:91
Definition: json_value_of_t_primitive.h:47
Definition: read_stack_frame.h:42
Definition: read_stack.h:35
Definition: array_converter.h:32
Definition: casting_converter.h:48
Definition: dictionary_of_t_key_t_value_converter.h:36
Definition: i_list_converter.h:36
Definition: json_metadata_services_converter.h:38
Definition: object_with_parameterized_constructor_converter_large.h:36
Definition: list_of_t_converter.h:35
Definition: nullable_converter.h:52
Definition: object_converter.h:46
Definition: object_default_converter.h:64
Definition: object_with_parameterized_constructor_converter.h:64
Definition: json_converter.h:76
virtual System::TypeInfo get_KeyType()
virtual bool OnTryWriteAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, System::SharedPtr< JsonSerializerOptions > options, WriteStack &state)=0
bool get_RequiresReadAhead()
virtual void WriteAsPropertyNameCoreAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, System::SharedPtr< JsonSerializerOptions > options, bool isWritingExtensionDataProperty)=0
static bool ShouldFlush(WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer)
bool get_HandleNullOnWrite()
virtual System::SharedPtr< Object > ReadAsPropertyNameCoreAsObject(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options)=0
virtual System::SharedPtr< Object > ReadAsObject(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options)=0
virtual bool TryWriteAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, System::SharedPtr< JsonSerializerOptions > options, WriteStack &state)=0
virtual bool get_ConstructorIsParameterized()
virtual System::TypeInfo get_Type()=0
static void CheckConverterNullability(System::SharedPtr< JsonConverterBase > converter, const TypeInfo &propertyType)
virtual void ConfigureJsonTypeInfo(System::SharedPtr< Metadata::JsonTypeInfoBase > jsonTypeInfo, System::SharedPtr< JsonSerializerOptions > options)
bool get_IsInternalConverter()
bool get_SupportsMultipleTokenTypes()
virtual void ReadElementAndSetProperty(System::SharedPtr< Object > obj, String propertyName, Utf8JsonReader &reader, System::SharedPtr< JsonSerializerOptions > options, ReadStack &state)
virtual bool CanConvert(const System::TypeInfo &typeToConvert)=0
virtual System::SharedPtr< Object > ReadNumberWithCustomHandlingAsObject(Utf8JsonReader &reader, JsonNumberHandling handling, System::SharedPtr< JsonSerializerOptions > options)=0
System::SharedPtr< JsonConverterBase > ResolvePolymorphicConverter(System::SharedPtr< Metadata::JsonTypeInfoBase > jsonTypeInfo, ReadStack &state)
virtual void WriteAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, System::SharedPtr< JsonSerializerOptions > options)=0
virtual ~JsonConverterBase()
virtual bool OnTryReadAsObject(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options, ReadStack &state, System::SharedPtr< Object > &value)=0
virtual void WriteNumberWithCustomHandlingAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, JsonNumberHandling handling)=0
virtual System::SharedPtr< Metadata::JsonTypeInfoBase > CreateJsonTypeInfo(System::SharedPtr< JsonSerializerOptions > options)
virtual System::SharedPtr< Object > ReadAsPropertyNameAsObject(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options)=0
bool get_HandleNullOnRead()
bool get_IsRootLevelMultiContentStreamingConverter()
virtual JsonValueType GetSupportedJsonValueTypes(JsonNumberHandling numberHandling)
virtual void WriteAsPropertyNameAsObject(System::SharedPtr< Utf8JsonWriter > writer, System::SharedPtr< Object > value, System::SharedPtr< JsonSerializerOptions > options)=0
void init_CanBePolymorphic(bool value)
friend class JsonCollectionConverter
Definition: json_converter.h:94
bool get_CanUseDirectReadOrWrite()
void init_IsInternalConverterForNumberType(bool value)
virtual bool get_SupportsCreateObjectDelegate()
System::SharedPtr< JsonConverterBase > ResolvePolymorphicConverter(System::SharedPtr< Object > value, System::SharedPtr< Metadata::JsonTypeInfoBase > jsonTypeInfo, System::SharedPtr< JsonSerializerOptions > options, WriteStack &state)
virtual System::SharedPtr< JsonConverterBase > get_SourceConverterForCastingConverter()
virtual System::SharedPtr< JsonConverterBase > get_NullableElementConverter()
bool get_CanBePolymorphic()
void init_IsInternalConverter(bool value)
bool get_IsInternalConverterForNumberType()
void init_IsRootLevelMultiContentStreamingConverter(bool value)
System::Text::Json::ConverterStrategy get_ConverterStrategy()
void init_IsValueType(bool value)
virtual bool TryReadAsObject(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options, ReadStack &state, System::SharedPtr< Object > &value)=0
friend class JsonConverter
Definition: json_converter.h:97
System::SharedPtr< JsonConverter< TTarget > > CreateCastingConverter()
Definition: json_converter.h:156
void init_SupportsMultipleTokenTypes(bool value)
void init_ConverterStrategy(System::Text::Json::ConverterStrategy value)
virtual System::TypeInfo get_ElementType()
virtual bool get_CanHaveMetadata()
bool get_UsesDefaultHandleNull()
virtual bool get_IsConvertibleCollection()
void set_CanUseDirectReadOrWrite(bool value)
void set_RequiresReadAhead(bool value)
friend class JsonDictionaryConverter
Definition: json_converter.h:92
virtual bool get_CanPopulate()
virtual bool get_IsIeeeFloatingPointConverter()
Definition: json_converter_of_t.h:80
Definition: json_converter.h:45
Definition: json_metadata_services.h:118
Definition: json_property_info.h:80
Definition: json_property_info_of_t.h:69
Definition: json_type_info.h:106
Definition: json_type_info_of_t.h:84
Definition: utf8_json_reader.h:78
Definition: utf8_json_writer.h:81
Definition: write_stack_frame.h:44
Definition: write_stack.h:34
Represents a particular type and provides information about it.
Definition: type_info.h:109
@ Text
Defines color adjustment information for text.
T UnboxOnWrite(System::SharedPtr< Object > value)
Definition: json_converter.h:263
void ValidateMetadataForObjectConverter(ReadStack &state)
void ThrowDeserializeUnableToAssignNull(const TypeInfo &type)
float GetFlushThreshold()
MetadataPropertyName WriteMetadataForCollection(System::SharedPtr< JsonConverterBase > jsonConverter, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer)
ReadOnlySpan< uint8_t > GetPropertyName(ReadStack &state, Utf8JsonReader &reader, System::SharedPtr< JsonSerializerOptions > options, bool &isAlreadyReadMetadataProperty)
T UnboxOnRead(System::SharedPtr< Object > value)
Definition: json_converter.h:240
void CreateExtensionDataProperty(System::SharedPtr< Object > obj, System::SharedPtr< Metadata::JsonPropertyInfoBase > jsonPropertyInfo, System::SharedPtr< JsonSerializerOptions > options)
MetadataPropertyName WriteMetadataForObject(System::SharedPtr< JsonConverterBase > jsonConverter, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer)
void ThrowJsonExceptionUnableToConvertValue(const TypeInfo &type)
bool IsMetadataPropertyName(ReadOnlySpan< uint8_t > propertyName, System::SharedPtr< Metadata::PolymorphicTypeResolver > resolver)
void ThrowDeserializeUnableToAssignValue(const TypeInfo &valueType, const TypeInfo &targetType)
void ValidateMetadataForArrayConverter(System::SharedPtr< JsonConverterBase > converter, Utf8JsonReader &reader, ReadStack &state)
System::SharedPtr< Metadata::JsonPropertyInfoBase > LookupProperty(System::SharedPtr< Object > obj, ReadOnlySpan< uint8_t > unescapedPropertyName, ReadStack &state, System::SharedPtr< JsonSerializerOptions > options, bool &useExtensionProperty, bool createExtensionProperty=true)
bool TryReadMetadata(System::SharedPtr< JsonConverterBase > converter, System::SharedPtr< Metadata::JsonTypeInfoBase > jsonTypeInfo, Utf8JsonReader &reader, ReadStack &state)
JsonValueType
Definition: json_value_type.h:15
JsonNumberHandling
Definition: json_number_handling.h:16
MetadataPropertyName
Definition: metadata_property_name.h:13
ConverterStrategy
Definition: converter_strategy.h:13
Definition: db_command.h:9
SmartPtr< X > MakeSharedPtr(X *p)
Converts raw pointer to smart pointer.
Definition: smart_ptr.h:1640
std::enable_if<!IsSmartPtr< T >::value, SmartPtr< T > >::type MakeObject(Args &&... args)
Creates object on heap and returns shared pointer to it.
Definition: smart_ptr.h:1496
static auto SafeInvoke(T0 &&expr, T1 &&func)
Implementation of '?.' operator translation.
Definition: object_ext.h:1434