Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
CENTER::JCenter Struct Reference

Auxiliary class for format center. More...

#include <JPrint.hh>

Inheritance diagram for CENTER::JCenter:
WIDTH

Public Member Functions

 JCenter (std::ostream &out, const WIDTH &format)
 Constructor. More...
 
template<class T >
std::ostream & operator<< (const T &value)
 Write value to output stream. More...
 

Public Attributes

int width
 

Private Attributes

std::ostream & out
 

Detailed Description

Auxiliary class for format center.

Definition at line 408 of file JPrint.hh.

Constructor & Destructor Documentation

CENTER::JCenter::JCenter ( std::ostream &  out,
const WIDTH format 
)
inline

Constructor.

Parameters
outoutput stream
formatformat center

Definition at line 417 of file JPrint.hh.

417  :
418  WIDTH(format),
419  out (out)
420  {}
WIDTH(const int width)
Constructor.
Definition: JPrint.hh:273
std::ostream & out
Definition: JPrint.hh:450

Member Function Documentation

template<class T >
std::ostream& CENTER::JCenter::operator<< ( const T value)
inline

Write value to output stream.

Parameters
valuevalue
Returns
this JCenter

Definition at line 430 of file JPrint.hh.

431  {
432  using namespace std;
433 
434  ostringstream os;
435 
436  os.copyfmt(out);
437 
438  os << value;
439 
440  const int w = this->width - os.str().size();
441  const char c = this->out.fill();
442 
443  if (w > 0)
444  return this->out << FILL(w/2) << ' ' << os.str() << FILL((w+1)/2) << ' ' << setfill(c);
445  else
446  return this->out << os.str();
447  }
data_type w[N+1][M+1]
Definition: JPolint.hh:708
int width
Definition: JPrint.hh:292
Auxiliary data structure for sequence of same character.
Definition: JPrint.hh:361
std::ostream & out
Definition: JPrint.hh:450

Member Data Documentation

std::ostream& CENTER::JCenter::out
private

Definition at line 450 of file JPrint.hh.

int WIDTH::width
inherited

Definition at line 292 of file JPrint.hh.


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