File indexing completed on 2025-01-18 10:15:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #if defined(XERCES_TMPLSINC)
0027 #include <xercesc/util/CountedPointer.hpp>
0028 #endif
0029
0030 XERCES_CPP_NAMESPACE_BEGIN
0031
0032
0033
0034
0035 template <class T> CountedPointerTo<T>::
0036 CountedPointerTo(const CountedPointerTo<T>& toCopy) :
0037
0038 fPtr(toCopy.fPtr)
0039 {
0040 if (fPtr)
0041 fPtr->addRef();
0042 }
0043
0044 template <class T> CountedPointerTo<T>::CountedPointerTo(T* p) :
0045
0046 fPtr(p)
0047 {
0048 if (fPtr)
0049 fPtr->addRef();
0050 }
0051
0052 template <class T> CountedPointerTo<T>::~CountedPointerTo()
0053 {
0054 if (fPtr)
0055 fPtr->removeRef();
0056 }
0057
0058
0059
0060
0061
0062 template <class T> CountedPointerTo<T>&
0063 CountedPointerTo<T>::operator=(const CountedPointerTo<T>& other)
0064 {
0065 if (this == &other)
0066 return *this;
0067
0068 if (other.fPtr)
0069 other.fPtr->addRef();
0070
0071 if (fPtr)
0072 fPtr->removeRef();
0073
0074 fPtr = other.fPtr;
0075 return *this;
0076 }
0077
0078 template <class T> CountedPointerTo<T>::operator T*()
0079 {
0080 return fPtr;
0081 }
0082
0083 template <class T> const T* CountedPointerTo<T>::operator->() const
0084 {
0085 return fPtr;
0086 }
0087
0088 template <class T> T* CountedPointerTo<T>::operator->()
0089 {
0090 return fPtr;
0091 }
0092
0093 template <class T> const T& CountedPointerTo<T>::operator*() const
0094 {
0095 if (!fPtr)
0096 ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, 0);
0097 return *fPtr;
0098 }
0099
0100 template <class T> T& CountedPointerTo<T>::operator*()
0101 {
0102 if (!fPtr)
0103 ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, 0);
0104 return *fPtr;
0105 }
0106
0107 XERCES_CPP_NAMESPACE_END