const correct access via Smart pointer types.
More...
#include <PtrTypes.h>
Public Types | |
| typedef _Traits::_Ptr | _Ptr |
| typedef _Traits::_constPtr | _constPtr |
| typedef _Ptr::unspecified_bool_type | unspecified_bool_type |
Public Member Functions | |
| RW_pointer (typename _Ptr::element_type *dptr=0) | |
| RW_pointer (_Ptr dptr) | |
| void | reset () |
| void | reset (typename _Ptr::element_type *dptr) |
| void | swap (RW_pointer &rhs) |
| void | swap (_Ptr &rhs) |
| operator unspecified_bool_type () const | |
| const _D & | operator * () const |
| const _D * | operator-> () const |
| const _D * | get () const |
| _D & | operator * () |
| _D * | operator-> () |
| _D * | get () |
| bool | unique () const |
| long | use_count () const |
| _constPtr | getPtr () const |
| _Ptr | getPtr () |
Private Attributes | |
| _Ptr | _dptr |
Related Functions | |
| (Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &str, const RW_pointer< _D, _Ptr > &obj) |
const correct access via Smart pointer types.
zypp::RW_pointer<tt><_D,_Traits> stores a Smart pointer types of type _Traits::_Ptr, which must be convertible into a _D *. Pointer style access (via -> and *) offers a const _D * in const a context, otherwise a _D *. Thus RW_ means read/write, as you get a different type, dependent on whether you're allowed to read or write.
Forwarding access from an interface to an implemantation class, an RW_pointer prevents const interface methods from accidentally calling nonconst implementation methods.
The second template argument defaults to _Traits = rw_pointer::Shared<_D> thus wraping a shared_ptr<_D>. To wrap an intrusive_ptr<_D> use rw_pointer::Intrusive<_D>.
#include "zypp/base/PtrTypes.h" class Foo { ... private: // Implementation class struct Impl; // Pointer to implementation; actually a shared_ptr<Impl> RW_pointer<Impl> _pimpl; void baa() { _pimpl->... } // is Impl * void baa() const { _pimpl->... } // is Impl const * };
Definition at line 171 of file PtrTypes.h.
|
|||||
|
Definition at line 173 of file PtrTypes.h. |
|
|||||
|
Definition at line 174 of file PtrTypes.h. |
|
|||||
|
Definition at line 175 of file PtrTypes.h. |
|
||||||||||
|
Definition at line 178 of file PtrTypes.h. |
|
||||||||||
|
Definition at line 183 of file PtrTypes.h. |
|
|||||||||
|
||||||||||
|
Definition at line 190 of file PtrTypes.h. |
|
||||||||||
|
Definition at line 193 of file PtrTypes.h. |
|
||||||||||
|
Definition at line 196 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 199 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 202 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 205 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 208 of file PtrTypes.h. Referenced by zypp::filesystem::TmpPath::operator const void *const(), zypp::CapOrder::operator()(), and zypp::filesystem::TmpPath::path(). |
|
|||||||||
|
Definition at line 211 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 214 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 217 of file PtrTypes.h. |
|
|||||||||
|
Definition at line 221 of file PtrTypes.h. Referenced by zypp::media::MediaHandler::isSharedMedia(), zypp::media::MediaHandler::release(), and zypp::media::MediaHandler::removeAttachPoint(). |
|
|||||||||
|
Definition at line 224 of file PtrTypes.h. Referenced by zypp::media::MediaHandler::release(). |
|
|||||||||
|
Definition at line 227 of file PtrTypes.h. Referenced by zypp::ResPoolManager::accessor(), zypp::capability::CapabilityImpl::backdoor(), zypp::capability::CapabilityImpl::getSplitInfo(), and zypp::Capability::matches(). |
|
|||||||||
|
Definition at line 230 of file PtrTypes.h. |
|
|||||
|
Definition at line 234 of file PtrTypes.h. Referenced by zypp::RW_pointer< HalContext_Impl >::swap(). |
1.4.6