CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
json_property_info_of_t.h
1#pragma once
2
3#include <system/type_info.h>
4#include <system/span.h>
5#include <system/object_ext.h>
6#include <system/nullable.h>
7#include <system/func.h>
8#include <system/diagnostics/debug.h>
9#include <system/details/pointer_collection_helpers.h>
10#include <system/details/patterns.h>
11#include <system/details/lambda_capture_holder.h>
12#include <system/delegate.h>
13#include <system/default.h>
14#include <system/array.h>
15#include <system/action.h>
16#include <functional>
17#include <cstdint>
18#include <type_traits>
19
20#include "system/text/json/serialization/json_converter.h"
21#include "system/text/json/serialization/converters/casting_converter.h"
22#include "system/text/json/serialization/json_serializer_options.h"
23#include "system/text/json/serialization/metadata/json_parameter_info_values.h"
24#include "system/text/json/serialization/metadata/json_property_info.h"
25#include "system/text/json/serialization/metadata/json_parameter_info.h"
26#include "system/text/json/serialization/metadata/json_parameter_info_of_t.h"
27#include "system/text/json/serialization/write_stack.h"
28#include "system/text/json/writer/utf8_json_writer.h"
29#include "system/text/json/serialization/converter_strategy.h"
30#include "system/text/json/throw_helper.h"
31#include "system/text/json/serialization/write_stack_frame.h"
32#include "system/text/json/serialization/stack_frame_property_state.h"
33#include "system/text/json/serialization/read_stack.h"
34#include "system/text/json/reader/utf8_json_reader.h"
35#include "system/text/json/json_token_type.h"
36#include "system/text/json/serialization/read_stack_frame.h"
37#include "system/text/json/serialization/json_ignore_condition.h"
38
39namespace System
40{
41namespace Text
42{
43namespace Json
44{
45namespace Serialization
46{
47template <typename> class JsonConverter;
48namespace Metadata
49{
50template <typename> class JsonParameterInfo;
51} // namespace Metadata
52} // namespace Serialization
53} // namespace Json
54} // namespace Text
55} // namespace System
56
57namespace System {
58
59namespace Text {
60
61namespace Json {
62
63namespace Serialization {
64
65namespace Metadata {
66
67template<typename T>
69{
72
73 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
74 RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo);
75
76public:
77
79 {
80 return _typedGet;
81 }
82
84 {
85 _fastGet = nullptr;
86 set_HasFastGetter(false);
87 SetGetter(value);
88 }
89
91 {
92 return _typedSet;
93 }
94
96 {
97 _fastSet = nullptr;
98 set_HasFastSetter(false);
99 SetSetter(value);
100 }
101
103 {
104 return _shouldSerializeTyped;
105 }
106
108 {
109 _fastShouldSerialize = nullptr;
110 SetShouldSerialize(value);
111 }
112
114 {
115 return System::ExplicitCast<System::Object>(System::Default<T>());
116 }
117
119 {
120 return System::IsNull(System::Default<T>());
121 }
122
124 {
125
126 return _typedEffectiveConverter;
127 }
128
132
134 {
135 return _fastGet;
136 }
137
139 {
140 return _fastSet;
141 }
142
144 {
145 return _fastShouldSerialize;
146 }
147
149 {
150 _fastGet = value;
151 _typedGet = nullptr;
152 set_HasFastGetter(value != nullptr);
153 }
154
156 {
157 _fastSet = value;
158 _typedSet = nullptr;
159 set_HasFastSetter(value != nullptr);
160 }
161
163 {
164 _fastShouldSerialize = value;
165 _shouldSerializeTyped = nullptr;
166 }
167
169 : JsonPropertyInfoBase(declaringType, System::ObjectExt::GetType<T>(), declaringTypeInfo, options)
170 {
171 }
172
174 {
175
177 // Overwrite the nullability annotation of property setter with the parameter.
178 _isSetNullable = parameterInfoValues->get_IsNullable();
179
180 }
181
183 {
184 if (get_IsForTypeInfo())
185 {
186 return obj;
187 }
188
189 return System::ExplicitCast<System::Object>(_fastGet != nullptr ? _fastGet(obj) : get_Get()(obj));
190 }
191
193 {
194 const auto& effectiveConverter = get_EffectiveConverter();
195 const auto& options = get_Options();
196 T value = _fastGet != nullptr ? _fastGet(obj) : get_Get()(obj);
197
199 {
200 // Fast path `ShouldSerialize` check when using JsonIgnoreCondition.WhenWritingNull/Default configuration
201 if (IsDefaultValue(value))
202 {
203 return true;
204 }
205 }
206 else if (_fastShouldSerialize != nullptr ? !_fastShouldSerialize(obj, value) : System::SafeInvoke(get_ShouldSerialize(), [&](auto&& expr){return expr(obj, value);}) == false)
207 {
208 // We return true here.
209 // False means that there is not enough data.
210 return true;
211 }
212
213 if (System::IsNull(value))
214 {
215
216 if (effectiveConverter->get_HandleNullOnWrite())
217 {
219 {
221 writer->WritePropertyNameSection(ReadOnlySpan<uint8_t>::to_ReadOnlySpan(get_EscapedNameSection()));
222 }
223
224 int32_t originalDepth = writer->get_CurrentDepth();
225 effectiveConverter->Write(writer, value, options);
226 if (originalDepth != writer->get_CurrentDepth())
227 {
229 }
230 }
231 else
232 {
234 }
235
236 return true;
237 }
238 else
239 {
241 {
243 writer->WritePropertyNameSection(ReadOnlySpan<uint8_t>::to_ReadOnlySpan(get_EscapedNameSection()));
244 }
245
246 return effectiveConverter->TryWrite(writer, value, options, System::Ref(state));
247 }
248 }
249
251 {
252 bool success;
253 const auto& effectiveConverter = get_EffectiveConverter();
254 const auto& options = get_Options();
255 T value = _fastGet != nullptr ? _fastGet(obj) : get_Get()(obj);
256
257 if (_fastShouldSerialize != nullptr ? !_fastShouldSerialize(obj, value) : System::SafeInvoke(get_ShouldSerialize(), [&](auto&& expr){return expr(obj, value);}) == false)
258 {
259 // We return true here.
260 // False means that there is not enough data.
261 return true;
262 }
263
264 if (System::IsNull(value))
265 {
266 success = true;
267 }
268 else
269 {
270 success = effectiveConverter->TryWriteDataExtensionProperty(writer, value, options, System::Ref(state));
271 }
272
273 return success;
274 }
275
277 {
278 bool success;
279 const auto& effectiveConverter = get_EffectiveConverter();
280 const auto& options = get_Options();
281 const auto& propertyType = get_PropertyType();
282 const auto& setter = get_Set();
283 auto setValue = [&](const T& value) { if (_fastSet != nullptr) _fastSet(obj, value); else setter(obj, value); };
284
285 bool isNullToken = reader.get_TokenType() == System::Text::Json::JsonTokenType::Null;
286
287 if (isNullToken && !effectiveConverter->get_HandleNullOnRead() && !state.get_IsContinuation())
288 {
289 if (!System::IsNull(System::Default<T>()) || !get_CanDeserialize())
290 {
291 if (System::IsNull(System::Default<T>()))
292 {
293
295 }
296
298 }
299
301 {
302 T value = System::Default<T>();
303 setValue(value);
304 }
305
306 success = true;
307 state.Current.MarkPropertyAsRead(this);
308 }
309 else if (effectiveConverter->get_CanUseDirectReadOrWrite() && state.Current.NumberHandling == nullptr)
310 {
311 // CanUseDirectReadOrWrite == false when using streams
312
313 if (!isNullToken || !get_IgnoreNullTokensOnRead() || !System::IsNull(System::Default<T>()))
314 {
315 // Optimize for internal converters by avoiding the extra call to TryRead.
316 T fastValue = effectiveConverter->Read(System::Ref(reader), propertyType, options);
317
318 setValue(fastValue);
319 }
320
321 success = true;
322 state.Current.MarkPropertyAsRead(this);
323 }
324 else
325 {
326 success = true;
327 if (!isNullToken || !get_IgnoreNullTokensOnRead() || !System::IsNull(System::Default<T>()) || state.get_IsContinuation())
328 {
329 state.Current.ReturnValue = obj;
330
331 T value; bool populatedValue;
332 success = effectiveConverter->TryRead(System::Ref(reader), propertyType, options, System::Ref(state), value, populatedValue);
333 if (success)
334 {
335 if (System::ObjectExt::GetType<T>().get_IsValueType() || !populatedValue)
336 {
337 // note: populatedValue value may be different than when CreationHandling is Populate
338 // i.e. when initial value of property is null
339
340 // We cannot do reader.Skip early because converter decides if populating will happen or not
341 if (get_CanDeserialize())
342 {
343 setValue(value);
344 }
345 }
346
347 state.Current.MarkPropertyAsRead(this);
348 }
349 }
350 }
351
352 return success;
353 }
354
356 {
357 bool success;
358 const auto& effectiveConverter = get_EffectiveConverter();
359 const auto& options = get_Options();
360 const auto& propertyType = get_PropertyType();
361 bool isNullToken = reader.get_TokenType() == System::Text::Json::JsonTokenType::Null;
362 if (isNullToken && !effectiveConverter->get_HandleNullOnRead() && !state.get_IsContinuation())
363 {
364 if (!System::IsNull(System::Default<T>()))
365 {
367 }
368
369 value = System::ExplicitCast<System::Object>(System::Default<T>());
370 success = true;
371 }
372 else
373 {
374 // Optimize for internal converters by avoiding the extra call to TryRead.
375 if (effectiveConverter->get_CanUseDirectReadOrWrite() && state.Current.NumberHandling == nullptr)
376 {
377 // CanUseDirectReadOrWrite == false when using streams
378
379 value = System::ExplicitCast<System::Object>(effectiveConverter->Read(System::Ref(reader), propertyType, options));
380 success = true;
381 }
382 else
383 {
384 T typedValue;
385 success = effectiveConverter->TryRead(System::Ref(reader), propertyType, options, System::Ref(state), typedValue, System::Discard<bool>());
386 value = System::ExplicitCast<System::Object>(typedValue);
387 }
388 }
389
390 return success;
391 }
392
393 void SetTemplateWeakPtr(uint32_t argument) override
394 {
395 switch (argument)
396 {
397 case 0:
398 System::Details::CollectionHelpers::SetWeakPointer(0, _typedGet);
399 System::Details::CollectionHelpers::SetWeakPointer(2, _typedSet);
400 System::Details::CollectionHelpers::SetWeakPointer(2, _shouldSerializeTyped);
401 System::Details::CollectionHelpers::SetWeakPointer(0, _typedEffectiveConverter);
402 break;
403
404 }
405 }
406
407protected:
408
410 {
411 }
412
413 #ifdef ASPOSE_GET_SHARED_MEMBERS
414 void GetSharedMembers(System::Object::shared_members_type& result) const override
415 {
416 JsonPropertyInfoBase::GetSharedMembers(result);
417
418 result.Add("System::Text::Json::Serialization::Metadata::JsonPropertyInfoBase::_typedGet", this->_typedGet);
419 result.Add("System::Text::Json::Serialization::Metadata::JsonPropertyInfoBase::_typedSet", this->_typedSet);
420 result.Add("System::Text::Json::Serialization::Metadata::JsonPropertyInfoBase::_shouldSerializeTyped", this->_shouldSerializeTyped);
421 result.Add("System::Text::Json::Serialization::Metadata::JsonPropertyInfoBase::_typedEffectiveConverter", this->_typedEffectiveConverter);
422 }
423 #endif
424
425private:
426
427 Func<System::SharedPtr<Object>, T> _typedGet;
429 Func<System::SharedPtr<Object>, T, bool> _shouldSerializeTyped;
430 System::SharedPtr<JsonConverter<T>> _typedEffectiveConverter;
431 GetterFn _fastGet = nullptr;
432 SetterFn _fastSet = nullptr;
433 ShouldSerializeFn _fastShouldSerialize = nullptr;
434
435 template <class TEnable = T, typename std::enable_if<!std::is_same<TEnable, System::SharedPtr<System::Object>>::value, int>::type = 0>
436 void SetGetter(Func<System::SharedPtr<Object>, T> getter)
437 {
438 System::Details::LambdaCaptureHolder<Func<System::SharedPtr<Object>, T>> _lch_getter = getter;
439 Func<System::SharedPtr<Object>, T> &_getter = _lch_getter.GetCapture();
440 if (System::IsNull(_getter))
441 {
442 _typedGet = nullptr;
443 _untypedGet = nullptr;
444 return;
445 }
446 _typedGet = _getter;
447 _untypedGet = static_cast<Func<System::SharedPtr<Object>, System::SharedPtr<Object>>>(static_cast<std::function<System::SharedPtr<System::Object>(System::SharedPtr<Object> obj)>>([_lch_getter, &_getter](System::SharedPtr<Object> obj) -> System::SharedPtr<System::Object>
448 {
449 return System::ExplicitCast<System::Object>(_getter(obj));
450 })).template AddHeldVariable<Func<System::SharedPtr<Object>, System::SharedPtr<Object>>>("_getter", _getter);
451 }
452
453 void SetGetter(Func<System::SharedPtr<Object>, System::SharedPtr<Object>> getter) override
454 {
455 System::Details::LambdaCaptureHolder<Func<System::SharedPtr<Object>, System::SharedPtr<Object>>> _lch_getter = getter;
456 Func<System::SharedPtr<Object>, System::SharedPtr<Object>> &_getter = _lch_getter.GetCapture();
457 if (_getter == nullptr)
458 {
459 _typedGet = nullptr;
460 _untypedGet = nullptr;
461 return;
462 }
463 _typedGet = static_cast<Func<System::SharedPtr<Object>, T>>(static_cast<std::function<T(System::SharedPtr<Object> obj)>>([_lch_getter, &_getter](System::SharedPtr<Object> obj) -> T
464 {
465 return System::ExplicitCast<T>(_getter(obj));
466 })).template AddHeldVariable<Func<System::SharedPtr<Object>, T>>("_getter", _getter);
467 _untypedGet = _getter;
468 }
469
470 void SetSetter(Action<System::SharedPtr<Object>, System::SharedPtr<Object>> setter) override
471 {
472 System::Details::LambdaCaptureHolder<Action<System::SharedPtr<Object>, System::SharedPtr<Object>>> _lch_setter = setter;
473 Action<System::SharedPtr<Object>, System::SharedPtr<Object>> &_setter = _lch_setter.GetCapture();
474 if (_setter == nullptr)
475 {
476 _typedSet = nullptr;
477 _untypedSet = nullptr;
478 return;
479 }
480 _typedSet = static_cast<Action<System::SharedPtr<Object>, T>>(static_cast<std::function<void(System::SharedPtr<Object> obj, T value)>>([_lch_setter, &_setter](System::SharedPtr<Object> obj, T value) -> void
481 {
482 _setter(obj, System::ExplicitCast<System::Object>(value));
483 })).template AddHeldVariable<Action<System::SharedPtr<Object>, T>>("_setter", _setter);
484 _untypedSet = _setter;
485 }
486
487 template <class TEnable = T, typename std::enable_if<!std::is_same<TEnable, System::SharedPtr<System::Object>>::value, int>::type = 0>
488 void SetSetter(Action<System::SharedPtr<Object>, T> setter)
489 {
490 System::Details::LambdaCaptureHolder<Action<System::SharedPtr<Object>, T>> _lch_setter = setter;
491 Action<System::SharedPtr<Object>, T> &_setter = _lch_setter.GetCapture();
492 if (System::IsNull(_setter))
493 {
494 _typedSet = nullptr;
495 _untypedSet = nullptr;
496 return;
497 }
498 _typedSet = _setter;
499 _untypedSet = static_cast<Action<System::SharedPtr<Object>, System::SharedPtr<Object>>>(static_cast<std::function<void(System::SharedPtr<Object> obj, System::SharedPtr<Object> value)>>([_lch_setter, &_setter](System::SharedPtr<Object> obj, System::SharedPtr<Object> value) -> void
500 {
501 _setter(obj, System::ExplicitCast<T>(value));
502 })).template AddHeldVariable<Action<System::SharedPtr<Object>, System::SharedPtr<Object>>>("_setter", _setter);
503 }
504
505 template <class TEnable = T, typename std::enable_if<!std::is_same<TEnable, System::SharedPtr<System::Object>>::value, int>::type = 0>
506 void SetShouldSerialize(Func<System::SharedPtr<Object>, T, bool> predicate)
507 {
508 System::Details::LambdaCaptureHolder<Func<System::SharedPtr<Object>, T, bool>> _lch_predicate = predicate;
509 Func<System::SharedPtr<Object>, T, bool> &_predicate = _lch_predicate.GetCapture();
510 if (System::IsNull(_predicate))
511 {
512 _shouldSerializeTyped = nullptr;
513 _shouldSerialize = nullptr;
514 return;
515 }
516 _shouldSerializeTyped = _predicate;
517 _shouldSerialize = static_cast<Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool>>(static_cast<std::function<bool(System::SharedPtr<Object> obj, System::SharedPtr<Object> value)>>([_lch_predicate, &_predicate](System::SharedPtr<Object> obj, System::SharedPtr<Object> value) -> bool
518 {
519 return _predicate(obj, System::ExplicitCast<T>(value));
520 })).template AddHeldVariable<Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool>>("_predicate", _predicate);
521 }
522
523 void SetShouldSerialize(Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool> predicate) override
524 {
525 if (predicate == nullptr)
526 {
527 _shouldSerializeTyped = nullptr;
528 _shouldSerialize = nullptr;
529 return;
530 }
531 System::Details::LambdaCaptureHolder<Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool>> _lch_untypedPredicate = predicate;
532 Func<System::SharedPtr<Object>, System::SharedPtr<Object>, bool> &untypedPredicate = _lch_untypedPredicate.GetCapture();
533 _shouldSerializeTyped = static_cast<Func<System::SharedPtr<Object>, T, bool>>(static_cast<std::function<bool(System::SharedPtr<Object> obj, T value)>>([_lch_untypedPredicate, &untypedPredicate](System::SharedPtr<Object> obj, T value) -> bool
534 {
535 return untypedPredicate(obj, System::ExplicitCast<System::Object>(value));
536 })).template AddHeldVariable<Func<System::SharedPtr<Object>, T, bool>>("untypedPredicate", untypedPredicate);
537 _shouldSerialize = untypedPredicate;
538 }
539
540 void DetermineEffectiveConverter(System::SharedPtr<System::Text::Json::Serialization::Metadata::JsonTypeInfoBase> jsonTypeInfo) override
541 {
542
543 System::SharedPtr<JsonConverter<T>> converter = System::SafeInvoke(get_Options()->ExpandConverterFactory(get_CustomConverter(), get_PropertyType()), [&](auto&& expr){return expr->template CreateCastingConverter<T>();}) != nullptr ? System::SafeInvoke(get_Options()->ExpandConverterFactory(get_CustomConverter(), get_PropertyType()), [&](auto&& expr){return expr->template CreateCastingConverter<T>();}) : (System::ExplicitCast<System::Text::Json::Serialization::Metadata::JsonTypeInfo<T>>(jsonTypeInfo))->get_EffectiveConverter();
544 // Fall back to the effective converter for the type.
545
546 _effectiveConverter = converter;
547 _typedEffectiveConverter = converter;
548 }
549
550 static bool ShouldSerializeIgnoreConditionNever(System::SharedPtr<Object>, T)
551 {
552 return true;
553 }
554
555 static bool ShouldSerializeIgnoreConditionAlways(System::SharedPtr<Object>, T)
556 {
557 return false;
558 }
559
560 static bool ShouldSerializeIgnoreWhenWritingDefault(System::SharedPtr<Object>, T value)
561 {
562 return !IsDefaultValue(value);
563 }
564
565 void SetBuiltInShouldSerialize(ShouldSerializeFn predicate)
566 {
567 // Clear any delegate-based predicate before installing the built-in fast path.
568 SetShouldSerialize(static_cast<Func<System::SharedPtr<Object>, T, bool>>(nullptr));
569 _fastShouldSerialize = predicate;
570 }
571
572 void ConfigureIgnoreCondition(Nullable<JsonIgnoreCondition> ignoreCondition) override
573 {
574 if (ignoreCondition == nullptr)
575 {
576 }
577 else if (System::Is(ignoreCondition, System::Text::Json::Serialization::JsonIgnoreCondition::Never))
578 {
579 SetBuiltInShouldSerialize(&ShouldSerializeIgnoreConditionNever);
580 }
581 else if (System::Is(ignoreCondition, System::Text::Json::Serialization::JsonIgnoreCondition::Always))
582 {
583 SetBuiltInShouldSerialize(&ShouldSerializeIgnoreConditionAlways);
584 }
586 {
588 {
589 SetBuiltInShouldSerialize(&ShouldSerializeIgnoreWhenWritingDefault);
590 set_IgnoreDefaultValuesOnWrite(true);
591 }
592 else
593 {
595 }
596 }
598 {
599 SetBuiltInShouldSerialize(&ShouldSerializeIgnoreWhenWritingDefault);
600 set_IgnoreDefaultValuesOnWrite(true);
601 }
603 {
604 SetBuiltInShouldSerialize(&ShouldSerializeIgnoreConditionAlways);
605 }
607 {
608 set_Set(nullptr);
609 }
610 else
611 {
612 CODEPORTING_DEBUG_FAIL1(System::String::Format(u"Unknown value of JsonIgnoreCondition '{0}'", ignoreCondition));
613 }
614 }
615
616 static bool IsDefaultValue(T value)
617 {
618 return System::IsNull(System::Default<T>()) ? System::IsNull(value) : Default<T>() == value;
619 }
620};
621
622} // namespace Metadata
623} // namespace Serialization
624} // namespace Json
625} // namespace Text
626} // namespace System
Function delegate. This type should be allocated on stack and passed to functions by value or by refe...
Definition: func.h:82
Provides static methods that emulate C# Object methods called for non-Object C++ types (strings,...
Definition: object_ext.h:23
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:51
virtual const TypeInfo & GetType() const
Gets actual type of object. Analog of C# System.Object.GetType() call.
Forward to use within Span class.
Definition: span.h:415
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1449
Nullable< Serialization::JsonNumberHandling > NumberHandling
Definition: read_stack_frame.h:73
void MarkPropertyAsRead(System::Text::Json::Serialization::Metadata::JsonPropertyInfoBase *propertyInfo)
System::SharedPtr< Object > ReturnValue
Definition: read_stack_frame.h:59
Definition: read_stack.h:35
ReadStackFrame Current
Definition: read_stack.h:44
const System::SharedPtr< JsonSerializerOptions > & get_Options()
void set_AssociatedParameter(System::SharedPtr< JsonParameterInfoBase > value)
System::SharedPtr< JsonConverterBase > get_CustomConverter()
System::SharedPtr< Array< uint8_t > > get_EscapedNameSection()
SetterFn get_FastSetter() const
Definition: json_property_info_of_t.h:138
void set_SetFast(SetterFn value)
Definition: json_property_info_of_t.h:155
bool ReadJsonAndSetMember(System::SharedPtr< Object > obj, ReadStack &state, Utf8JsonReader &reader) override
Definition: json_property_info_of_t.h:276
bool(*)(System::SharedPtr< Object >, T) ShouldSerializeFn
Definition: json_property_info_of_t.h:131
System::SharedPtr< Object > get_DefaultValue() override
Definition: json_property_info_of_t.h:113
void set_Get(Func< System::SharedPtr< Object >, T > value)
Definition: json_property_info_of_t.h:83
void set_ShouldSerializeFast(ShouldSerializeFn value)
Definition: json_property_info_of_t.h:162
void SetTemplateWeakPtr(uint32_t argument) override
Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containe...
Definition: json_property_info_of_t.h:393
void AddJsonParameterInfo(System::SharedPtr< JsonParameterInfoValues > parameterInfoValues) override
Definition: json_property_info_of_t.h:173
const System::SharedPtr< JsonConverter< T > > & get_EffectiveConverter()
Definition: json_property_info_of_t.h:123
bool GetMemberAndWriteJson(System::SharedPtr< Object > obj, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer) override
Definition: json_property_info_of_t.h:192
void set_ShouldSerialize(Func< System::SharedPtr< Object >, T, bool > value)
Definition: json_property_info_of_t.h:107
const Action< System::SharedPtr< Object >, T > & get_Set()
Definition: json_property_info_of_t.h:90
System::SharedPtr< Object > GetValueAsObject(System::SharedPtr< Object > obj) override
Definition: json_property_info_of_t.h:182
GetterFn get_FastGetter() const
Definition: json_property_info_of_t.h:133
void(*)(System::SharedPtr< Object >, T) SetterFn
Definition: json_property_info_of_t.h:130
T(*)(System::SharedPtr< Object >) GetterFn
Definition: json_property_info_of_t.h:129
void set_Set(Action< System::SharedPtr< Object >, T > value)
Definition: json_property_info_of_t.h:95
JsonPropertyInfo(const TypeInfo &declaringType, System::SharedPtr< System::Text::Json::Serialization::Metadata::JsonTypeInfoBase > declaringTypeInfo, System::SharedPtr< JsonSerializerOptions > options)
Definition: json_property_info_of_t.h:168
ShouldSerializeFn get_FastShouldSerialize() const
Definition: json_property_info_of_t.h:143
const Func< System::SharedPtr< Object >, T, bool > & get_ShouldSerialize()
Definition: json_property_info_of_t.h:102
bool GetMemberAndWriteJsonExtensionData(System::SharedPtr< Object > obj, WriteStack &state, System::SharedPtr< Utf8JsonWriter > writer) override
Definition: json_property_info_of_t.h:250
virtual ~JsonPropertyInfo()
Definition: json_property_info_of_t.h:409
void set_GetFast(GetterFn value)
Definition: json_property_info_of_t.h:148
bool get_PropertyTypeCanBeNull() override
Definition: json_property_info_of_t.h:118
const Func< System::SharedPtr< Object >, T > & get_Get()
Definition: json_property_info_of_t.h:78
bool ReadJsonAsObject(ReadStack &state, Utf8JsonReader &reader, System::SharedPtr< Object > &value) override
Definition: json_property_info_of_t.h:355
static void ThrowInvalidOperationException_DeserializeUnableToAssignNull(const TypeInfo &declaredType)
static void ThrowJsonException_DeserializeUnableToConvertValue(const TypeInfo &propertyType)
static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(String clrPropertyName, const TypeInfo &propertyDeclaringType)
static void ThrowJsonException_SerializationConverterWrite(System::SharedPtr< Serialization::JsonConverterBase > converter)
Definition: utf8_json_reader.h:78
StackFramePropertyState PropertyState
Definition: write_stack_frame.h:60
Definition: write_stack.h:34
WriteStackFrame Current
Definition: write_stack.h:45
Represents a particular type and provides information about it.
Definition: type_info.h:109
@ Text
Defines color adjustment information for text.
Definition: db_command.h:9
MulticastDelegate< void(Args...)> Action
Delegate type that references methods that have no return value.
Definition: action.h:40
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
decltype(Ref(std::declval< T & >())) Ref(const std::reference_wrapper< T > &wrapper)
Wrapper to make sure Ref(std::ref(DynamicWeakPtr)) works.
Definition: dynamic_weak_ptr.h:207
static auto SafeInvoke(T0 &&expr, T1 &&func)
Implementation of '?.' operator translation.
Definition: object_ext.h:1434
std::enable_if_t< Details::CastType< Source, Result >::None, Result > ExplicitCast(const Source &value)
Casts the source type to the result type using explicit cast. Used when the source and the result typ...
Definition: object_ext.h:960
std::enable_if< IsExceptionWrapper< T >::value, constT & >::type Default()
Returns the reference to the single default-constructed instance of the exception type.
Definition: default.h:16