binio
is the general base class, containing important method,
type and variable declarations. As a user, you normally do not need it
directly, except for scoping types and variables to it.
binio.h
binio()
~binio()
void setFlag(Flag f, bool set = true)
set
is used
to set or erase the specified flag. If it is not specified, it
defaults to true
, setting (activating) the specified flag.
bool getFlag(Flag f)
setFlag
, above, for more information.
Error error()
0
, as to allow easy error
checks with a simple if
construct.
bool eof()
true
if the last access to the stream was unsuccessful
because the stream pointer was already past the end of the
stream. false
is returned otherwise. Synonymous to checking if
the return value of a call to error()
sets the Eof
error
code flag.
virtual void seek(long, Offset = Set)
Set
specifies
the beginning of a stream, Add
specifies the current position
and End
specifies the end of the stream. If it is omitted, it
defaults to Set
, seeking from the beginning of the stream.
virtual long pos()
Float pow(Float base, signed int exp)
pow()
function from the
math.h
standard C math library include file. It is used during
conversion between floating-point formats and can calculate powers of
a floating-point base argument, using a signed integer exponent.
enum Flag
setFlag()
and getFlag()
methods. This type defines the
following values:
BigEndian
FloatIEEE
If your architecture does not support IEEE-754
floating-point numbers, the value will be converted. Various
conversion errors can occur and sometimes the conversion is not
possible at all. In this case, the Unsupported
error is issued
and a specific value is returned. The following table summarizes all
possible return codes for certain problematic values:
Real value | Return value
|
Infinity | 1.0
|
-Infinity | -1.0
|
Not a Number (NaN) | 0.0
|
Both positive and negative zero (0
) are mapped to the same zero
value, if your architecture does not support both positive and
negative zeroes. There is no way to distinguish between the two values
in this case.
enum ErrorCode
NoError
0
.
Fatal
Unsupported
NotOpen
Denied
NotFound
Eof
enum Offset
seek()
method. This type defines the following values:
Set
Add
End
enum FType
readFloat()
or writeFloat()
methods. Most
floating-point formats specify multiple data types to support a
broader range of precision. libbinio generalizes the idea by
categorizing them only into single and double precision numbers. This
type defines the following values:
Single
Double
int Error
error()
. A status of "no error" is always
indicated when the whole field is set to 0
(zero), i.e. the
integer is 0
. Test for an error by binary or'ing this integer
with one of the error values from ErrorCode
.
Int
Float
Byte
Flags
Flags my_flags
static const Flags system_flags
Error err