Wed, 05 Mar 2014 20:49:28 +0200
- doxygen'd DocumentPointer.h
src/misc/DocumentPointer.cc | file | annotate | diff | comparison | revisions | |
src/misc/DocumentPointer.h | file | annotate | diff | comparison | revisions |
--- 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())
--- 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(); }; -