add more docu;
[web/konrad/chester.git] / dptr.h
diff --git a/dptr.h b/dptr.h
index 7812a0b..c74ad22 100644 (file)
--- a/dptr.h
+++ b/dptr.h
@@ -9,122 +9,8 @@
 #include "dptr_base.h"
 
 
-#ifndef DPTR_CLASS_H
-#define DPTR_CLASS_H
-
-/** \mainpage Chester - d-pointers
-
-Chester is an implementation of the Cheshire Cat idiom - also known as
-d-pointer, PImpl (Pointer IMPLementation), or opaqua data pointer.
-It hides the data of a class behind a "d" pointer.
-
-This implementation takes away much of the bookkeeping work, like allocating
-and de-allocating the pointer.
-
-All the files of Chester are copyrighted under a permissive license:
- Copying and distribution of this file, with or without modification,
- are permitted in any medium without royalty provided the copyright
- notice and this notice are preserved.  This file is offered as-is,
- without any warranty.
-
-So, you are free to use this implementation in any project under any kind of
-license as long as you do not remove my copyright notice.
-
-Although I do not require it, I would appreciate feedback on problems, bugs,
-and the occasional code improvement - if you feel like it...
-
-Different versions of Chester can be mixed for different classes, but the same version must be used both in the header file and in the implementation of the same class.
-
-\section kinds Kinds of D-Pointers
-
-Cheshire cats or d-pointers allow you to hide the data members (and if you want some of the implementation) of a class and also allow (within some constraints) to maintain ABI compatibility (ABI=Application Binary Interface) while adding or removing hidden data members.
-
-Chester defines three different kinds of d-pointers: non-copy, non-shared, and shared. Those three define different access patterns to the d-pointer.
-
-Non-copy d-pointers cannot be copied directly, if you want to make your main class copyable you have to explicitly create a copy constructor and/or an assignment operator. Those should be used with main classes and data objects that cannot be copied (like Qt's QObject and its subclasses).
-
-Non-shared d-pointers can be copied - if you copy an instance of the main class, the content of the d-pointer gets copied automatically (at least if you use the automatic copy constructor or call the copy constructor of the d-pointer). Each copy acts independently. This version produces the same behavior as if the data was defined directly in the main class instead of inside the d-pointer.
-
-Shared d-pointers can also be copied, but copying shares the data between instances of the main class. This can be used to create interface classes in which all copied instances share their data.
-
-All three kinds share the usage pattern. The header file and class interface declaration is declared like this (this example uses non-shared d-pointers):
-\code
-//file: myclass.h
-
-#include <DPtrBase>
-
-class MyClass
-{
-  DECLARE_DPTR(d)
-  public:
-    void myFunction();
-};
-\endcode
-
-The actual implementation file then declares and defines the d-pointer class:
-\code
-//file: myclass.cpp
-
-#include "myclass.h"
-#include <DPtr>
-
-class DPTR_CLASS_NAME(MyClass):public DPtr
-{
-  public:
-    int myint;
-};
-DEFINE_DPTR(MyClass)
-
-void MyClass::myFunction()
-{
-  d->myint = 99;
-}
-
-main()
-{
-  MyClass myinst;
-  myinst.myFunction();
-  MyClass otherinst(myinst);
-}
-\endcode
-
-Which actual kind of d-pointer behavior is declared is decided by using different macros and base classes for the d-pointer class. The argument to the DECLARE_* macro defines the name of the d-pointer variable, usually this will be "d", but you can chose any other name (except "Private" and "DPrivate", which are used as wrapper class names).
-
-The DPTR_CLASS_NAME macro returns the class name of the d-pointer class relative to the main class, which is given as argument. The DEFINE_* macro defines the logic that automatically instantiates, deletes and copies the d-pointer when the main class is instantiated, deleted, and copied. The d-pointer class must be derived from one of the DPtr classes, since these implement some functionality complementing the DEFINE_* macro.
-
-The header file should only include \<DPtrBase> - this file contains the DECLARE_* macros, which is the only thing needed for the header. If you include any other file, this makes mixing versions of Chester impossible in some situations. The implementation file must include one of the d-pointer implementation variants.
-
-\section table Comparison Table
-
-The macros, classes, \#include statements above need to be replaced with different ones if you want one of the other kinds of d-pointers:
-
-<table>
-<tr>
- <td><b>Type</b><td><b>Pointer Declaration (1)</b><td><b>Declaration Include (1)</b>
- <td><b>Base Class(2, 3)</b><td><b>Definition (2)</b><td><b>Implementation Include (2)</b></tr>
-<tr>
- <td>Non-Shared, Copyable<td>DECLARE_DPTR(Class)<td>\#include \<\link dptr_base.h DPtrBase \endlink >
- <td>DPtr<td>DEFINE_DPTR(Class)
- <td>\#include \<\link dptr.h DPtr \endlink >
- </tr>
-<tr>
- <td>Shared<td>DECLARE_SHARED_DPTR(Class)<td>\#include \<\link dptr_base.h DPtrBase \endlink >
- <td>SharedDPtr<td>DEFINE_SHARED_DPTR(Class)
- <td>\#include \<\link dptr_shared.h SharedDPtr \endlink >
- </tr>
-<tr>
- <td>Non-Copyable<td>DECLARE_NONCOPY_DPTR(Class)<td>\#include \<\link dptr_base.h DPtrBase \endlink >
- <td>NonCopyDPtr<td>DEFINE_NONCOPY_DPTR(Class)
- <td>\#include \<\link dptr_noncopy.h NonCopyDPtr \endlink >
- </tr>
-</table>
-
-(1) The DECLARE_* macro and declartion include directive are supposed to be used in the header file of the main class.
-
-(2) The implementation include directive should only be used in the main class'es implementation file - use the DEFINE_* macro to create the glue code that connects the d-pointer class with the main class.
-
-(3) The base class must be used to derive the d-pointer class in the implementation file. It contains some functionality that the DEFINE_* macro relies on.
-*/
+#ifndef DPTR_CLASS_0_1_H
+#define DPTR_CLASS_0_1_H
 
 //hide the namespace
 /// \cond never