Jpp  19.1.0-rc.1
the software that should make you happy
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
JFormat Struct Reference

Auxiliary class to temporarily define format specifications. More...

#include <JManip.hh>

Inheritance diagram for JFormat:
JFormat_t

Public Types

typedef std::ios_base::fmtflags fmtflags
 

Public Member Functions

 JFormat (std::ostream &out)
 Constructor. More...
 
 JFormat (std::ostream &out, const JFormat_t &format)
 Constructor. More...
 
 ~JFormat ()
 Destructor. More...
 
bool is_valid () const
 Check validity of this manipulator. More...
 
void get (std::ostream &out)
 Get format specificaton from given output stream. More...
 
void put (std::ostream &out) const
 Put format specificaton to given output stream. More...
 

Public Attributes

int width
 
int precision
 
fmtflags flags
 
char fill
 

Private Attributes

std::ostream & out
 
const JFormat_t format
 

Detailed Description

Auxiliary class to temporarily define format specifications.

The format specification of the output stream in use will be restored when this object is destroyed.

Definition at line 634 of file JManip.hh.

Member Typedef Documentation

◆ fmtflags

typedef std::ios_base::fmtflags JFormat_t::fmtflags
inherited

Definition at line 526 of file JManip.hh.

Constructor & Destructor Documentation

◆ JFormat() [1/2]

JFormat::JFormat ( std::ostream &  out)
inline

Constructor.

Parameters
outoutput stream

Definition at line 642 of file JManip.hh.

642  :
643  JFormat_t(),
644  out (out),
645  format (out)
646  {}
JFormat_t()
Default constructor.
Definition: JManip.hh:531
const JFormat_t format
Definition: JManip.hh:672
std::ostream & out
Definition: JManip.hh:671

◆ JFormat() [2/2]

JFormat::JFormat ( std::ostream &  out,
const JFormat_t format 
)
inline

Constructor.

Parameters
outoutput stream
formatformat

Definition at line 655 of file JManip.hh.

655  :
656  JFormat_t(format),
657  out (out),
658  format (out)
659  {}

◆ ~JFormat()

JFormat::~JFormat ( )
inline

Destructor.

Definition at line 665 of file JManip.hh.

666  {
667  format.put(out);
668  }
void put(std::ostream &out) const
Put format specificaton to given output stream.
Definition: JManip.hh:599

Member Function Documentation

◆ is_valid()

bool JFormat_t::is_valid ( ) const
inlineinherited

Check validity of this manipulator.

Returns
true if valid; else false

Definition at line 574 of file JManip.hh.

575  {
576  return (width > 0);
577  }
int width
Definition: JManip.hh:622

◆ get()

void JFormat_t::get ( std::ostream &  out)
inlineinherited

Get format specificaton from given output stream.

Parameters
outoutput stream

Definition at line 585 of file JManip.hh.

586  {
587  this->width = out.width();
588  this->precision = out.precision();
589  this->flags = out.flags();
590  this->fill = out.fill();
591  }
int precision
Definition: JManip.hh:623
fmtflags flags
Definition: JManip.hh:624
char fill
Definition: JManip.hh:625

◆ put()

void JFormat_t::put ( std::ostream &  out) const
inlineinherited

Put format specificaton to given output stream.

Parameters
outoutput stream

Definition at line 599 of file JManip.hh.

600  {
601  out.width (this->width);
602  out.precision(this->precision);
603  out.flags (this->flags);
604  out.fill (this->fill);
605  }

Member Data Documentation

◆ out

std::ostream& JFormat::out
private

Definition at line 671 of file JManip.hh.

◆ format

const JFormat_t JFormat::format
private

Definition at line 672 of file JManip.hh.

◆ width

int JFormat_t::width
inherited

Definition at line 622 of file JManip.hh.

◆ precision

int JFormat_t::precision
inherited

Definition at line 623 of file JManip.hh.

◆ flags

fmtflags JFormat_t::flags
inherited

Definition at line 624 of file JManip.hh.

◆ fill

char JFormat_t::fill
inherited

Definition at line 625 of file JManip.hh.


The documentation for this struct was generated from the following file: