libzypp 17.31.23
|
Reference counted access to a Tp
object calling a custom Dispose
function when the last AutoDispose handle to it is destroyed or reset.
More...
#include <AutoDispose.h>
Classes | |
struct | Impl |
Public Types | |
typedef boost::call_traits< Tp >::param_type | param_type |
typedef boost::call_traits< Tp >::reference | reference |
typedef boost::call_traits< Tp >::const_reference | const_reference |
typedef Tp | value_type |
typedef boost::call_traits< Tp >::value_type | result_type |
using | dispose_param_type = typename std::conditional< std::is_pointer< Tp >::value||std::is_integral< Tp >::value, Tp const, reference >::type |
using | Dispose = function< void(dispose_param_type)> |
Dispose function signatue. | |
Public Member Functions | |
AutoDispose () | |
Default Ctor using default constructed value and no dispose function. | |
AutoDispose (const Dispose &dispose_r) | |
Ctor taking dispose function and using default constructed value. | |
AutoDispose (const value_type &value_r) | |
Ctor taking value and no dispose function. | |
AutoDispose (const value_type &value_r, const Dispose &dispose_r) | |
Ctor taking value and dispose function. | |
AutoDispose (value_type &&value_r) | |
Ctor taking rvalue and no dispose function. | |
AutoDispose (value_type &&value_r, const Dispose &dispose_r) | |
Ctor taking rvalue and dispose function. | |
operator reference () const | |
Provide implicit conversion to Tp& . | |
reference | value () const |
Reference to the Tp object. | |
reference | operator* () const |
Reference to the Tp object. | |
value_type * | operator-> () const |
Pointer to the Tp object (asserted to be != NULL ). | |
void | reset () |
Reset to default Ctor values. | |
void | swap (AutoDispose &rhs) |
Exchange the contents of two AutoDispose objects. | |
bool | unique () const |
Returns true if this is the only AutoDispose instance managing the current data object. | |
const Dispose & | getDispose () const |
Return the current dispose function. | |
void | setDispose (const Dispose &dispose_r) |
Set a new dispose function. | |
void | resetDispose () |
Set no dispose function. | |
void | swapDispose (Dispose &dispose_r) |
Exchange the dispose function. | |
Private Attributes | |
shared_ptr< Impl > | _pimpl |
Related Functions | |
(Note that these are not member functions.) | |
template<class Tp > | |
std::ostream & | operator<< (std::ostream &str, const AutoDispose< Tp > &obj) |
Stream output of the Tp object. | |
Reference counted access to a Tp
object calling a custom Dispose
function when the last AutoDispose handle to it is destroyed or reset.
AutoDispose
object does not apply to the stored Tp
object. If the stored Tp
object should be immutable, you should use AutoDispose<const Tp>
.Pass a filename to the application and provide the appropriate code to be executed when the file is no longer needed:
Exception safe handling of temporary files:
Definition at line 93 of file AutoDispose.h.
typedef boost::call_traits<Tp>::param_type zypp::AutoDispose< Tp >::param_type |
Definition at line 96 of file AutoDispose.h.
typedef boost::call_traits<Tp>::reference zypp::AutoDispose< Tp >::reference |
Definition at line 97 of file AutoDispose.h.
typedef boost::call_traits<Tp>::const_reference zypp::AutoDispose< Tp >::const_reference |
Definition at line 98 of file AutoDispose.h.
typedef Tp zypp::AutoDispose< Tp >::value_type |
Definition at line 99 of file AutoDispose.h.
typedef boost::call_traits<Tp>::value_type zypp::AutoDispose< Tp >::result_type |
Definition at line 100 of file AutoDispose.h.
using zypp::AutoDispose< Tp >::dispose_param_type = typename std::conditional< std::is_pointer<Tp>::value || std::is_integral<Tp>::value, Tp const, reference >::type |
Definition at line 103 of file AutoDispose.h.
using zypp::AutoDispose< Tp >::Dispose = function<void ( dispose_param_type )> |
Dispose function signatue.
Definition at line 107 of file AutoDispose.h.
|
inline |
Default Ctor using default constructed value and no dispose function.
Definition at line 111 of file AutoDispose.h.
|
inlineexplicit |
Ctor taking dispose function and using default constructed value.
Definition at line 116 of file AutoDispose.h.
|
inlineexplicit |
Ctor taking value and no dispose function.
Definition at line 121 of file AutoDispose.h.
|
inline |
Ctor taking value and dispose function.
Definition at line 126 of file AutoDispose.h.
|
inlineexplicit |
Ctor taking rvalue and no dispose function.
Definition at line 131 of file AutoDispose.h.
|
inline |
Ctor taking rvalue and dispose function.
Definition at line 136 of file AutoDispose.h.
|
inline |
Provide implicit conversion to Tp&
.
Definition at line 143 of file AutoDispose.h.
|
inline |
Reference to the Tp
object.
Definition at line 147 of file AutoDispose.h.
|
inline |
Reference to the Tp
object.
Definition at line 151 of file AutoDispose.h.
|
inline |
Pointer to the Tp
object (asserted to be != NULL
).
Definition at line 155 of file AutoDispose.h.
|
inline |
Reset to default Ctor values.
Definition at line 159 of file AutoDispose.h.
|
inline |
Exchange the contents of two AutoDispose objects.
Definition at line 163 of file AutoDispose.h.
|
inline |
Returns true if this is the only AutoDispose instance managing the current data object.
Definition at line 167 of file AutoDispose.h.
|
inline |
Return the current dispose function.
Definition at line 172 of file AutoDispose.h.
|
inline |
Set a new dispose function.
Definition at line 176 of file AutoDispose.h.
|
inline |
Set no dispose function.
Definition at line 180 of file AutoDispose.h.
|
inline |
Exchange the dispose function.
Definition at line 184 of file AutoDispose.h.
|
related |
Stream output of the Tp
object.
Definition at line 292 of file AutoDispose.h.
|
private |
Definition at line 208 of file AutoDispose.h.