ManaPlus
Public Member Functions | Private Attributes
Catch::Ptr< T > Class Template Reference

#include <catch.hpp>

Public Member Functions

 Ptr ()
 
 Ptr (T *p)
 
 Ptr (Ptr const &other)
 
 ~Ptr ()
 
void reset ()
 
Ptroperator= (T *p)
 
Ptroperator= (Ptr const &other)
 
void swap (Ptr &other)
 
T * get () const
 
T & operator* () const
 
T * operator-> () const
 
bool operator! () const
 
 operator SafeBool::type () const
 

Private Attributes

T * m_p
 

Detailed Description

template<typename T>
class Catch::Ptr< T >

Definition at line 497 of file catch.hpp.

Constructor & Destructor Documentation

◆ Ptr() [1/3]

template<typename T >
Catch::Ptr< T >::Ptr ( )
inline

Definition at line 499 of file catch.hpp.

499 : m_p( CATCH_NULL ){}
#define CATCH_NULL
Definition: catch.hpp:299
T * m_p
Definition: catch.hpp:535

◆ Ptr() [2/3]

template<typename T >
Catch::Ptr< T >::Ptr ( T *  p)
inline

Definition at line 500 of file catch.hpp.

500  : m_p( p ){
501  if( m_p )
502  m_p->addRef();
503  }

◆ Ptr() [3/3]

template<typename T >
Catch::Ptr< T >::Ptr ( Ptr< T > const &  other)
inline

Definition at line 504 of file catch.hpp.

504  : m_p( other.m_p ){
505  if( m_p )
506  m_p->addRef();
507  }

◆ ~Ptr()

template<typename T >
Catch::Ptr< T >::~Ptr ( )
inline

Definition at line 508 of file catch.hpp.

508  {
509  if( m_p )
510  m_p->release();
511  }

Member Function Documentation

◆ get()

template<typename T >
T* Catch::Ptr< T >::get ( ) const
inline

Definition at line 528 of file catch.hpp.

528 { return m_p; }

◆ operator SafeBool::type()

template<typename T >
Catch::Ptr< T >::operator SafeBool::type ( ) const
inline

Definition at line 532 of file catch.hpp.

532 { return SafeBool::makeSafe( m_p != CATCH_NULL ); }
static type makeSafe(bool value)
Definition: catch.hpp:345

References CATCH_NULL, and Catch::SafeBool::makeSafe().

◆ operator!()

template<typename T >
bool Catch::Ptr< T >::operator! ( ) const
inline

Definition at line 531 of file catch.hpp.

531 { return m_p == CATCH_NULL; }

References CATCH_NULL.

◆ operator*()

template<typename T >
T& Catch::Ptr< T >::operator* ( ) const
inline

Definition at line 529 of file catch.hpp.

529 { return *m_p; }

◆ operator->()

template<typename T >
T* Catch::Ptr< T >::operator-> ( ) const
inline

Definition at line 530 of file catch.hpp.

530 { return m_p; }

◆ operator=() [1/2]

template<typename T >
Ptr& Catch::Ptr< T >::operator= ( Ptr< T > const &  other)
inline

Definition at line 522 of file catch.hpp.

522  {
523  Ptr temp( other );
524  swap( temp );
525  return *this;
526  }
void swap(Ptr &other)
Definition: catch.hpp:527

◆ operator=() [2/2]

template<typename T >
Ptr& Catch::Ptr< T >::operator= ( T *  p)
inline

Definition at line 517 of file catch.hpp.

517  {
518  Ptr temp( p );
519  swap( temp );
520  return *this;
521  }

◆ reset()

template<typename T >
void Catch::Ptr< T >::reset ( )
inline

Definition at line 512 of file catch.hpp.

512  {
513  if( m_p )
514  m_p->release();
515  m_p = CATCH_NULL;
516  }

References CATCH_NULL.

◆ swap()

template<typename T >
void Catch::Ptr< T >::swap ( Ptr< T > &  other)
inline

Definition at line 527 of file catch.hpp.

527 { std::swap( m_p, other.m_p ); }

References Catch::Ptr< T >::m_p.

Field Documentation

◆ m_p

template<typename T >
T* Catch::Ptr< T >::m_p
private

Definition at line 535 of file catch.hpp.

Referenced by Catch::Ptr< T >::swap().


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