# HG changeset patch # User Santeri Piippo # Date 1394045368 -7200 # Node ID 5d37b2f2ae16fd20d6914738bb697ef3736b3593 # Parent 747e840622791a0f009d5a00027f140620ab1b54 - doxygen'd DocumentPointer.h diff -r 747e84062279 -r 5d37b2f2ae16 src/misc/DocumentPointer.cc --- a/src/misc/DocumentPointer.cc Wed Mar 05 18:42:26 2014 +0200 +++ b/src/misc/DocumentPointer.cc Wed Mar 05 20:49:28 2014 +0200 @@ -23,7 +23,7 @@ LDDocumentPointer::LDDocumentPointer() : m_pointer (null) {} // ============================================================================= -// ----------------------------------------------------------------------------- +// LDDocumentPointer::LDDocumentPointer (LDDocument* ptr) : m_pointer (ptr) { @@ -31,7 +31,7 @@ } // ============================================================================= -// ----------------------------------------------------------------------------- +// LDDocumentPointer::LDDocumentPointer (const LDDocumentPointer& other) : m_pointer (other.pointer()) { @@ -39,14 +39,14 @@ } // ============================================================================= -// ----------------------------------------------------------------------------- +// LDDocumentPointer::~LDDocumentPointer() { removeReference(); } // ============================================================================= -// ----------------------------------------------------------------------------- +// void LDDocumentPointer::addReference() { if (pointer() != null) @@ -54,7 +54,7 @@ } // ============================================================================= -// ----------------------------------------------------------------------------- +// void LDDocumentPointer::removeReference() { if (pointer() != null) @@ -62,7 +62,7 @@ } // ============================================================================= -// ----------------------------------------------------------------------------- +// LDDocumentPointer& LDDocumentPointer::operator= (LDDocument* ptr) { if (ptr != pointer()) diff -r 747e84062279 -r 5d37b2f2ae16 src/misc/DocumentPointer.h --- a/src/misc/DocumentPointer.h Wed Mar 05 18:42:26 2014 +0200 +++ b/src/misc/DocumentPointer.h Wed Mar 05 20:49:28 2014 +0200 @@ -23,27 +23,46 @@ class LDSubfile; class LDDocument; +//! +//! \brief A reference-counting pointer to LDDocument. +//! +//! The LDDocumentPointer class defines a reference-counting pointer which +//! points to LDDocument. +//! class LDDocumentPointer { PROPERTY (private, LDDocument*, pointer, setPointer, STOCK_WRITE) public: + //! Constructs a null LDDocumentPointer LDDocumentPointer(); + + //! Constructs a document pointer with the given pointer LDDocumentPointer (LDDocument* ptr); + + //! Copy-constructs a LDDocumentPointer. LDDocumentPointer (const LDDocumentPointer& other); + + //! Destructs the pointer. ~LDDocumentPointer(); + + //! \param ptr the new pointer to change to. LDDocumentPointer& operator= (LDDocument* ptr); + //! Copy operator. + //! \param other the pointer whose internal pointer to copy. inline LDDocumentPointer& operator= (LDDocumentPointer& other) { return operator= (other.pointer()); } + //! Operator overload for a->b support. inline LDDocument* operator->() const { return pointer(); } + //! Cast operator overload inline operator LDDocument*() const { return pointer(); @@ -53,4 +72,3 @@ void addReference(); void removeReference(); }; -