Cryptography Reference
In-Depth Information
4.
Display of the length of a
LINT
object
The default is the display of the binary length of a
LINT
objects. This can be
changed by a call to
LINT::unsetf (LINT::lintshowlength);
LINT::unsetf (ostream, LINT::lintshowlength);
so that the length is not displayed.
5.
Restoring the status variable for the numerical representation
The status variable for the formatting of a
LINT
object can be restored to a
previous value
oldflags
by a call to the two functions
LINT::unsetf (ostream, LINT::flags(ostream));
LINT::setf (ostream, oldflags);
Calls to these two functions are collected in the overloaded function
restoref()
:
LINT::restoref (flag);
LINT::restoref (ostream, flag);
Flags can be combined, as in the call
LINT::setf (LINT::bin | LINT::showbase);
This, however, is permitted only for flags that are not mutually exclusive.
The output function that finally generates the requested representational
format for
LINT
objects is an extension of the operator
ostream& operator
<<(ostream& s, LINT ln)
already sketched above, which evaluates the status
variables of the output stream and generates the appropriate output. For this the
operator uses the auxiliary function
lint2str()
contained in
flintpp.cpp
,which
in turn calls the function
xclint2str_l()
to represent the numerical value of a
LINT
object in a character string:
ostream& operator << (ostream& s, const LINT& ln)
{
USHORT base = 16;
long flags = LINT::flags (s);
char* formatted_lint;
if (ln.status == E_LINT_INV)
LINT::panic (E_LINT_VAL, "ostream operator<<", 0, __LINE__);
if (flags & LINT::linthex)
{
base = 16;
}
else