Lines Matching defs:RetainPtr

48     // Unlike most most of our smart pointers, RetainPtr can take either the pointer type or the pointed-to type,
49 // so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work.
64 template<typename T> class RetainPtr {
69 RetainPtr() : m_ptr(0) {}
70 RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); }
72 RetainPtr(AdoptCFTag, PtrType ptr) : m_ptr(ptr) { }
73 RetainPtr(AdoptNSTag, PtrType ptr) : m_ptr(ptr) { adoptNSReference(ptr); }
75 RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
78 RetainPtr(RetainPtr&& o) : m_ptr(o.leakRef()) { }
82 RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
85 ~RetainPtr() { if (PtrType ptr = m_ptr) CFRelease(ptr); }
87 template<typename U> RetainPtr(const RetainPtr<U>&);
101 typedef PtrType RetainPtr::*UnspecifiedBoolType;
102 operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : 0; }
104 RetainPtr& operator=(const RetainPtr&);
105 template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
106 RetainPtr& operator=(PtrType);
107 template<typename U> RetainPtr& operator=(U*);
110 RetainPtr& operator=(RetainPtr&&);
111 template<typename U> RetainPtr& operator=(RetainPtr<U>&&);
115 RetainPtr& operator=(std::nullptr_t) { clear(); return *this; }
121 void swap(RetainPtr&);
129 template<typename T> template<typename U> inline RetainPtr<T>::RetainPtr(const RetainPtr<U>& o)
136 template<typename T> inline void RetainPtr<T>::clear()
144 template<typename T> inline typename RetainPtr<T>::PtrType RetainPtr<T>::leakRef()
151 template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<T>& o)
163 template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<U>& o)
175 template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(PtrType optr)
186 template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr)
198 template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<T>&& o)
204 template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<U>&& o)
211 template<typename T> inline void RetainPtr<T>::adoptCF(PtrType optr)
219 template<typename T> inline void RetainPtr<T>::adoptNS(PtrType optr)
229 template<typename T> inline void RetainPtr<T>::swap(RetainPtr<T>& o)
234 template<typename T> inline void swap(RetainPtr<T>& a, RetainPtr<T>& b)
239 template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, const RetainPtr<U>& b)
244 template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, U* b)
249 template<typename T, typename U> inline bool operator==(T* a, const RetainPtr<U>& b)
254 template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, const RetainPtr<U>& b)
259 template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, U* b)
264 template<typename T, typename U> inline bool operator!=(T* a, const RetainPtr<U>& b)
269 template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
270 template<typename T> inline RetainPtr<T> adoptCF(T o)
272 return RetainPtr<T>(AdoptCF, o);
275 template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
276 template<typename T> inline RetainPtr<T> adoptNS(T o)
278 return RetainPtr<T>(AdoptNS, o);
281 // Helper function for creating a RetainPtr using template argument deduction.
282 template<typename T> inline RetainPtr<T> retainPtr(T) WARN_UNUSED_RETURN;
283 template<typename T> inline RetainPtr<T> retainPtr(T o)
285 return RetainPtr<T>(o);
288 template<typename P> struct HashTraits<RetainPtr<P> > : SimpleClassHashTraits<RetainPtr<P> > { };
290 template<typename P> struct PtrHash<RetainPtr<P> > : PtrHash<typename RetainPtr<P>::PtrType> {
291 using PtrHash<typename RetainPtr<P>::PtrType>::hash;
292 static unsigned hash(const RetainPtr<P>& key) { return hash(key.get()); }
293 using PtrHash<typename RetainPtr<P>::PtrType>::equal;
294 static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b) { return a == b; }
295 static bool equal(typename RetainPtr<P>::PtrType a, const RetainPtr<P>& b) { return a == b; }
296 static bool equal(const RetainPtr<P>& a, typename RetainPtr<P>::PtrType b) { return a == b; }
299 template<typename P> struct DefaultHash<RetainPtr<P> > { typedef PtrHash<RetainPtr<P> > Hash; };
306 using WTF::RetainPtr;