Jpp  15.0.1-rc.2-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
JLANG::JPrintHelper Class Reference

Auxiliary class to print via member method const char* str() const;. More...

#include <JPrintHelper.hh>

Classes

class  JMemberMethod
 Test for availability of member method const char* str() const;. More...
 
struct  JMemberMethod< T, true >
 Specialisation of JMemberMethod for primitive data types. More...
 
struct  JTypeout
 Print interface. More...
 
struct  JTypewriter
 Type writer implementation of interface JTypeout based on member method const char* str() const; More...
 

Public Member Functions

template<class T >
 JPrintHelper (const T &object)
 Constructor. More...
 
 ~JPrintHelper ()
 Destructor. More...
 
std::ostream & print (std::ostream &out) const
 Print object. More...
 

Static Private Member Functions

template<class T >
static JTypeoutget (JType< T > type, JBool< true > option)
 Get type writer. More...
 

Private Attributes

const void * p
 pointer to object More...
 
JTypeouttypeout
 pointer to printer interface More...
 

Detailed Description

Auxiliary class to print via member method const char* str() const;.

Definition at line 24 of file JPrintHelper.hh.

Constructor & Destructor Documentation

template<class T >
JLANG::JPrintHelper::JPrintHelper ( const T object)
inline

Constructor.

Parameters
objectobject

Definition at line 118 of file JPrintHelper.hh.

118  :
119  p(&object),
120  typeout(get(JType<T>(), JBool<JMemberMethod<T>::__str__>()))
121  {}
JTypeout * typeout
pointer to printer interface
Definition: JPrintHelper.hh:81
Auxiliary class for a type holder.
Definition: JType.hh:19
Auxiliary template class for type bool.
Definition: JBool.hh:20
const void * p
pointer to object
Definition: JPrintHelper.hh:80
JLANG::JPrintHelper::~JPrintHelper ( )
inline

Destructor.

Definition at line 127 of file JPrintHelper.hh.

128  {
129  delete typeout;
130  }
JTypeout * typeout
pointer to printer interface
Definition: JPrintHelper.hh:81

Member Function Documentation

template<class T >
static JTypeout* JLANG::JPrintHelper::get ( JType< T type,
JBool< true >  option 
)
inlinestaticprivate

Get type writer.

Parameters
typetype
optiontrue

Definition at line 75 of file JPrintHelper.hh.

76  {
77  return new JTypewriter<T>();
78  }
std::ostream& JLANG::JPrintHelper::print ( std::ostream &  out) const
inline

Print object.

Parameters
outoutput stream
Returns
output stream

Definition at line 139 of file JPrintHelper.hh.

140  {
141  return typeout->print(out, p);
142  }
JTypeout * typeout
pointer to printer interface
Definition: JPrintHelper.hh:81
virtual std::ostream & print(std::ostream &out, const void *p) const =0
Print object.
const void * p
pointer to object
Definition: JPrintHelper.hh:80

Member Data Documentation

const void* JLANG::JPrintHelper::p
private

pointer to object

Definition at line 80 of file JPrintHelper.hh.

JTypeout* JLANG::JPrintHelper::typeout
private

pointer to printer interface

Definition at line 81 of file JPrintHelper.hh.


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