bpf::io::TextReader class final

Text deserializer

Base classes

class IDataInputStream

Constructors, destructors, conversion operators

TextReader(IInputStream& stream, const ECharacterEncoding encoder = ECharacterEncoding::UTF8, bool buffered = true) explicit

Public functions

void SetTokenSeparators(const char* str)
auto Read(void* buf, fsize bufsize) -> fsize final
auto ReadLine(String& out) -> bool
auto Read(String& out) -> bool
auto ReadAll() -> String
auto operator>>(uint8& u) -> IDataInputStream& final
auto operator>>(uint16& u) -> IDataInputStream& final
auto operator>>(uint32& u) -> IDataInputStream& final
auto operator>>(uint64& u) -> IDataInputStream& final
auto operator>>(int8& i) -> IDataInputStream& final
auto operator>>(int16& i) -> IDataInputStream& final
auto operator>>(fint& i) -> IDataInputStream& final
auto operator>>(int64& i) -> IDataInputStream& final
auto operator>>(float& f) -> IDataInputStream& final
auto operator>>(double& d) -> IDataInputStream& final
auto operator>>(bool& b) -> IDataInputStream& final
auto operator>>(bpf::String& str) -> IDataInputStream& final

Function documentation

bpf::io::TextReader::TextReader(IInputStream& stream, const ECharacterEncoding encoder = ECharacterEncoding::UTF8, bool buffered = true) explicit

Parameters
stream the stream to read from
encoder the string encoding to use
buffered true to allow buffering, false otherwise

Creates a TextReader

void bpf::io::TextReader::SetTokenSeparators(const char* str)

Parameters
str a string where each characters represents a character to seach for the end of a token

Sets the possible characters to find that marks the end of a token. We assume the separators can only be ASCII characters

fsize bpf::io::TextReader::Read(void* buf, fsize bufsize) final

Parameters
buf buffer to receive the read bytes
bufsize the size of the receiving buffer
Returns fsize number of bytes read

Reads reaw bytes from the stream, taking into account buffering

bool bpf::io::TextReader::ReadLine(String& out)

Parameters
out the output text without the line separator character
Returns true if anything was read, false otherwise

Reads a line of text

bool bpf::io::TextReader::Read(String& out)

Parameters
out the output token text
Returns true if anything was read, false otherwise

Reads a single token

String bpf::io::TextReader::ReadAll()

Returns String the file content

Reads the entire file as text

IDataInputStream& bpf::io::TextReader::operator>>(uint8& u) final

Parameters
u deserialized uint8
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(uint16& u) final

Parameters
u deserialized uint16
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(uint32& u) final

Parameters
u deserialized uint21
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(uint64& u) final

Parameters
u deserialized uint64
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(int8& i) final

Parameters
i deserialized int8
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(int16& i) final

Parameters
i deserialized int16
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(fint& i) final

Parameters
i deserialized int32
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(int64& i) final

Parameters
i deserialized int64
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(float& f) final

Parameters
f deserialized float
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(double& d) final

Parameters
d deserialized double
Returns IDataInputStream&

Deserialize a number

IDataInputStream& bpf::io::TextReader::operator>>(bool& b) final

Parameters
b deserialized bool
Returns IDataInputStream&

Deserialize a boolean

IDataInputStream& bpf::io::TextReader::operator>>(bpf::String& str) final

Parameters
str deserialized high-level string
Returns IDataInputStream&

Deserialize a string