ndn::detail::CFReleaser< T > Class Template Reference

Helper class to wrap CoreFoundation object pointers. More...

#include <ndn-cxx/detail/cf-releaser-osx.hpp>

Public Member Functions

 CFReleaser ()
 
 CFReleaser (const CFReleaser &inReleaser)
 
 CFReleaser (const T &typeRef)
 
 ~CFReleaser ()
 
T & get ()
 
const T & get () const
 
CFReleaseroperator= (const CFReleaser &inReleaser)
 
CFReleaseroperator= (const T &typeRef)
 
void release ()
 
void retain ()
 
void retain (const T &typeRef)
 

Friends

bool operator!= (const CFReleaser &lhs, std::nullptr_t)
 
bool operator== (const CFReleaser &lhs, std::nullptr_t)
 

Detailed Description

template<class T>
class ndn::detail::CFReleaser< T >

Helper class to wrap CoreFoundation object pointers.

The class is similar in spirit to shared_ptr, but uses CoreFoundation mechanisms to retain/release object.

Original implementation by Christopher Hunt and it was borrowed from http://www.cocoabuilder.com/archive/cocoa/130776-auto-cfrelease-and.html

Note
The filename cf-releaser-osx.hpp is an intentional violation of code-style rule 2.1. Having '-osx' suffix is necessary to prevent installation on non-macOS platforms.

Definition at line 49 of file cf-releaser-osx.hpp.

Constructor & Destructor Documentation

◆ CFReleaser() [1/3]

template<class T >
ndn::detail::CFReleaser< T >::CFReleaser ( )
inline

Definition at line 52 of file cf-releaser-osx.hpp.

◆ CFReleaser() [2/3]

template<class T >
ndn::detail::CFReleaser< T >::CFReleaser ( const T &  typeRef)
inline

Definition at line 57 of file cf-releaser-osx.hpp.

◆ CFReleaser() [3/3]

template<class T >
ndn::detail::CFReleaser< T >::CFReleaser ( const CFReleaser< T > &  inReleaser)
inline

Definition at line 62 of file cf-releaser-osx.hpp.

◆ ~CFReleaser()

template<class T >
ndn::detail::CFReleaser< T >::~CFReleaser ( )
inline

Definition at line 85 of file cf-releaser-osx.hpp.

Member Function Documentation

◆ get() [1/2]

template<class T >
T& ndn::detail::CFReleaser< T >::get ( )
inline

Definition at line 98 of file cf-releaser-osx.hpp.

◆ get() [2/2]

template<class T >
const T& ndn::detail::CFReleaser< T >::get ( ) const
inline

Definition at line 92 of file cf-releaser-osx.hpp.

◆ operator=() [1/2]

template<class T >
CFReleaser& ndn::detail::CFReleaser< T >::operator= ( const CFReleaser< T > &  inReleaser)
inline

Definition at line 79 of file cf-releaser-osx.hpp.

◆ operator=() [2/2]

template<class T >
CFReleaser& ndn::detail::CFReleaser< T >::operator= ( const T &  typeRef)
inline

Definition at line 69 of file cf-releaser-osx.hpp.

◆ release()

template<class T >
void ndn::detail::CFReleaser< T >::release ( )
inline

Definition at line 123 of file cf-releaser-osx.hpp.

◆ retain() [1/2]

template<class T >
void ndn::detail::CFReleaser< T >::retain ( )
inline

Definition at line 115 of file cf-releaser-osx.hpp.

◆ retain() [2/2]

template<class T >
void ndn::detail::CFReleaser< T >::retain ( const T &  typeRef)
inline

Definition at line 105 of file cf-releaser-osx.hpp.

Friends And Related Function Documentation

◆ operator!=

template<class T >
bool operator!= ( const CFReleaser< T > &  lhs,
std::nullptr_t   
)
friend

Definition at line 139 of file cf-releaser-osx.hpp.

◆ operator==

template<class T >
bool operator== ( const CFReleaser< T > &  lhs,
std::nullptr_t   
)
friend

Definition at line 133 of file cf-releaser-osx.hpp.