Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JTypeInfo Class Reference

This class is a wrapper around the STL type_info class. More...

#include <JTypeInfo.hh>

Inheritance diagram for JLANG::JTypeInfo:
JLANG::JComparable< JTypeInfo >

Public Member Functions

 JTypeInfo ()
 Default constructor.
 
 JTypeInfo (const std::type_info &type)
 Constructor.
 
const std::type_info & get () const
 Get type information.
 
bool less (const JTypeInfo &that) const
 Less than operation.
 
bool before (const JTypeInfo &type) const
 Evaluate order.
 
const char * name () const
 Get type name.
 

Private Attributes

const std::type_info * pType
 

Detailed Description

This class is a wrapper around the STL type_info class.

It is possible to create a list of objects of this class.

Source code is taken from reference: A. Alexandrescu, Modern C++ Design, Addison Wesley.

Definition at line 27 of file JTypeInfo.hh.

Constructor & Destructor Documentation

◆ JTypeInfo() [1/2]

JLANG::JTypeInfo::JTypeInfo ( )
inline

Default constructor.

Definition at line 34 of file JTypeInfo.hh.

35 {
36 class JNullType {};
37
38 pType = &typeid(JNullType);
39 }
const std::type_info * pType
Definition JTypeInfo.hh:102

◆ JTypeInfo() [2/2]

JLANG::JTypeInfo::JTypeInfo ( const std::type_info & type)
inline

Constructor.

Parameters
typetype information

Definition at line 47 of file JTypeInfo.hh.

47 :
48 pType(&type)
49 {}

Member Function Documentation

◆ get()

const std::type_info & JLANG::JTypeInfo::get ( ) const
inline

Get type information.

Returns
type information

Definition at line 57 of file JTypeInfo.hh.

58 {
59 if (pType == NULL)
60 THROW(JTypeInformationException, "No type information.");
61 else
62 return *pType;
63 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ less()

bool JLANG::JTypeInfo::less ( const JTypeInfo & that) const
inline

Less than operation.

Parameters
thatobject to be compared
Returns
true if this type information less than that type information; else false

Definition at line 72 of file JTypeInfo.hh.

73 {
74 return get().before(that.get()) != 0;
75 }
const std::type_info & get() const
Get type information.
Definition JTypeInfo.hh:57

◆ before()

bool JLANG::JTypeInfo::before ( const JTypeInfo & type) const
inline

Evaluate order.

Parameters
typetype information
Returns
true if this type before given type; else false

Definition at line 84 of file JTypeInfo.hh.

85 {
86 return get().before(type.get()) != 0;
87 }

◆ name()

const char * JLANG::JTypeInfo::name ( ) const
inline

Get type name.

Returns
type name

Definition at line 95 of file JTypeInfo.hh.

96 {
97 return get().name();
98 }

Member Data Documentation

◆ pType

const std::type_info* JLANG::JTypeInfo::pType
private

Definition at line 102 of file JTypeInfo.hh.


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