dyaml.reader

Types 2

aliasisBreak = among!('\n', '\u0085', '\u2028', '\u2029')
structReader

Provides an API to read characters from a UTF-8 buffer.

Fields
char[] buffer_
size_t bufferOffset_
size_t charIndex_
size_t characterCount_
string name_
uint line_
uint column_
Encoding encoding_
size_t upcomingASCII_
size_t lastDecodedBufferOffset_
size_t lastDecodedCharOffset_
Methods
dchar peek(const size_t index) @safe pureGet character at specified index relative to current position.
dchar peek() @safe pureOptimized version of peek() for the case where peek index is 0.
char peekByte(const size_t index) @safe pure nothrow @nogcGet byte at specified index relative to current position.
char peekByte() @safe pure nothrow @nogcOptimized version of peekByte() for the case where peek byte index is 0.
char[] prefix(const size_t length) @safe pureGet specified number of characters starting at current position.
char[] prefixBytes(const size_t length) @safe pure nothrow @nogcGet specified number of bytes, not code points, starting at current position.
char[] slice(const size_t end) @safe pureGet a slice view of the internal buffer, starting at the current position.
dchar get() @safe pureGet the next character, moving buffer position beyond it.
char[] get(const size_t length) @safe pureGet specified number of characters, moving buffer position beyond them.
void forward(size_t length) @safe pureMove current position forward.
void forward() @safe pureMove current position forward by one character.
Mark mark() const pure nothrow @nogc @safeGet filename, line and column of current position.
Mark mark(size_t advance) const pure @safeGet filename, line and column of current position + some number of chars
inout(string) name() ref inout @safe return pure nothrow @nogcGet file name.
uint line() const @safe pure nothrow @nogcGet current line number.
uint column() const @safe pure nothrow @nogcGet current column number.
size_t charIndex() const @safe pure nothrow @nogcGet index of the current character in the buffer.
Encoding encoding() const @safe pure nothrow @nogcGet encoding of the input buffer.
void checkASCII() @safe pure nothrow @nogc
dchar decodeNext() @safe pure
Constructors
this(ubyte[] buffer, string name = "<unknown>")Construct a Reader.

Functions 7

fnauto toUTF8(ubyte[] input, const UTFEncoding encoding) @safe pure nothrow
fnbool isPrintableValidUTF8(const char[] chars) @safe pureDetermine if all characters (code points, not bytes) in a string are printable.
fnsize_t countASCII(const(char)[] buffer) @safe pure nothrow @nogcCounts the number of ASCII characters in buffer until the first UTF-8 sequence.
fnvoid testEndian(R)()
fnvoid testUTF(R)()
fnvoid test1Byte(R)()