Go to the previous, next section.
#include <nihcl/OIO.h>
Class
OIOin
is the abstract base class for classes implementing various formats of object input for the
readFrom()
function. It declares pure virtual member functions for reading the fundamental data types, arrays of fundamental data types, and C-style (null-terminated) character strings. It also declares pure virtual member functions for setting and accessing the input format precision and field width.
Since all input functions are virtual, derived classes can easily interpret a variety of formats from a variety of input sources, such as C++ iostreams. This is a more flexible form of object I/O than the
file descriptor
object I/O provided by classes
OIOofd
and
OIOifd
, but is less efficient.
OIOin(unsigned
capacity
=1024)
OIOin
with an initial object capacity of
capacity
objects (see class
ReadFromTbl
).
virtual OIOin& operator>>(char*) = 0
OIOin
into the array pointed to by the right argument until a whitespace character is read. The whitespace character is also stored. A terminating zero byte is always stored, even if no characters are read. If
width()
is non-zero, it is interpreted as the size of the array, and a maximum of
width()-1
characters will be read, not including the terminating zero byte.
virtual OIOin& operator>>(char&) = 0
virtual OIOin& operator>>(unsigned char&) = 0
virtual OIOin& operator>>(short&) = 0
virtual OIOin& operator>>(unsigned short&) = 0
virtual OIOin& operator>>(int&) = 0
virtual OIOin& operator>>(unsigned int&) = 0
virtual OIOin& operator>>(long&) = 0
virtual OIOin& operator>>(unsigned long&) = 0
virtual OIOin& operator>>(float&) = 0
virtual OIOin& operator>>(double&) = 0
OIOin
if successful.
virtual int get()
char
and returns it as the result.
virtual OIOin& get(char&
c) = 0
virtual OIOin& get(unsigned char&
c) = 0
OIOin
if successful.
virtual OIOin& get(char*
val, unsigned
size) = 0
virtual OIOin& get(unsigned char*
val, unsigned
size) = 0
virtual OIOin& get(short*
val, unsigned
size) = 0
virtual OIOin& get(unsigned short*
val, unsigned
size) = 0
virtual OIOin& get(int*
val, unsigned
size) = 0
virtual OIOin& get(unsigned int*
val, unsigned
size) = 0
virtual OIOin& get(long*
val, unsigned
size) = 0
virtual OIOin& get(unsigned long*
val, unsigned
size) = 0
virtual OIOin& get(float*
val, unsigned
size) = 0
virtual OIOin& get(double*
val, unsigned
size) = 0
OIOin
if successful.
virtual OIOin& getCString(char*
s, unsigned
maxlen) = 0
OIOout::putCString()
into the memory pointed to by
s. Raises an
NIHCL_STROV
exception if the string length, including the null terminator, would exceed
maxlen. Returns a reference to this
OIOin
if successful.
virtual int precision(int
n) = 0
virtual int precision() = 0
virtual int width(int
n) = 0
virtual int width() = 0
Object* _readObject(const Class&
cl)
OIOin
by applying the function
Class::readObject()
to
cl
with this
OIOin
as the argument.
virtual Object* readObject(const Class&
expected) = 0
OIOout::storeObject()
from this
OIOin
.
Raises an
NIHCL_RDUNKCLASS
exception if the class descriptor of the object to be read has not been linked with the program.
Raises an
NIHCL_RDWRONGCLASS
exception if the class of the object read is not an instance of class
expected
or an instance of a derived class of
expected.
Raises an
NIHCL_RDBADSIG
exception if the signature of the class of the object read does not match the signature of the class descriptor of the same name that has been linked with the program. This is to detect an attempt to read an object stored by an outdated version of the class.
Returns a pointer to the object read if successful.
NIHCL_RDBADSIG
,
NIHCL_RDUNKCLASS
,
NIHCL_RDWRONGCLASS
,
NIHCL_STROV
Go to the previous, next section.