GCpp general purpose C++ library  version 1.0
GClassDefine.hh File Reference
#include <string>
#include <ctype.h>

Go to the source code of this file.

Macros

#define G_CLASS_NAME_FCT   inline virtual const char * ClassName ( ) const { return StaticClassName(); }
 
#define G_STATIC_CLASS_NAME_FCT(T)
 
#define G_CLONE_FCT(T)   virtual T * Clone ( ) const { return ( new T(*this) ); }
 
#define G_CLONE_ABSTRACT_FCT(T)   virtual T * Clone ( ) const = 0;
 
#define G_TEMP_IS_INSTANCE_OF
 
#define GObject(T)
 
#define GObjectV(T)
 

Functions

template<class T >
const char * G_StaticClassName ()
 

Detailed Description

File defining the macro to include in class definitions.

Macro Definition Documentation

#define G_CLASS_NAME_FCT   inline virtual const char * ClassName ( ) const { return StaticClassName(); }

Macro defining the real class name of an object (final derivation class).

#define G_CLONE_ABSTRACT_FCT (   T)    virtual T * Clone ( ) const = 0;

Define an pure virtual copy function for abstract classes.

#define G_CLONE_FCT (   T)    virtual T * Clone ( ) const { return ( new T(*this) ); }

Define a virtual copy function. The function calls the copy constructor, that must be defined.

#define G_STATIC_CLASS_NAME_FCT (   T)
Value:
inline static const char * StaticClassName ( ) \
{ return ( G_StaticClassName<T>( ) ); }

Macro defining the static class name of an object (as it is used).

#define G_TEMP_IS_INSTANCE_OF
Value:
template <class Q> bool IsInstanceOf ( ) const \
{ return (dynamic_cast<const Q*>(this) != NULL); } \
template <class Q> bool IsInstanceOf ( ) \
{ return (dynamic_cast<Q*>(this) != NULL); }

Define the template function to check if an object is instance of a given class.

#define GObject (   T)
Value:
public: \
#define G_STATIC_CLASS_NAME_FCT(T)
Definition: GClassDefine.hh:39
#define G_CLONE_FCT(T)
Definition: GClassDefine.hh:46

Macro defining basic object functions.

Note
  • the copy constructor of the class must be defined.
#define GObjectV (   T)
Value:
public: \
#define G_CLONE_ABSTRACT_FCT(T)
Definition: GClassDefine.hh:50
#define G_STATIC_CLASS_NAME_FCT(T)
Definition: GClassDefine.hh:39

Macro defining basic object functions, to be used with abstract classes: the virtual copy function (Clone) is pure virtual.

Note
  • the copy constructor of the class must be defined.

Function Documentation

template<class T >
const char* G_StaticClassName ( )

Template function returning the class name of a template class T.