Electroneum
testing::internal::scoped_ptr< T > Class Template Reference

#include <gtest-port.h>

Public Types

typedef T element_type
 
typedef T element_type
 

Public Member Functions

 scoped_ptr (T *p=NULL)
 
 ~scoped_ptr ()
 
Toperator* () const
 
Toperator-> () const
 
Tget () const
 
Trelease ()
 
void reset (T *p=NULL)
 
 scoped_ptr (T *p=NULL)
 
 ~scoped_ptr ()
 
Toperator* () const
 
Toperator-> () const
 
Tget () const
 
Trelease ()
 
void reset (T *p=NULL)
 

Friends

void swap (scoped_ptr &a, scoped_ptr &b)
 
void swap (scoped_ptr &a, scoped_ptr &b)
 

Detailed Description

template<typename T>
class testing::internal::scoped_ptr< T >

Definition at line 1115 of file gtest-port.h.

Member Typedef Documentation

◆ element_type [1/2]

template<typename T>
typedef T testing::internal::scoped_ptr< T >::element_type

Definition at line 1117 of file gtest-port.h.

◆ element_type [2/2]

template<typename T>
typedef T testing::internal::scoped_ptr< T >::element_type

Definition at line 1118 of file gtest-port.h.

Constructor & Destructor Documentation

◆ scoped_ptr() [1/2]

template<typename T>
testing::internal::scoped_ptr< T >::scoped_ptr ( T p = NULL)
inlineexplicit

Definition at line 1119 of file gtest-port.h.

1119 : ptr_(p) {}

◆ ~scoped_ptr() [1/2]

template<typename T>
testing::internal::scoped_ptr< T >::~scoped_ptr ( )
inline

Definition at line 1120 of file gtest-port.h.

1120 { reset(); }

◆ scoped_ptr() [2/2]

template<typename T>
testing::internal::scoped_ptr< T >::scoped_ptr ( T p = NULL)
inlineexplicit

Definition at line 1120 of file gtest-port.h.

1120 : ptr_(p) {}

◆ ~scoped_ptr() [2/2]

template<typename T>
testing::internal::scoped_ptr< T >::~scoped_ptr ( )
inline

Definition at line 1121 of file gtest-port.h.

1121 { reset(); }

Member Function Documentation

◆ get() [1/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::get ( ) const
inline

Definition at line 1124 of file gtest-port.h.

1124 { return ptr_; }

◆ get() [2/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::get ( ) const
inline

Definition at line 1125 of file gtest-port.h.

1125 { return ptr_; }

◆ operator*() [1/2]

template<typename T>
T& testing::internal::scoped_ptr< T >::operator* ( ) const
inline

Definition at line 1122 of file gtest-port.h.

1122 { return *ptr_; }

◆ operator*() [2/2]

template<typename T>
T& testing::internal::scoped_ptr< T >::operator* ( ) const
inline

Definition at line 1123 of file gtest-port.h.

1123 { return *ptr_; }

◆ operator->() [1/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::operator-> ( ) const
inline

Definition at line 1123 of file gtest-port.h.

1123 { return ptr_; }

◆ operator->() [2/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::operator-> ( ) const
inline

Definition at line 1124 of file gtest-port.h.

1124 { return ptr_; }

◆ release() [1/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::release ( )
inline

Definition at line 1126 of file gtest-port.h.

1126  {
1127  T* const ptr = ptr_;
1128  ptr_ = NULL;
1129  return ptr;
1130  }
const uint32_t T[512]

◆ release() [2/2]

template<typename T>
T* testing::internal::scoped_ptr< T >::release ( )
inline

Definition at line 1127 of file gtest-port.h.

1127  {
1128  T* const ptr = ptr_;
1129  ptr_ = NULL;
1130  return ptr;
1131  }
const uint32_t T[512]

◆ reset() [1/2]

template<typename T>
void testing::internal::scoped_ptr< T >::reset ( T p = NULL)
inline

Definition at line 1132 of file gtest-port.h.

1132  {
1133  if (p != ptr_) {
1134  if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
1135  delete ptr_;
1136  }
1137  ptr_ = p;
1138  }
1139  }
const uint32_t T[512]
GTEST_API_ bool IsTrue(bool condition)
Here is the caller graph for this function:

◆ reset() [2/2]

template<typename T>
void testing::internal::scoped_ptr< T >::reset ( T p = NULL)
inline

Definition at line 1133 of file gtest-port.h.

1133  {
1134  if (p != ptr_) {
1135  if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
1136  delete ptr_;
1137  }
1138  ptr_ = p;
1139  }
1140  }
const uint32_t T[512]
GTEST_API_ bool IsTrue(bool condition)

Friends And Related Function Documentation

◆ swap [1/2]

template<typename T>
void swap ( scoped_ptr< T > &  a,
scoped_ptr< T > &  b 
)
friend

Definition at line 1141 of file gtest-port.h.

1141  {
1142  using std::swap;
1143  swap(a.ptr_, b.ptr_);
1144  }
friend void swap(scoped_ptr &a, scoped_ptr &b)
Definition: gtest-port.h:1141
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124

◆ swap [2/2]

template<typename T>
void swap ( scoped_ptr< T > &  a,
scoped_ptr< T > &  b 
)
friend

Definition at line 1142 of file gtest-port.h.

1142  {
1143  using std::swap;
1144  swap(a.ptr_, b.ptr_);
1145  }
friend void swap(scoped_ptr &a, scoped_ptr &b)
Definition: gtest-port.h:1141
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124

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