Cryptography Reference
In-Depth Information
To ensure that this takes place before a
LINT
object is output, we define, in the
file
flintpp.h
, the class
LintInit
as follows:
class LintInit
{
public:
LintInit (void);
};
LintInit::LintInit (void)
{
// get index to long status variable in class ios
LINT::flagsindex = ios::xalloc();
// set the default status in cout and in cerr
cout.iword (LINT::flagsindex) =
cerr.iword (LINT::flagsindex) =
LINT::lintshowlength|LINT::linthex|LINT::lintshowbase;
}
The class
LintInit
has as its only element the constructor
LintInit::LintInit()
. Furthermore, in the class
LINT
we define a mem-
ber datum
setup
of type
LintInit
, which is initialized via the constructor
LintInit::LintInit()
. The call to
xalloc()
takes place within this initialization,
and the status variable thereby allocated is given the established standard output
format for
LINT
objects. In the following we shall show a section of the
LINT
class
declaration, which contains the declaration of
LintInit()
as a
friend
of
LINT
,the
declaration of the variables
flagsindex
and
setup
, and various status values as
enum
types:
class LINT
{
public:
// ...
enum {
lintdec = 0x10,
lintoct = 0x20,
linthex = 0x40,
lintshowbase = 0x80,
lintuppercase = 0x100,
lintbin = 0x200,
lintshowlength = 0x400
};
// ...
friend LintInit::LintInit (void);