Qt 4.8
Public Functions | Properties | List of all members
QPatternist::AutoPtr< T > Class Template Reference

A smart pointer very similar to std::auto_ptr. More...

#include <qautoptr_p.h>

Public Functions

 AutoPtr (T *pointer=0)
 
 AutoPtr (AutoPtr< T > &other)
 
 AutoPtr (AutoPtrRef< T > ref)
 
template<typename L >
 AutoPtr (AutoPtr< L > &other)
 
T * data () const
 
template<typename L >
 operator AutoPtr< L > ()
 
template<typename L >
 operator AutoPtrRef< L > ()
 
 operator bool () const
 
bool operator! () const
 
T & operator* () const
 
T * operator-> () const
 
AutoPtroperator= (AutoPtrRef< T > ref)
 
AutoPtroperator= (AutoPtr &other)
 
T * release ()
 
void reset (T *other=0)
 
 ~AutoPtr ()
 

Properties

T * m_ptr
 

Detailed Description

template<typename T>
class QPatternist::AutoPtr< T >

A smart pointer very similar to std::auto_ptr.

Warning
This function is not part of the public interface.
Since
4.4

Definition at line 73 of file qautoptr_p.h.

Constructors and Destructors

◆ AutoPtr() [1/4]

template<typename T>
QPatternist::AutoPtr< T >::AutoPtr ( T *  pointer = 0)
inlineexplicit

Definition at line 76 of file qautoptr_p.h.

76  : m_ptr(pointer)
77  {
78  }

◆ AutoPtr() [2/4]

template<typename T>
QPatternist::AutoPtr< T >::AutoPtr ( AutoPtr< T > &  other)
inline

Definition at line 80 of file qautoptr_p.h.

80  : m_ptr(other.release())
81  {
82  }

◆ ~AutoPtr()

template<typename T>
QPatternist::AutoPtr< T >::~AutoPtr ( )
inline

Definition at line 84 of file qautoptr_p.h.

85  {
86  delete m_ptr;
87  }

◆ AutoPtr() [3/4]

template<typename T>
QPatternist::AutoPtr< T >::AutoPtr ( AutoPtrRef< T >  ref)
inline

Definition at line 111 of file qautoptr_p.h.

111  : m_ptr(ref.m_ptr)
112  {
113  }

◆ AutoPtr() [4/4]

template<typename T>
template<typename L >
QPatternist::AutoPtr< T >::AutoPtr ( AutoPtr< L > &  other)
inline

Definition at line 138 of file qautoptr_p.h.

138  : m_ptr(other.release())
139  {
140  }

Functions

◆ data()

template<typename T>
T* QPatternist::AutoPtr< T >::data ( ) const
inline

◆ operator AutoPtr< L >()

template<typename T>
template<typename L >
QPatternist::AutoPtr< T >::operator AutoPtr< L > ( )
inline

Definition at line 132 of file qautoptr_p.h.

133  {
134  return AutoPtr<L>(this->release());
135  }

◆ operator AutoPtrRef< L >()

template<typename T>
template<typename L >
QPatternist::AutoPtr< T >::operator AutoPtrRef< L > ( )
inline

Definition at line 126 of file qautoptr_p.h.

127  {
128  return AutoPtrRef<L>(this->release());
129  }

◆ operator bool()

template<typename T>
QPatternist::AutoPtr< T >::operator bool ( ) const
inline

Definition at line 106 of file qautoptr_p.h.

107  {
108  return m_ptr != 0;
109  }

◆ operator!()

template<typename T>
bool QPatternist::AutoPtr< T >::operator! ( ) const
inline

Definition at line 101 of file qautoptr_p.h.

102  {
103  return !m_ptr;
104  }

◆ operator*()

template<typename T>
T& QPatternist::AutoPtr< T >::operator* ( ) const
inline

Definition at line 89 of file qautoptr_p.h.

90  {
92  return *m_ptr;
93  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator->()

template<typename T>
T* QPatternist::AutoPtr< T >::operator-> ( ) const
inline

Definition at line 95 of file qautoptr_p.h.

96  {
98  return m_ptr;
99  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator=() [1/2]

template<typename T>
AutoPtr& QPatternist::AutoPtr< T >::operator= ( AutoPtrRef< T >  ref)
inline

Definition at line 115 of file qautoptr_p.h.

116  {
117  if(ref.m_ptr != m_ptr)
118  {
119  delete m_ptr;
120  m_ptr = ref.m_ptr;
121  }
122  return *this;
123  }

◆ operator=() [2/2]

template<typename T>
AutoPtr& QPatternist::AutoPtr< T >::operator= ( AutoPtr< T > &  other)
inline

Definition at line 163 of file qautoptr_p.h.

164  {
165  reset(other.release());
166  return *this;
167  }
void reset(T *other=0)
Definition: qautoptr_p.h:154

◆ release()

template<typename T>
T* QPatternist::AutoPtr< T >::release ( )
inline

Definition at line 142 of file qautoptr_p.h.

Referenced by QPatternist::AutoPtr< NodeBuilder >::operator=().

143  {
144  T *const retval = m_ptr;
145  m_ptr = 0;
146  return retval;
147  }

◆ reset()

template<typename T>
void QPatternist::AutoPtr< T >::reset ( T *  other = 0)
inline

Definition at line 154 of file qautoptr_p.h.

Referenced by QXmlQuery::setQuery().

155  {
156  if(other != m_ptr)
157  {
158  delete m_ptr;
159  m_ptr = other;
160  }
161  }

Properties

◆ m_ptr

template<typename T>
T* QPatternist::AutoPtr< T >::m_ptr
private

Definition at line 170 of file qautoptr_p.h.


The documentation for this class was generated from the following file: