Go to the previous, next section.

CNFormInt -- Integers as CNStrings

SYNOPSIS

#include <CNCL/FormInt.h>

TYPE

CN_FORMINT

BASE CLASSES

CNString

DERIVED CLASSES

RELATED CLASSES

DESCRIPTION

This class converts Integers to Strings using different kinds of format styles provided by the stream-2.0-implementation. The current formats implemented in this class are 'left' and 'right'. Note: If the Integer needs more characters than the width w indicates, the most right ones are ignored.

Constructors:

CNFormInt();
CNFormInt(CNParam *param);
CNFormInt(int a, int w);
CNFormInt(int a, int w, char fill);
CNFormInt(int a, int w, char fill, int f);

Initializes CNFormInt, setting the value to the integer value a (default = 0), the string's width, the fill character fill (default = ' ') and the format f (default = CNFormInt::right)

The different formats implemented in CNFormInt are:

int right = 1
int left = 2

In addition to the member functions required by CNCL, CNFormInt provides:

int get_value();
int value();

Returns the value as an integer.

void set_value(int a);
void value(int a);

Changes the old String and the old value to a.

char get_fill();
char fill();

Returns the current fill character.

void set_fill(char f);
void fill(char f);

Changes the String to the fill character f.

int get_format();
int format();

Returns the current format as an integer. '1' descibes 'right', '2' describes left.

void set_format(int f);
void format(int f);

Changes the String to the new CNFormInt::formats f.

int get_width();
int width();

Returns the String's width as an integer.

void set_width(int w);
void width(int w);

Changes the old String's width to w.

Go to the previous, next section.