//********************************************************************
//====================================================================
-// Constructor
+//! Constructor
//====================================================================
SUIT_DataOwner::SUIT_DataOwner()
{
}
//====================================================================
-// Destructor
+//! Destructor
//====================================================================
SUIT_DataOwner::~SUIT_DataOwner()
{
}
//====================================================================
-// operator== : compares two owners
+//! operator== : compares two owners
//====================================================================
bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
{
//********************************************************************
//====================================================================
-// Constructor (default)
+//! Constructor (default)
//====================================================================
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
: QValueList<SUIT_DataOwnerPtr>()
}
//====================================================================
-// Constructor (copy)
+//! Constructor (copy)
//====================================================================
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
: QValueList<SUIT_DataOwnerPtr>( l )
#ifndef QT_NO_STL
//====================================================================
-// Constructor (from stl)
+//! Constructor (from stl)
//====================================================================
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l )
: QValueList<SUIT_DataOwnerPtr>( l )
#endif
//====================================================================
-// Appends an item to the list
+//! Appends an item to the list
//====================================================================
SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x )
{
class SUIT_EXPORT SUIT_DataOwner : public RefCount
{
public:
- SUIT_DataOwner();
- virtual ~SUIT_DataOwner();
-
- virtual bool isEqual( const SUIT_DataOwner& ) const = 0;
+ SUIT_DataOwner();//!< constructor
+ virtual ~SUIT_DataOwner();//!< destructor
+ //! compare function
+ virtual bool isEqual( const SUIT_DataOwner& ) const = 0;
};
+/*! \typedef SUIT_DataOwnerPtr
+ * Define smart pointer for SUIT_DataOwner object
+ */
typedef SMART(SUIT_DataOwner) SUIT_DataOwnerPtr;
+/*! Comparing two SUIT_DataOwnerPtr objects.*/
bool operator==( const SUIT_DataOwnerPtr&, const SUIT_DataOwnerPtr& );
+/*! \class QValueList
+ * \brief For more documentation see <a href="http://doc.trolltech.com">QT documentation</a>.
+ */
+/*! \class SUIT_DataOwnerPtrList
+ * \brief Manage list of SUIT_DataOwnerPtr.
+ */
class SUIT_EXPORT SUIT_DataOwnerPtrList : public QValueList<SUIT_DataOwnerPtr>
{
public:
- SUIT_DataOwnerPtrList();
- SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l );
+ SUIT_DataOwnerPtrList();//!< constructor
+ SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l );//!< copy constructor
#ifndef QT_NO_STL
- SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l );
+ SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l );//!< copy constructor for STL list
#endif
- iterator append ( const SUIT_DataOwnerPtr& x );
+ iterator append ( const SUIT_DataOwnerPtr& x );//!< append function
private:
// hide this methods: only append() should be used to add items to the list
- iterator prepend( const SUIT_DataOwnerPtr& x );
- iterator insert ( iterator it, const SUIT_DataOwnerPtr& x );
- void push_front ( const SUIT_DataOwnerPtr& x );
- void push_back ( const SUIT_DataOwnerPtr& x );
+ iterator prepend( const SUIT_DataOwnerPtr& x );//!< hide method
+ iterator insert ( iterator it, const SUIT_DataOwnerPtr& x );//!< hide method
+ void push_front ( const SUIT_DataOwnerPtr& x );//!< hide method
+ void push_back ( const SUIT_DataOwnerPtr& x );//!< hide method
};
#ifdef WIN32
#include "SUIT.h"
+/*! \brief Base counter class what children using in SmartPtr class how template */
class SUIT_EXPORT RefCount {
public:
- // constructor
+ //! constructor
RefCount() : crefs( 0 ) {}
- // copy constructor
+ //! copy constructor
RefCount( const RefCount& ) : crefs( 0 ) {}
- // destructor
+ //! destructor
virtual ~RefCount() {}
- // operator= (does not change counter)
+ //! operator= (does not change counter)
RefCount& operator=( const RefCount& ) { return *this; }
- // increments reference counter
+ //! increments reference counter
void upcount() {
++crefs;
}
- // decrements reference counter
+ //! decrements reference counter
void downcount()
{
if ( crefs > 0 && --crefs == 0 )
delete this;
}
- // get reference counter value
+ //! get reference counter value
int refcount() const { return crefs; }
private:
- unsigned long crefs; // reference counter
+ unsigned long crefs; //!< reference counter
};
+/*! \brief Template class that provides automatic casting for hold RefCount based objects.*/
template <class T> class SmartPtr {
public:
- // default constructor
+ //! default constructor
SmartPtr() : p( 0 ) {}
- // constructor from any RefCount-based class
+ //! constructor from any RefCount-based class
template<class Y> SmartPtr( Y* y_ ) { p = dynamic_cast<T*>( y_ ); if ( p ) p->upcount(); }
- // copy constructor from any RefCount-based class
+ //! copy constructor from any RefCount-based class
template<class Y> SmartPtr( const SmartPtr<Y>& y_ ) { p = dynamic_cast<T*>( y_.get() ); if ( p ) p->upcount(); }
- // copy constructor
+ //! copy constructor
SmartPtr( const SmartPtr& t_ ) : p( t_.p ) { if ( p ) p->upcount(); }
- // destructor
+ //! destructor
virtual ~SmartPtr(void)
{
if ( p )
p->downcount();
}
- // getting access
- //operator RefCount*() { return (RefCount*)p; }
- T& operator*() const { return *p; }
- T* operator->() const { return p; }
- operator T*() const { return p; }
- T* get() const { return p; }
+ // getting access
+ T& operator*() const { return *p; }//!< return *pointer
+ T* operator->() const { return p; }//!< return pointer
+ operator T*() const { return p; }//!< return pointer
+ T* get() const { return p; }//!< return pointer
- // assignment
+ //! assignment
template<class Y> SmartPtr& operator=( const SmartPtr<Y>& y_ )
{
if ( this == &y_) return *this;
return operator=( y_.get() );
}
- SmartPtr& operator=( const SmartPtr& t_ )
+ //! assignment
+ SmartPtr& operator=( const SmartPtr& t_ )
{
if ( this == &t_) return *this;
return operator=( t_.get() );
}
- SmartPtr& operator=( T* p_ )
+ //!< assignment
+ SmartPtr& operator=( T* p_ )
{
if ( p )
p->downcount();
}
// comparing
- int operator==( const SmartPtr& t_ ) { return p == t_.p; }
- int operator==( const T* p_ ) { return p == p_; }
- friend int operator==( const T* p_, const SmartPtr& t_ ) { return t_ == p_; }
- int operator!=( SmartPtr& t_ ) { return p != t_.p; }
- int operator!=( T* p_ ) { return p != p_; }
- friend int operator!=( T* p_, SmartPtr& t_ ) { return p_ != t_.p; }
+ int operator==( const SmartPtr& t_ ) { return p == t_.p; }//!< comparing
+ int operator==( const T* p_ ) { return p == p_; }//!< comparing
+ friend int operator==( const T* p_, const SmartPtr& t_ ) { return t_ == p_; }//!< comparing
+ int operator!=( SmartPtr& t_ ) { return p != t_.p; }//!< comparing
+ int operator!=( T* p_ ) { return p != p_; }//!< comparing
+ friend int operator!=( T* p_, SmartPtr& t_ ) { return p_ != t_.p; }//!< comparing
- // nullify
+ //! nullify
void nullify() { if ( p ) p->downcount(); p = 0; }
- // check for null
+ //! check for null
bool isNull() const { return p == 0; }
private:
- T* p; // stored pointer
+ T* p;//!< stored pointer
};
+/*! \def SMART( C )
+ * Define macros SMART( C ) - same as SmartPtr(C), where \a C - class object.
+ */
#define SMART( C ) SmartPtr<C>
-
+//! casting class T2 to class T1
template <class T1, class T2> SMART(T1) downcast( SMART(T2)& t )
{
return SMART(T1)(t.get());
#include <qfont.h>
#include <qstring.h>
#include <qpopupmenu.h>
-
+/*! \class Qtx
+ * \brief For more documentation see <a href="http://doc.trolltech.com">QT documentation</a>.
+ */
class SUIT_EXPORT SUIT_Tools : public Qtx
{
public: