4#include <system/object.h>
5#include <system/span.h>
6#include <system/buffers/operation_status.h>
64 bool NeedsEscaping(uint8_t value)
const;
66 bool NeedsEscaping(
char16_t value)
const;
68 static bool IsHtmlSensitiveOrNonAscii(uint32_t value);
70 static bool IsContinuation(uint8_t b);
72 static int32_t Utf8SequenceLength(uint8_t b);
74 static bool TryDecodeUtf8(
ReadOnlySpan<uint8_t> buffer, int32_t start, int32_t length, uint32_t& scalar, int32_t& consumed);
76 static int32_t EscapeLengthAscii(uint8_t value);
78 static int32_t EscapeLengthScalar(uint32_t scalar);
80 static uint8_t HexDigitByte(uint32_t value);
82 static char16_t HexDigitChar(uint32_t value);
84 static void EscapeAsciiUtf8(uint8_t value,
Span<uint8_t> destination, int32_t& di);
86 static void EscapeScalarUtf8(uint32_t scalar,
Span<uint8_t> destination, int32_t& di);
88 static void WriteHexUtf8(uint32_t value,
Span<uint8_t> destination, int32_t& di);
90 static void EscapeScalarUtf16(uint32_t scalar,
Span<char16_t> destination, int32_t& di);
92 static void WriteHexUtf16(uint32_t value,
Span<char16_t> destination, int32_t& di);
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
Represents a contiguous region of arbitrary memory similar to C++20's std::span.
Definition: span.h:375
Represents a JavaScript/JSON text encoder used to escape characters that are not safe to embed direct...
Definition: javascript_encoder.h:22
int32_t FindFirstCharacterToEncode(const char16_t *text, int32_t textLength) const
Finds the index of the first UTF-16 character that needs to be escaped.
Buffers::OperationStatus EncodeUtf8(ReadOnlySpan< uint8_t > utf8Text, Span< uint8_t > destination, int32_t &bytesConsumed, int32_t &bytesWritten, bool isFinalBlock)
Escapes a UTF-8 input span into a UTF-8 destination span.
int32_t FindFirstCharacterToEncodeUtf8(ReadOnlySpan< uint8_t > utf8Text) const
Finds the index of the first UTF-8 byte that needs to be escaped.
Buffers::OperationStatus Encode(ReadOnlySpan< char16_t > text, Span< char16_t > destination, int32_t &charsConsumed, int32_t &charsWritten, bool isFinalBlock)
Escapes a UTF-16 input span into a UTF-16 destination span.
JavaScriptEncoder(bool relaxed)
Constructs an encoder in the default or relaxed mode.
static System::SharedPtr< JavaScriptEncoder > get_Default()
Returns the shared instance of the default encoder.
OperationStatus
Represents the status of an operation that processes a buffer.
Definition: operation_status.h:11
@ Text
Defines color adjustment information for text.
Definition: db_command.h:9