![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/io/Input.h>
Classes | |
struct | def_scanner |
struct | enum_scanner |
class | LineIter |
class | LineRange |
This class provides formatted scanning to input streams.
It is supported to support scan of several items separated by spaces. The possible errors are accumulated inside the state of the class and can accessed at the end of a scan session.
Each scan of a value can result in a success, in a failure (bad format) or in error (reflecting an error in the underlying stream). In addition its states records also the end of the stream.
Build a new input with the given input stream.
stream | Used input stream. |
|
inline |
Test if the stream is ended. Once ended, any new scan will fail.
Referenced by Input::LineIter::next().
|
inline |
|
inline |
|
inline |
|
inline |
Shortcut scanBool.
References Input::scanBool().
|
inline |
Shortcut to scanChar().
References Input::scanChar().
|
inline |
References Input::swallow().
shortcut swallow(String).
References Input::swallow().
Shortcut to swallow(CString).
References Input::swallow().
|
inline |
Shortcut to scanDouble().
References Input::scanDouble().
|
inline |
Shortcut to scanDouble().
References Input::scanDouble().
|
inline |
Shortcut to scanInt().
References Input::scanLong().
|
inline |
Shortcut to scanInt().
References Input::scanLong().
|
inline |
References Input::scanLong().
|
inline |
References Input::scanLLong().
Shortcut to scanLine().
References Input::scanLine().
|
inline |
|
inline |
Shortcut to scanInt().
References Input::scanULong().
|
inline |
Shortcut to scanInt().
References Input::scanULong().
|
inline |
Shortcut to scanInt().
References Input::scanULong().
|
inline |
Shortcut to scanLong().
References Input::scanULLong().
|
inline |
Shortcut to scanInt().
References Input::scanULong().
|
inline |
bool Input::failed() const; Test if the last operation failed. Failed means that there were a format in the last read value.
Remove any failure or input error from the state.
Read a boolean value, that is, 'true'/'false' or '1'/'0'.
References InStream::FAILED.
Referenced by Input::operator>>().
char scanChar | ( | void | ) |
double scanDouble | ( | void | ) |
Scan a full line. The end is reached when the string is empty.
References InStream::FAILED, and StringBuffer::toString().
Referenced by File::load(), Input::LineIter::next(), and Input::operator>>().
t::int64 scanLLong | ( | int | base = 0 | ) |
Scan a based long long, decimal as a default. Supported base prefixes are '0', '0[xX]' or '0[bB]'.
base | Base of the number to read (default to 0 to scan prefixes). |
IOException | In case of IO or format error. |
References elm::io::base(), and Input::scanULLong().
Referenced by Input::operator>>().
t::int32 scanLong | ( | int | base = 0 | ) |
Scan a based long, decimal as a default. Supported base prefixes are '0', '0[xX]' or '0[bB]'.
base | Base of the number to read (default to 0 to scan prefixes). |
IOException | In case of IO or format error. |
References elm::io::base(), and Input::scanULong().
Referenced by Input::operator>>().
t::uint64 scanULLong | ( | int | base = 0 | ) |
Scan a based unsigned long long, decimal as a default. Supported base prefixes are '0', '0[xX]' or '0[bB]'.
base | Base of the number to read (default to 0 to scan prefixes). |
IOException | In case of IO or format error. |
References elm::io::base(), and elm::io::test_base().
Referenced by Input::operator>>(), and Input::scanLLong().
t::uint32 scanULong | ( | int | base = 0 | ) |
Scan a based unsigned long, decimal as a default. Supported base prefixes are '0', '0[xX]' or '0[bB]'.
base | Base of the number to read (default to 0 to scan prefixes). |
IOException | In case of IO error. |
References elm::io::base(), and elm::io::test_base().
Referenced by Input::operator>>(), and Input::scanLong().
Scan a word from the text and return it.
References StringBuffer::toString().
change the used input stream.
References Input::stream().
Referenced by FileInput::FileInput(), and XOMUnserializer::onValue().
void swallow | ( | char | chr | ) |
Read a character if it is equal to the given one or throw an IOException.
chr | Character to read. |
References elm::io::read().
Referenced by Input::operator>>(), and Input::swallow().
Read the character of the given string until finding a not matching character (and throw an exception in this case).
str | String to read. |
References String::length(), elm::str(), and Input::swallow().
Read the character of the given string until finding a not matching character (and throw an exception in this case).
str | String to read. |
References elm::str(), and Input::swallow().
Swallow one or more characters.