bpf::io::ConsoleReader class final

High-level console deserializer

Base classes

class IDataInputStream

Constructors, destructors, conversion operators

ConsoleReader()

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 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::ConsoleReader::ConsoleReader()

Constructs a ConsoleReader

void bpf::io::ConsoleReader::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::ConsoleReader::Read(void* buf, fsize bufsize) final

Parameters
buf the buffer to receive the characters
bufsize size in bytes of the buffer
Returns fsize number of bytes read
Exceptions
IOException in case of system error

This function performs a low level read from standard input On Windows it fills buf with UTF-16 code points On Linux it fills buf with UTF-8 bytes (last UTF-8 code might be cut)

bool bpf::io::ConsoleReader::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::ConsoleReader::Read(String& out)

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

Reads a single token

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

Parameters
u deserialized uint8
Returns IDataInputStream&

Deserialize a number

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

Parameters
u deserialized uint16
Returns IDataInputStream&

Deserialize a number

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

Parameters
u deserialized uint21
Returns IDataInputStream&

Deserialize a number

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

Parameters
u deserialized uint64
Returns IDataInputStream&

Deserialize a number

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

Parameters
i deserialized int8
Returns IDataInputStream&

Deserialize a number

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

Parameters
i deserialized int16
Returns IDataInputStream&

Deserialize a number

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

Parameters
i deserialized int32
Returns IDataInputStream&

Deserialize a number

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

Parameters
i deserialized int64
Returns IDataInputStream&

Deserialize a number

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

Parameters
f deserialized float
Returns IDataInputStream&

Deserialize a number

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

Parameters
d deserialized double
Returns IDataInputStream&

Deserialize a number

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

Parameters
b deserialized bool
Returns IDataInputStream&

Deserialize a boolean

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

Parameters
str deserialized high-level string
Returns IDataInputStream&

Deserialize a string