CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
time_span_converter.h
1#pragma once
2
3#include <system/timespan.h>
4#include <system/details/pointer_collection_helpers.h>
5#include <cstdint>
6
7#include "system/text/json/serialization/converters/value/json_primitive_converter.h"
8
9namespace System
10{
11namespace Text
12{
13namespace Json
14{
15class JsonSerializerOptions;
16namespace Serialization
17{
18enum class JsonNumberHandling;
19enum class JsonValueType : uint8_t;
20} // namespace Serialization
21class Utf8JsonReader;
22class Utf8JsonWriter;
23} // namespace Json
24} // namespace Text
25class TypeInfo;
26} // namespace System
27
28namespace System {
29
30namespace Text {
31
32namespace Json {
33
34namespace Serialization {
35
36namespace Converters {
37
38class TimeSpanConverter final : public JsonPrimitiveConverter<TimeSpan>
39{
42
43 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
44 RTTI_INFO_DECL();
45
46public:
47
51 void WriteAsPropertyNameCore(System::SharedPtr<Utf8JsonWriter> writer, TimeSpan value, System::SharedPtr<JsonSerializerOptions> options, bool isWritingExtensionDataProperty) override;
53 void SetTemplateWeakPtr(uint32_t argument) override;
54
55private:
56
57 static const int32_t MinimumTimeSpanFormatLength = 1;
58 static const int32_t MaximumTimeSpanFormatLength = 26;
59 static const int32_t MaximumEscapedTimeSpanFormatLength;
60
61 static TimeSpan ReadCore(Utf8JsonReader& reader);
62
63};
64
65} // namespace Converters
66} // namespace Serialization
67} // namespace Json
68} // namespace Text
69} // namespace System
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
void Write(System::SharedPtr< Utf8JsonWriter > writer, TimeSpan value, System::SharedPtr< JsonSerializerOptions > options) override
void WriteAsPropertyNameCore(System::SharedPtr< Utf8JsonWriter > writer, TimeSpan value, System::SharedPtr< JsonSerializerOptions > options, bool isWritingExtensionDataProperty) override
JsonValueType GetSupportedJsonValueTypes(JsonNumberHandling _) override
TimeSpan ReadAsPropertyNameCore(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options) override
TimeSpan Read(Utf8JsonReader &reader, const System::TypeInfo &typeToConvert, System::SharedPtr< JsonSerializerOptions > options) override
void SetTemplateWeakPtr(uint32_t argument) override
Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containe...
Definition: utf8_json_reader.h:78
Represents a time interval. This type should be allocated on stack and passed to functions by value o...
Definition: timespan.h:59
Represents a particular type and provides information about it.
Definition: type_info.h:109
@ Text
Defines color adjustment information for text.
@ TypeInfo
Specifies that the member is a type.
JsonValueType
Definition: json_value_type.h:15
JsonNumberHandling
Definition: json_number_handling.h:16
Definition: db_command.h:9