yast2-core
Public Member Functions | Private Member Functions
VarPtr< _Rep > Class Template Reference

Simple counted pointer with variable like const access. More...

#include <Rep.h>

Inheritance diagram for VarPtr< _Rep >:
BasicRepPtr

List of all members.

Public Member Functions

 VarPtr ()
 VarPtr (_Rep *ptr_r)
_Rep * operator-> ()
const _Rep * operator-> () const
_Rep & operator* ()
const _Rep & operator* () const
- Public Member Functions inherited from BasicRepPtr
 operator const void * () const

Private Member Functions

_Rep * ptr () const

Additional Inherited Members

- Protected Member Functions inherited from BasicRepPtr
 BasicRepPtr ()
 BasicRepPtr (Rep *ptr)
 BasicRepPtr (const BasicRepPtr &rhs)
BasicRepPtroperator= (const BasicRepPtr &rhs)
 ~BasicRepPtr ()
ReprepPtr () const

Detailed Description

template<typename _Rep>
class VarPtr< _Rep >

Simple counted pointer with variable like const access.

On construction and assignment it behaves like a pointer. I.e. a 'const VarPtr<_Tp>' is a '_Tp *const'.

But accessing _Tp (via operator-> or operator*) its constness is propagated to _Tp. I.e. 'VarPtr<_Tp>' behaves like a '_Tp *' while a 'const VarPtr<_Tp>' behaves as a 'const _Tp *'.

Used in some classes to hide implementation data from the interface:

 class Foo
 {
   class _Implementation;
   VarPtr<_Implementation> _impl;
   ...
 

All a VarPtr does, is preventing accidential access to nonconst implementation data from const interface methods. If such access is intended is has to be expressed by using a cost_cast.


Constructor & Destructor Documentation

template<typename _Rep >
VarPtr< _Rep >::VarPtr ( )
inline

Default ctor: NULL

template<typename _Rep >
VarPtr< _Rep >::VarPtr ( _Rep *  ptr_r)
inlineexplicit

See makeVarPtr for convenient construction.


Member Function Documentation

template<typename _Rep >
_Rep& VarPtr< _Rep >::operator* ( )
inline

References VarPtr< _Rep >::ptr().

template<typename _Rep >
const _Rep& VarPtr< _Rep >::operator* ( ) const
inline

References VarPtr< _Rep >::ptr().

template<typename _Rep >
_Rep* VarPtr< _Rep >::operator-> ( )
inline

References VarPtr< _Rep >::ptr().

template<typename _Rep >
const _Rep* VarPtr< _Rep >::operator-> ( ) const
inline

References VarPtr< _Rep >::ptr().

template<typename _Rep >
_Rep* VarPtr< _Rep >::ptr ( ) const
inlineprivate

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

Generated on a sunny day for yast2-core by doxygen 1.8.1