From b3528ea693662320392e88f2ac23bf9f7411e3b6 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Mon, 21 Nov 2005 13:24:56 +0000 Subject: [PATCH] Additionaly provide Ptr types defined by DEFINE_PTR_TYPE macro as Foo_Ptr and Foo_constPtr. These name are to be used in new code. The old names will be convert soon, and the typedefs removed. --- zypp/base/PtrTypes.h | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/zypp/base/PtrTypes.h b/zypp/base/PtrTypes.h index 8937ca2..ea38208 100644 --- a/zypp/base/PtrTypes.h +++ b/zypp/base/PtrTypes.h @@ -70,31 +70,9 @@ namespace zypp * nonconst implementation methods. In case you have to do so, call * unconst to get the _D *. * - * The second template argument defaults to _Ptr = shared__ptr<_D>. + * The second template argument defaults to _Ptr = shared_ptr<_D>. * * \todo refine ctor and assign. - * \todo check whether scoped_ptr's refusal to handle an incomplete type - * is a compiler bug. Introducing ~CI does not help, although I is complete - * when ~CI is called. This renders scoped_ptr less usefull. - * \code - * #include - * struct I; - * struct CI - * { - * ~CI(); - * private: - * zypp::base::scoped_ptr i; - * }; - * int main( int argc, char * argv[] ) - * { - * CI c; - * return 0; - * } - * struct I {}; - * CI::~CI() - * { - * } - * \endcode */ template > struct ImplPtr @@ -110,10 +88,12 @@ namespace zypp const _D & operator*() const { return *_dptr; }; _D * operator->() { return _dptr.get(); } const _D * operator->() const { return _dptr.get(); } + _D * get() { return _dptr.get(); } + const _D * get() const { return _dptr.get(); } _D * unconst() const { return _dptr.get(); } - + private: _Ptr _dptr; }; /////////////////////////////////////////////////////////////////// @@ -140,10 +120,12 @@ namespace zypp const _D & operator*() const { return *_dptr; }; _D * operator->() { return _dptr; } const _D * operator->() const { return _dptr; } + _D * get() { return _dptr; } + const _D * get() const { return _dptr; } _D * unconst() const { return _dptr; } - + private: _P * _dptr; }; ///////////////////////////////////////////////////////////////// @@ -163,7 +145,9 @@ class NAME; \ extern void intrusive_ptr_add_ref( const NAME * ); \ extern void intrusive_ptr_release( const NAME * ); \ typedef zypp::base::intrusive_ptr NAME##Ptr; \ -typedef zypp::base::intrusive_ptr const##NAME##Ptr; +typedef zypp::base::intrusive_ptr const##NAME##Ptr; \ +typedef zypp::base::intrusive_ptr NAME##_Ptr; \ +typedef zypp::base::intrusive_ptr NAME##_constPtr; /////////////////////////////////////////////////////////////////// #endif // ZYPP_BASE_PTRTYPES_H -- 2.7.4