Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 ~JPrintHelper ()
 Destructor.
 
std::ostream & print (std::ostream &out) const
 Print object.
 

Private Member Functions

 JPrintHelper (const JPrintHelper &)
 
 JPrintHelper (JPrintHelper &&)
 
JPrintHelperoperator= (const JPrintHelper &)
 
JPrintHelperoperator= (JPrintHelper &&)
 

Static Private Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 24 of file JPrintHelper.hh.

Constructor & Destructor Documentation

◆ JPrintHelper() [1/3]

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 {}
static JTypeout * get(JType< T > type, JBool< true > option)
Get type writer.
JTypeout * typeout
pointer to printer interface
const void * p
pointer to object

◆ ~JPrintHelper()

JLANG::JPrintHelper::~JPrintHelper ( )
inline

Destructor.

Definition at line 127 of file JPrintHelper.hh.

128 {
129 delete typeout;
130 }

◆ JPrintHelper() [2/3]

JLANG::JPrintHelper::JPrintHelper ( const JPrintHelper & )
private

◆ JPrintHelper() [3/3]

JLANG::JPrintHelper::JPrintHelper ( JPrintHelper && )
private

Member Function Documentation

◆ get()

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 }

◆ print()

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 }
virtual std::ostream & print(std::ostream &out, const void *p) const =0
Print object.

◆ operator=() [1/2]

JPrintHelper & JLANG::JPrintHelper::operator= ( const JPrintHelper & )
private

◆ operator=() [2/2]

JPrintHelper & JLANG::JPrintHelper::operator= ( JPrintHelper && )
private

Member Data Documentation

◆ p

const void* JLANG::JPrintHelper::p
private

pointer to object

Definition at line 80 of file JPrintHelper.hh.

◆ typeout

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: