4#include <system/span.h>
5#include <system/buffers/operation_status.h>
6#include <system/exceptions.h>
17 static constexpr uint32_t HighSurrogateStart = 0xD800u;
18 static constexpr uint32_t LowSurrogateStart = 0xDC00u;
19 static constexpr uint32_t HighSurrogateRange = 0x3FFu;
25 ASPOSECPP_SHARED_API
Rune();
30 ASPOSECPP_SHARED_API
Rune(int32_t value);
35 ASPOSECPP_SHARED_API
Rune(uint32_t value);
48 static ASPOSECPP_SHARED_API
bool TryCreate(
char16_t highSurrogate,
char16_t lowSurrogate,
Rune& result);
71 static Rune UnsafeCreate(uint32_t scalarValue);
73 static Rune ReplacementChar();
75 static bool IsAsciiCodePoint(uint32_t value);
77 static bool IsInRangeInclusive(uint32_t value, uint32_t lowerBound, uint32_t upperBound);
79 static bool IsSurrogateCodePoint(uint32_t value);
81 static bool IsHighSurrogateCodePoint(uint32_t value);
83 static bool IsValidUnicodeScalar(uint32_t value);
Forward to use within Span class.
Definition: span.h:415
Represents a contiguous region of arbitrary memory similar to C++20's std::span.
Definition: span.h:375
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
Represents a Unicode scalar value ([ U+0000..U+D7FF ], inclusive; or [ U+E000..U+10FFFF ],...
Definition: rune.h:15
Rune(uint32_t value)
Creates a Rune from the provided Unicode scalar value.
static Buffers::OperationStatus DecodeFromUtf8(ReadOnlySpan< uint8_t > source, Rune &result, int32_t &bytesConsumed)
Decodes the Rune at the beginning of the provided UTF-8 source buffer.
bool TryEncodeToUtf8(Span< uint8_t > destination, int32_t &bytesWritten)
Encodes this Rune to a UTF-8 destination buffer.
static bool TryCreate(char16_t ch, Rune &result)
Attempts to create a Rune from the provided UTF-16 code unit.
Rune(int32_t value)
Creates a Rune from the provided Unicode scalar value.
static Buffers::OperationStatus DecodeFromUtf16(ReadOnlySpan< char16_t > source, Rune &result, int32_t &charsConsumed)
Decodes the Rune at the beginning of the provided UTF-16 source buffer.
static bool TryCreate(char16_t highSurrogate, char16_t lowSurrogate, Rune &result)
Attempts to create a Rune from the provided UTF-16 surrogate pair.
Rune()
Constructs a default Rune representing U+0000.