Changeset 11763 in webkit for trunk/JavaScriptCore/kxmlcore/RefPtr.h
- Timestamp:
- Dec 25, 2005, 1:22:35 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kxmlcore/RefPtr.h
r11747 r11763 29 29 30 30 template <typename T> class PassRefPtr; 31 template <typename T> class PassRefPtr_Ref;32 31 33 32 template <typename T> class RefPtr … … 37 36 RefPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); } 38 37 RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); } 39 template <typename U> RefPtr(PassRefPtr<U>&);40 template <typename U> RefPtr( PassRefPtr_Ref<U>);38 // see comment in PassRefPtr.h for why this takes const reference 39 template <typename U> RefPtr(const PassRefPtr<U>&); 41 40 42 41 ~RefPtr() { if (T *ptr = m_ptr) ptr->deref(); } … … 57 56 RefPtr& operator=(const RefPtr&); 58 57 RefPtr& operator=(T *); 59 RefPtr& operator=(PassRefPtr<T>&); 60 RefPtr& operator=(PassRefPtr_Ref<T>); 58 RefPtr& operator=(const PassRefPtr<T>&); 61 59 template <typename U> RefPtr& operator=(const RefPtr<U>&); 62 template <typename U> RefPtr& operator=(PassRefPtr<U>&); 63 template <typename U> RefPtr& operator=(PassRefPtr_Ref<U>); 60 template <typename U> RefPtr& operator=(const PassRefPtr<U>&); 64 61 65 62 void swap(RefPtr&); … … 69 66 }; 70 67 71 template <typename T> template <typename U> inline RefPtr<T>::RefPtr(PassRefPtr_Ref<U> ref) 72 : m_ptr(ref.m_ptr) 73 { 74 } 75 76 template <typename T> template <typename U> inline RefPtr<T>::RefPtr(PassRefPtr<U>& o) 68 template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o) 77 69 : m_ptr(o.release()) 78 70 { … … 111 103 } 112 104 113 template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(PassRefPtr_Ref<U> ref) 114 { 115 if (m_ptr) 116 m_ptr->deref(); 117 m_ptr = ref.m_ptr; 118 return *this; 119 } 120 121 template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(PassRefPtr<T>& o) 105 template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o) 122 106 { 123 107 if (m_ptr) … … 127 111 } 128 112 129 template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(PassRefPtr_Ref<T> ref) 130 { 131 if (m_ptr) 132 m_ptr->deref(); 133 m_ptr = ref.m_ptr; 134 return *this; 135 } 136 137 template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(PassRefPtr<U>& o) 113 template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o) 138 114 { 139 115 if (m_ptr)
Note:
See TracChangeset
for help on using the changeset viewer.