3#include <system/span.h>
4#include <system/scope_guard.h>
5#include <system/multicast_delegate.h>
6#include <system/memory_extensions.h>
7#include <system/details/stack_array.h>
8#include <system/buffers/array_pool.h>
9#include <system/array.h>
10#include <system/buffers/standard_format.h>
11#include <system/buffers/operation_status.h>
14#include "system/text/json/json_constants.h"
20template <
typename>
class SearchValues;
30class JavaScriptEncoder;
77 if (firstByteToEscape == -1)
79 int32_t quotedLength = utf8Value.get_Length() + 2;
83 auto __finally_guard_1 = ::System::MakeScopeGuard([&rented]()
85 if (!(rented ==
nullptr))
93 System::Details::StackArray<uint8_t, System::Text::Json::JsonConstants::StackallocByteThreshold> array_0;
97 utf8Value.CopyTo(quotedValue.Slice(1));
100 return writeCallback(quotedValue);
115 auto __finally_guard_0 = ::System::MakeScopeGuard([&rented]()
117 if (!(rented ==
nullptr))
134 System::Details::StackArray<uint8_t, System::Text::Json::JsonConstants::StackallocByteThreshold> array_1;
135 escapedValue = array_1;
143 return writeCallback(escapedValue.Slice(0, written + 2));
170 static const String HexFormatString;
174 static bool NeedsEscapingNoBoundsCheck(
char16_t value);
176 static void EscapeNextBytes(uint8_t value,
Span<uint8_t> destination, int32_t& totalWritten);
177 static bool IsAsciiValue(uint8_t value);
178 static bool IsAsciiValue(
char16_t value);
180 static void EscapeNextChars(
char16_t value,
Span<char16_t> destination, int32_t& totalWritten);
182 static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
Provides a thread-safe pool for reusing managed array instances (ArrayPtr<T>).
Definition: array_pool.h:21
static SharedPtr< ArrayPool< T > > get_Shared()
Retrieves the process-wide shared pool instance. The instance is created lazily on first access and c...
Definition: array_pool.h:53
Represents a specific date and time value on the time continuum. This type should be allocated on sta...
Definition: date_time.h:50
Contains the date and time of day relative to Coordinated Universal Time. Objects of this class shoul...
Definition: date_time_offset.h:16
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Represents a contiguous region of arbitrary memory similar to C++20's std::span.
Definition: span.h:375
static ThisType to_Span(const typename BaseType::ArrayPtrT &array)
Converts an array to a Span.
Definition: span.h:402
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:126
static const uint8_t Quote
Definition: json_constants.h:33
static const int32_t StackallocByteThreshold
Definition: json_constants.h:107
Definition: json_writer_helper.h:43
static void ValidateNewLine(String value)
static void ValidateDouble(double value)
static void WriteDateTimeTrimmed(Span< uint8_t > buffer, DateTime value, int32_t &bytesWritten)
static void ValidateIndentSize(int32_t value)
T(*)(System::ReadOnlySpan< uint8_t >) WriteCallback
Definition: json_writer_helper.h:48
static void ValidateIndentCharacter(char16_t value)
static int32_t NeedsEscaping(ReadOnlySpan< uint8_t > value, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder)
static void ValidatePropertyNameLength(ReadOnlySpan< uint8_t > propertyName)
static void ValidatePropertyNameLength(ReadOnlySpan< char16_t > propertyName)
static void EscapeString(ReadOnlySpan< char16_t > value, Span< char16_t > destination, int32_t indexOfFirstByteToEscape, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder, int32_t &written)
static void EscapeString(ReadOnlySpan< uint8_t > value, Span< uint8_t > destination, int32_t indexOfFirstByteToEscape, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder, int32_t &written)
static void EscapeString(ReadOnlySpan< char16_t > value, Span< char16_t > destination, int32_t indexOfFirstByteToEscape, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder, int32_t &consumed, int32_t &written, bool isFinalBlock=true)
static void ValidatePropertyAndValue(ReadOnlySpan< uint8_t > propertyName, ReadOnlySpan< uint8_t > value)
JsonWriterHelper()=delete
static void ValidatePropertyAndValue(ReadOnlySpan< char16_t > propertyName, ReadOnlySpan< uint8_t > value)
static void ValidateProperty(ReadOnlySpan< uint8_t > propertyName)
static void ValidatePropertyAndValue(ReadOnlySpan< uint8_t > propertyName, ReadOnlySpan< char16_t > value)
static void EscapeString(ReadOnlySpan< uint8_t > value, Span< uint8_t > destination, int32_t indexOfFirstByteToEscape, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder, int32_t &consumed, int32_t &written, bool isFinalBlock=true)
static void WriteDateTimeOffsetTrimmed(Span< uint8_t > buffer, DateTimeOffset value, int32_t &bytesWritten)
static void WriteIndentation(Span< uint8_t > buffer, int32_t indent, uint8_t indentByte)
static T WriteString(ReadOnlySpan< uint8_t > utf8Value, JsonWriterHelper::WriteCallback< T > writeCallback)
Definition: json_writer_helper.h:73
static void ValidateSingle(float value)
static int32_t GetMaxEscapedLength(int32_t textLength, int32_t firstIndexToEscape)
static int32_t NeedsEscaping(ReadOnlySpan< char16_t > value, System::SharedPtr< Encodings::Web::JavaScriptEncoder > encoder)
static void ValidatePropertyAndValue(ReadOnlySpan< char16_t > propertyName, ReadOnlySpan< char16_t > value)
static void ValidateValue(ReadOnlySpan< char16_t > value)
static void ValidateNumber(ReadOnlySpan< uint8_t > utf8FormattedNumber)
static Buffers::OperationStatus ToUtf8(ReadOnlySpan< char16_t > source, Span< uint8_t > destination, int32_t &written)
static void ValidateProperty(ReadOnlySpan< char16_t > propertyName)
static void ValidateValue(ReadOnlySpan< uint8_t > value)
static const int32_t LastAsciiCharacter
Definition: json_writer_helper.h:52
static void TrimDateTimeOffset(Span< uint8_t > buffer, int32_t &bytesWritten)
OperationStatus
Represents the status of an operation that processes a buffer.
Definition: operation_status.h:11
@ Text
Defines color adjustment information for text.
Span< T > AsSpan(const ArrayPtr< T > &array, int32_t start=0, int32_t length=-1)
Creates a span from an array.
Definition: memory_extensions.h:2051
Definition: db_command.h:9