CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
json_property_info.h
1#pragma once
2
3#include <system/type_info.h>
4#include <system/nullable.h>
5#include <system/func.h>
6#include <system/array.h>
7#include <system/action.h>
8#include <cstdint>
9#include <system/delegate.h>
10
11#include "system/text/json/serialization/json_number_handling.h"
12#include "system/text/json/serialization/json_ignore_condition.h"
13
14namespace System
15{
16namespace Collections
17{
18namespace Generic
19{
20template <typename, typename> class IDictionary;
21} // namespace Generic
22} // namespace Collections
23namespace Reflection
24{
25enum class MemberTypes;
26} // namespace Reflection
27namespace Text
28{
29namespace Json
30{
31class JsonSerializer;
32class JsonSerializerOptions;
33class ReadStack;
34class ReadStackFrame;
35namespace Serialization
36{
37namespace Converters
38{
39template <typename, typename> class ListOfTConverter;
40template <typename, typename> class QueueOfTConverter;
41template <typename, typename> class StackOfTConverter;
42template <typename> class StackOrQueueConverter;
43template <typename> class ObjectDefaultConverter;
44template <typename> class ObjectWithParameterizedConstructorConverter;
45} // namespace Converters
46template <typename, typename> class JsonCollectionConverter;
47template <typename> class JsonConverter;
48class JsonConverterBase;
49template <typename...> class JsonDictionaryConverter;
50namespace Metadata
51{
52class JsonMetadataServices;
53class JsonParameterInfoBase;
54class JsonParameterInfoValues;
55class JsonTypeInfoBase;
56class PolymorphicTypeResolver;
57template <typename> class JsonTypeInfo;
58} // namespace Metadata
59} // namespace Serialization
60class ThrowHelper;
61class Utf8JsonReader;
62class Utf8JsonWriter;
63class WriteStack;
64class WriteStackFrame;
65} // namespace Json
66} // namespace Text
67} // namespace System
68
69namespace System {
70
71namespace Text {
72
73namespace Json {
74
75namespace Serialization {
76
77namespace Metadata {
78
79class ASPOSECPP_SHARED_CLASS JsonPropertyInfoBase : public System::Object
80{
83
84 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
85 ASPOSECPP_SHARED_RTTI_INFO_DECL();
86
97 template<typename FT0, typename FT1> friend class System::Text::Json::Serialization::Converters::ListOfTConverter;
98 template<typename FT0, typename FT1> friend class System::Text::Json::Serialization::Converters::QueueOfTConverter;
99 template<typename FT0, typename FT1> friend class System::Text::Json::Serialization::Converters::StackOfTConverter;
100 template<typename FT0, typename FT1> friend class System::Text::Json::Serialization::JsonCollectionConverter;
101 template<typename FT0> friend class JsonPropertyInfo;
105 template<typename FT0> friend class System::Text::Json::Serialization::JsonConverter;
108
109public:
110
119 ASPOSECPP_SHARED_API bool get_IsGetNullable();
120 ASPOSECPP_SHARED_API void set_IsGetNullable(bool value);
121 ASPOSECPP_SHARED_API bool get_IsSetNullable();
122 ASPOSECPP_SHARED_API void set_IsSetNullable(bool value);
123 ASPOSECPP_SHARED_API bool get_IsExtensionData();
124 ASPOSECPP_SHARED_API void set_IsExtensionData(bool value);
125 ASPOSECPP_SHARED_API bool get_IsRequired();
126 ASPOSECPP_SHARED_API void set_IsRequired(bool value);
128 ASPOSECPP_SHARED_API const TypeInfo& get_DeclaringType();
129 ASPOSECPP_SHARED_API const TypeInfo& get_PropertyType();
130 ASPOSECPP_SHARED_API String get_Name();
131 ASPOSECPP_SHARED_API void set_Name(String value);
133 ASPOSECPP_SHARED_API int32_t get_Order();
134 ASPOSECPP_SHARED_API void set_Order(int32_t value);
136 ASPOSECPP_SHARED_API void set_NumberHandling(Nullable<JsonNumberHandling> value);
137
138protected:
139
141
145 ASPOSECPP_SHARED_API void set_IgnoreCondition(Nullable<JsonIgnoreCondition> value);
146 ASPOSECPP_SHARED_API String get_MemberName();
147 ASPOSECPP_SHARED_API void set_MemberName(String value);
149 ASPOSECPP_SHARED_API void set_MemberType(Reflection::MemberTypes value);
150 ASPOSECPP_SHARED_API bool get_IsVirtual();
151 ASPOSECPP_SHARED_API void set_IsVirtual(bool value);
153 ASPOSECPP_SHARED_API bool get_IsConfigured();
154 ASPOSECPP_SHARED_API bool get_HasGetter();
155 ASPOSECPP_SHARED_API bool get_HasSetter();
156 ASPOSECPP_SHARED_API void set_HasFastGetter(bool value);
157 ASPOSECPP_SHARED_API void set_HasFastSetter(bool value);
158 ASPOSECPP_SHARED_API bool get_IgnoreNullTokensOnRead();
159 ASPOSECPP_SHARED_API bool get_IgnoreDefaultValuesOnWrite();
160 ASPOSECPP_SHARED_API bool get_IsForTypeInfo();
161 ASPOSECPP_SHARED_API void init_IsForTypeInfo(bool value);
166 ASPOSECPP_SHARED_API bool get_IsPropertyTypeInfoConfigured();
167 ASPOSECPP_SHARED_API bool get_IsIgnored();
168 ASPOSECPP_SHARED_API bool get_CanSerialize();
169 ASPOSECPP_SHARED_API bool get_CanDeserialize();
170 ASPOSECPP_SHARED_API bool get_CanDeserializeOrPopulate();
171 ASPOSECPP_SHARED_API bool get_SrcGen_HasJsonInclude();
172 ASPOSECPP_SHARED_API void set_SrcGen_HasJsonInclude(bool value);
173 ASPOSECPP_SHARED_API bool get_SrcGen_IsPublic();
174 ASPOSECPP_SHARED_API void set_SrcGen_IsPublic(bool value);
176 ASPOSECPP_SHARED_API virtual bool get_PropertyTypeCanBeNull();
178 ASPOSECPP_SHARED_API int32_t get_PropertyIndex();
179 ASPOSECPP_SHARED_API void set_PropertyIndex(int32_t value);
180
182
184 ASPOSECPP_SHARED_API void Configure();
191 virtual bool ReadJsonAsObject(ReadStack& state, Utf8JsonReader& reader, System::SharedPtr<Object>& value) = 0;
192 ASPOSECPP_SHARED_API bool ReadJsonExtensionDataValue(ReadStack& state, Utf8JsonReader& reader, System::SharedPtr<Object>& value);
194 ASPOSECPP_SHARED_API bool TryGetPrePopulatedValue(ReadStack& state);
196
197 ASPOSECPP_SHARED_API virtual ~JsonPropertyInfoBase();
198
199 #ifdef ASPOSE_GET_SHARED_MEMBERS
200 void GetSharedMembers(System::Object::shared_members_type& result) const override;
201 #endif
202
203private:
204
206
208
209 System::SharedPtr<JsonConverterBase> _effectiveConverter;
213 bool _hasFastGetter;
214 bool _hasFastSetter;
215 bool _isUserSpecifiedSetter;
217 bool _isUserSpecifiedShouldSerialize;
218 Nullable<JsonIgnoreCondition> _ignoreCondition;
219
220 String pr_MemberName;
221 Reflection::MemberTypes pr_MemberType;
222 bool pr_IsVirtual;
223 bool _isGetNullable;
224 bool _isSetNullable;
225 bool _isExtensionData;
226 bool _isRequired;
227 System::SharedPtr<JsonParameterInfoBase> pr_AssociatedParameter;
228 TypeInfo pr_DeclaringType;
229 TypeInfo pr_PropertyType;
230 bool pr_IsConfigured;
231
232 void set_IsConfigured(bool value);
233
234 bool pr_IgnoreNullTokensOnRead;
235
236 void set_IgnoreNullTokensOnRead(bool value);
237
238 bool pr_IgnoreDefaultValuesOnWrite;
239
240 ASPOSECPP_SHARED_API void set_IgnoreDefaultValuesOnWrite(bool value);
241
242 bool pr_IsForTypeInfo;
243 String _name;
244 System::SharedPtr<Array<uint8_t>> pr_NameAsUtf8Bytes;
245
246 void set_NameAsUtf8Bytes(System::SharedPtr<Array<uint8_t>> value);
247
248 System::SharedPtr<Array<uint8_t>> pr_EscapedNameSection;
249
250 void set_EscapedNameSection(System::SharedPtr<Array<uint8_t>> value);
251
253 int32_t _order;
255 bool pr_CanSerialize;
256
257 void set_CanSerialize(bool value);
258
259 bool pr_CanDeserialize;
260
261 void set_CanDeserialize(bool value);
262
263 bool pr_CanDeserializeOrPopulate;
264
265 void set_CanDeserializeOrPopulate(bool value);
266
267 bool pr_SrcGen_HasJsonInclude;
268 bool pr_SrcGen_IsPublic;
269 Nullable<JsonNumberHandling> _numberHandling;
270 Nullable<JsonNumberHandling> pr_EffectiveNumberHandling;
271
272 void set_EffectiveNumberHandling(Nullable<JsonNumberHandling> value);
273
274 int32_t _propertyIndex;
275
276 String get_DebuggerDisplay();
277
278 virtual void SetGetter(Func<System::SharedPtr<Object>, System::SharedPtr<Object>> getter) = 0;
279 virtual void SetSetter(Action<System::SharedPtr<Object>, System::SharedPtr<Object>> setter) = 0;
280 virtual void SetShouldSerialize(Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool> value) = 0;
281 virtual void ConfigureIgnoreCondition(Nullable<JsonIgnoreCondition> ignoreCondition) = 0;
282 void VerifyMutable();
283 virtual void DetermineEffectiveConverter(System::SharedPtr<System::Text::Json::Serialization::Metadata::JsonTypeInfoBase> jsonTypeInfo) = 0;
284 void ValidateAndCachePropertyName();
285 void DetermineIgnoreCondition();
286 void DetermineSerializationCapabilities();
287 void DetermineNumberHandlingForTypeInfo();
288 void DetermineNumberHandlingForProperty();
289 bool NumberHandingIsApplicable();
290
291 template <typename TValue>
292 System::SharedPtr<JsonConverter<TValue>> GetDictionaryValueConverter();
293
294 template <typename TValue>
295 void AddProperty(const ReadStackFrame& current, System::SharedPtr<Collections::Generic::IDictionary<String, TValue>> d, TValue value);
296
297 static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
298
299};
300
301} // namespace Metadata
302} // namespace Serialization
303} // namespace Json
304} // namespace Text
305} // namespace System
Class that represents an array data structure. Objects of this class should only be allocated using S...
Definition: array.h:296
Interface for dictionary-alike containers. Objects of this class should only be allocated using Syste...
Definition: idictionary.h:21
Function delegate. This type should be allocated on stack and passed to functions by value or by refe...
Definition: func.h:82
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_serializer_helpers.h:91
Definition: read_stack_frame.h:42
Definition: read_stack.h:35
Definition: object_with_parameterized_constructor_converter.h:64
Definition: json_collection_converter.h:43
Definition: json_converter_of_t.h:80
void set_ShouldSerialize(Func< System::SharedPtr< Object >, System::SharedPtr< Object >, bool > value)
void EnsureChildOf(System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > parent)
virtual bool ReadJsonAsObject(ReadStack &state, Utf8JsonReader &reader, System::SharedPtr< Object > &value)=0
void set_Get(Func< System::SharedPtr< Object >, System::SharedPtr< Object > > value)
bool IsOverriddenOrShadowedBy(System::SharedPtr< JsonPropertyInfoBase > other)
void set_CustomConverter(System::SharedPtr< JsonConverterBase > value)
virtual System::SharedPtr< Object > GetValueAsObject(System::SharedPtr< Object > obj)=0
const System::SharedPtr< JsonSerializerOptions > & get_Options()
void set_AssociatedParameter(System::SharedPtr< JsonParameterInfoBase > value)
static System::SharedPtr< JsonPropertyInfoBase > GetPropertyPlaceholder()
bool ReadJsonAndAddExtensionProperty(System::SharedPtr< Object > obj, ReadStack &state, Utf8JsonReader &reader)
void set_IgnoreCondition(Nullable< JsonIgnoreCondition > value)
bool ReadJsonExtensionDataValue(ReadStack &state, Utf8JsonReader &reader, System::SharedPtr< Object > &value)
virtual System::SharedPtr< Object > get_DefaultValue()=0
const System::SharedPtr< JsonConverterBase > & get_EffectiveConverter()
friend class JsonParameterInfoBase
Definition: json_property_info.h:88
static System::SharedPtr< JsonPropertyInfoBase > s_missingProperty
Definition: json_property_info.h:140
friend class JsonPropertyInfo
Definition: json_property_info.h:101
const Func< System::SharedPtr< Object >, System::SharedPtr< Object > > & get_Get()
System::SharedPtr< Array< uint8_t > > get_NameAsUtf8Bytes()
System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > get_JsonTypeInfo()
void set_Set(Action< System::SharedPtr< Object >, System::SharedPtr< Object > > value)
const System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > & get_DeclaringTypeInfo()
virtual bool GetMemberAndWriteJson(System::SharedPtr< Object > obj, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer)=0
System::SharedPtr< JsonConverterBase > get_CustomConverter()
friend class JsonMetadataServices
Definition: json_property_info.h:87
System::SharedPtr< JsonParameterInfoBase > get_AssociatedParameter()
const Action< System::SharedPtr< Object >, System::SharedPtr< Object > > & get_Set()
void set_JsonTypeInfo(System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > value)
void set_NumberHandling(Nullable< JsonNumberHandling > value)
System::SharedPtr< Array< uint8_t > > get_EscapedNameSection()
virtual void AddJsonParameterInfo(System::SharedPtr< JsonParameterInfoValues > parameterInfoValues)=0
virtual bool ReadJsonAndSetMember(System::SharedPtr< Object > obj, ReadStack &state, Utf8JsonReader &reader)=0
virtual bool GetMemberAndWriteJsonExtensionData(System::SharedPtr< Object > obj, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer)=0
JsonPropertyInfoBase(const TypeInfo &declaringType, const TypeInfo &propertyType, System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > declaringTypeInfo, System::SharedPtr< JsonSerializerOptions > options)
const Func< System::SharedPtr< Object >, System::SharedPtr< Object >, bool > & get_ShouldSerialize()
Definition: throw_helper.h:91
Definition: utf8_json_reader.h:78
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.
MemberTypes
Marks each type of member.
Definition: member_types.h:11
Definition: db_command.h:9
MulticastDelegate< void(Args...)> Action
Delegate type that references methods that have no return value.
Definition: action.h:40