Classes | Defines

ctkPimpl.h File Reference

#include <QtGlobal>
Include dependency graph for ctkPimpl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ctkPrivate< PUB >
class  ctkPrivateInterface< PUB, PVT >

Defines

#define CTK_CONSTRUCTOR_1_ARG_CXX(PUB, _ARG1)
#define CTK_CONSTRUCTOR_NO_ARG_CXX(PUB)
#define CTK_D(PUB)   PUB##Private* d = ctk_d()
#define CTK_D_REF(PUB)   PUB##Private& d = ctk_d.ref()
#define CTK_DECLARE_PRIVATE(PUB)
#define CTK_DECLARE_PUBLIC(PUB)   friend class PUB;
#define CTK_GET_CXX(PUB, _TYPE, _NAME, _VARNAME)
#define CTK_INIT_PRIVATE(PUB)   ctk_d.setPublic(this)
#define CTK_P(PUB)   PUB* p = ctk_p()
#define CTK_P_REF(PUB)   PUB& p = ctk_p_ref()
#define CTK_SET_CXX(PUB, _TYPE, _NAME, _VARNAME)

Define Documentation

#define CTK_CONSTRUCTOR_1_ARG_CXX (   PUB,
  _ARG1 
) [related]
Value:
PUB::PUB(_ARG1 _parent) :                     \
    Superclass( _parent )                       \
    {                                           \
    CTK_INIT_PRIVATE(PUB);                      \
    }

Define a public class constructor with one argument

Also make sure the Pimpl is initalized

Definition at line 70 of file ctkPimpl.h.

#define CTK_CONSTRUCTOR_NO_ARG_CXX (   PUB  )  [related]
Value:
PUB::PUB()                             \
    {                                    \
    CTK_INIT_PRIVATE(PUB);               \
    }

Define a public class constructor with no argument

Also make sure the Pimpl is initalized

Definition at line 59 of file ctkPimpl.h.

#define CTK_D (   PUB  )     PUB##Private* d = ctk_d() [related]

Returns a pointer (or reference) in the current scope named "d" to the private class.

This function is only available in a class using QCTK_DECLARE_PRIVATE.

Definition at line 131 of file ctkPimpl.h.

#define CTK_D_REF (   PUB  )     PUB##Private& d = ctk_d.ref()

Definition at line 132 of file ctkPimpl.h.

#define CTK_DECLARE_PRIVATE (   PUB  )  [related]
Value:
friend class PUB##Private; ctkPrivateInterface<PUB, PUB##Private> ctk_d;  \
typedef PUB Self;

Declares that a public class has a related private class.

This should be put in the private section of the public class. The parameter is the name of the public class. For convenience, this macro also add 'typedef PUB Self;'

Definition at line 109 of file ctkPimpl.h.

#define CTK_DECLARE_PUBLIC (   PUB  )     friend class PUB; [related]

Declares that a private class has a related public class.

This may be put anywhere in the declaration of the private class. The parameter is the name of the public class.

Definition at line 118 of file ctkPimpl.h.

#define CTK_GET_CXX (   PUB,
  _TYPE,
  _NAME,
  _VARNAME 
) [related]
Value:
_TYPE PUB::_NAME()const                          \
  {                                                \
    return ctk_d.ref()._VARNAME;                   \
  }

Define the setter in the public class.

This should be put in the .cxx file of the public class. The parameter are the name of the public class (PUB), the type of the argument to return (_TYPE), the name of the setter(_NAME) and the name of the variable in the Private class(_VARNAME).

Definition at line 97 of file ctkPimpl.h.

#define CTK_INIT_PRIVATE (   PUB  )     ctk_d.setPublic(this) [related]

Initializes resources owned by the private class.

This should be called from the public class's constructor, before qctk_d() is used for the first time. The parameter is the name of the public class.

Definition at line 125 of file ctkPimpl.h.

#define CTK_P (   PUB  )     PUB* p = ctk_p() [related]

Creates a pointer ( or reference) in the current scope named "q" to the public class.

This macro only works in a class using CTK_DECLARE_PUBLIC.

Definition at line 138 of file ctkPimpl.h.

#define CTK_P_REF (   PUB  )     PUB& p = ctk_p_ref()

Definition at line 139 of file ctkPimpl.h.

#define CTK_SET_CXX (   PUB,
  _TYPE,
  _NAME,
  _VARNAME 
) [related]
Value:
void PUB::_NAME(_TYPE var)                        \
  {                                                 \
    ctk_d.ref()._VARNAME =  var;                    \
  }

Define the setter in the public class.

This should be put in the .cxx file of the public class. The parameter are the name of the public class (PUB), the type of the argument to return (_TYPE), the name of the getter(_NAME) and the name of the variable in the Private class(_VARNAME).

Definition at line 84 of file ctkPimpl.h.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines