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 <JManip.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 372 of file JManip.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
outoutput stream
formatformat center

Definition at line 381 of file JManip.hh.

381  :
382  WIDTH(format),
383  out (out)
384  {}
WIDTH(const int width)
Constructor.
Definition: JManip.hh:236
std::ostream & out
Definition: JManip.hh:414

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 394 of file JManip.hh.

395  {
396  using namespace std;
397 
398  ostringstream os;
399 
400  os.copyfmt(out);
401 
402  os << value;
403 
404  const int w = this->width - os.str().size();
405  const char c = this->out.fill();
406 
407  if (w > 0)
408  return this->out << FILL(w/2) << ' ' << os.str() << FILL((w+1)/2) << ' ' << setfill(c);
409  else
410  return this->out << os.str();
411  }
data_type w[N+1][M+1]
Definition: JPolint.hh:741
int width
Definition: JManip.hh:256
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:327
std::ostream & out
Definition: JManip.hh:414

Member Data Documentation

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

Definition at line 414 of file JManip.hh.

int WIDTH::width
inherited

Definition at line 256 of file JManip.hh.


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