21 #include "kdelibs_export.h"
113 : ptr(t) {
if ( ptr ) ptr->_KShared_ref(); }
120 : ptr(p.ptr) {
if ( ptr ) ptr->_KShared_ref(); }
129 if ( ptr == p.ptr )
return *
this;
130 if ( ptr ) ptr->_KShared_unref();
132 if ( ptr ) ptr->_KShared_ref();
136 if ( ptr == p )
return *
this;
137 if ( ptr ) ptr->_KShared_unref();
139 if ( ptr ) ptr->_KShared_ref();
142 bool operator== (
const KSharedPtr<T>& p )
const {
return ( ptr == p.ptr ); }
143 bool operator!= (
const KSharedPtr<T>& p )
const {
return ( ptr != p.ptr ); }
144 bool operator== (
const T* p )
const {
return ( ptr == p ); }
145 bool operator!= (
const T* p )
const {
return ( ptr != p ); }
146 bool operator!()
const {
return ( ptr == 0 ); }
147 operator T*()
const {
return ptr; }
159 const T*
data()
const {
return ptr; }
161 const T& operator*()
const {
return *ptr; }
162 T& operator*() {
return *ptr; }
163 const T* operator->()
const {
return ptr; }
164 T* operator->() {
return ptr; }
170 int count()
const {
return ptr->_KShared_count(); }