PSCF v1.1
List of all members
Util::Lng Class Reference

Wrapper for a long int, for formatted ostream output. More...

#include <Lng.h>

Public Member Functions

Constructors
 Lng ()
 Default constructor. More...
 
 Lng (long int value)
 Constructor, value only. More...
 
 Lng (long int value, int width)
 Constructor, value and width. More...
 
Setters
void setValue (long int value)
 Set value of long int. More...
 
void setWidth (int width)
 Set field width. More...
 

Accessors

long int value ()
 Get value of long int. More...
 
int width ()
 Get field width. More...
 
std::istream & operator>> (std::istream &in, Lng &object)
 Input stream extractor for an Lng object. More...
 
std::ostream & operator<< (std::ostream &out, const Lng &object)
 Output stream inserter for an Lng object. More...
 

Detailed Description

Wrapper for a long int, for formatted ostream output.

An Lng object has a long int numerical value, and a minimum output field width. The << operator for an Lng uses the specified width. The numerical value and width may both be optionally specified as parameters to a constructor. If the width is not specified, it is is is set to a default value equal to Format::defaultWidth().

An Lng object may be passed to an ostream as a temporary object. For example, the expression:

std::cout << Lng(13) << Lng(25, 10) << std::endl;
Lng()
Default constructor.
Definition: Lng.cpp:15

outputs the number 13 using the default width, followed by the number 25 in a field of minimum width 10.

Definition at line 35 of file Lng.h.

Constructor & Destructor Documentation

◆ Lng() [1/3]

Util::Lng::Lng ( )

Default constructor.

Definition at line 15 of file Lng.cpp.

◆ Lng() [2/3]

Util::Lng::Lng ( long int  value)
explicit

Constructor, value only.

Parameters
valueassociated long int

Definition at line 22 of file Lng.cpp.

◆ Lng() [3/3]

Util::Lng::Lng ( long int  value,
int  width 
)

Constructor, value and width.

Parameters
valueassociated long int
widthfield width

Definition at line 29 of file Lng.cpp.

Member Function Documentation

◆ setValue()

void Util::Lng::setValue ( long int  value)

Set value of long int.

Parameters
valueassociated long int

Definition at line 34 of file Lng.cpp.

References value().

◆ setWidth()

void Util::Lng::setWidth ( int  width)

Set field width.

Parameters
widthfield width

Definition at line 37 of file Lng.cpp.

References width().

◆ value()

long int Util::Lng::value ( )

Get value of long int.

Definition at line 40 of file Lng.cpp.

Referenced by setValue().

◆ width()

int Util::Lng::width ( )

Get field width.

Definition at line 43 of file Lng.cpp.

Referenced by setWidth().

Friends And Related Function Documentation

◆ operator>>

std::istream & operator>> ( std::istream &  in,
Lng object 
)
friend

Input stream extractor for an Lng object.

Parameters
ininput stream
objectLng object to be read from stream
Returns
modified input stream

Definition at line 53 of file Lng.cpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const Lng object 
)
friend

Output stream inserter for an Lng object.

Parameters
outoutput stream
objectLng to be written to stream
Returns
modified output stream

Definition at line 66 of file Lng.cpp.


The documentation for this class was generated from the following files: