Defines

pimpl.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PIMPL_DECLARE_PRIVATE(Class)
#define PIMPL_DECLARE_PUBLIC(Class)
#define PIMPL_PRIVATE(Class)   Class##Private * const priv = priv_func()
#define PIMPL_PUBLIC(Class)   Class * const pub = pub_func()
#define PIMPL_INITIALIZE(Class)
#define PIMPL_UNINITIALIZE(Class)

Detailed Description

QScopedPointer gebruiken voor priv_ptr zodat PIMPL_UNINITIALIZE niet nodig is is niet echt een optie. QScopedPointerDeleter is geimplementeerd met compile-time type checking, wat extra implementatie-constraints oplegt voor de public class. (zie docs voor forward declaration in QScopedPointer)

See also:


Define Documentation

#define PIMPL_DECLARE_PRIVATE (   Class  ) 
Value:
private: \
                inline Class##Private* priv_func() { return reinterpret_cast<Class##Private *>(priv_ptr); } \
                inline const Class##Private* priv_func() const { return reinterpret_cast<const Class##Private *>(priv_ptr); } \
                friend class Class##Private; \
                void* priv_ptr;
#define PIMPL_DECLARE_PUBLIC (   Class  ) 
Value:
public: \
                inline Class* pub_func() { return static_cast<Class *>(pub_ptr); } \
                inline const Class* pub_func() const { return static_cast<const Class *>(pub_ptr); } \
        private: \
                friend class Class; \
                void* pub_ptr;
#define PIMPL_INITIALIZE (   Class  ) 
Value:
priv_ptr = new Class##Private(); \
                PIMPL_PRIVATE(Class); \
                priv->pub_ptr = this;

Referenced by TagContainer::TagContainer().

#define PIMPL_PRIVATE (   Class  )     Class##Private * const priv = priv_func()
#define PIMPL_PUBLIC (   Class  )     Class * const pub = pub_func()
#define PIMPL_UNINITIALIZE (   Class  ) 
Value:
PIMPL_PRIVATE(Class); \
                delete priv;

Referenced by TagContainer::~TagContainer().