| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void clear(); | 63 void clear(); |
| 64 PassOwnPtr<T> release(); | 64 PassOwnPtr<T> release(); |
| 65 PtrType leakPtr() WARN_UNUSED_RETURN; | 65 PtrType leakPtr() WARN_UNUSED_RETURN; |
| 66 | 66 |
| 67 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } | 67 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } |
| 68 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } | 68 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } |
| 69 | 69 |
| 70 ValueType& operator[](std::ptrdiff_t i) const; | 70 ValueType& operator[](std::ptrdiff_t i) const; |
| 71 | 71 |
| 72 bool operator!() const { return !m_ptr; } | 72 bool operator!() const { return !m_ptr; } |
| 73 | 73 explicit operator bool() const { return m_ptr; } |
| 74 // This conversion operator allows implicit conversion to bool but not to | |
| 75 // other integer types. | |
| 76 typedef PtrType OwnPtr::*UnspecifiedBoolType; | |
| 77 operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : 0; } | |
| 78 | 74 |
| 79 OwnPtr& operator=(const PassOwnPtr<T>&); | 75 OwnPtr& operator=(const PassOwnPtr<T>&); |
| 80 OwnPtr& operator=(std::nullptr_t) { clear(); return *this; } | 76 OwnPtr& operator=(std::nullptr_t) { clear(); return *this; } |
| 81 template <typename U> OwnPtr& operator=(const PassOwnPtr<U>&); | 77 template <typename U> OwnPtr& operator=(const PassOwnPtr<U>&); |
| 82 | 78 |
| 83 OwnPtr(OwnPtr&&); | 79 OwnPtr(OwnPtr&&); |
| 84 template <typename U> OwnPtr(OwnPtr<U>&&); | 80 template <typename U> OwnPtr(OwnPtr<U>&&); |
| 85 | 81 |
| 86 OwnPtr& operator=(OwnPtr&&); | 82 OwnPtr& operator=(OwnPtr&&); |
| 87 template <typename U> OwnPtr& operator=(OwnPtr<U>&&); | 83 template <typename U> OwnPtr& operator=(OwnPtr<U>&&); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>&
p) | 237 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>&
p) |
| 242 { | 238 { |
| 243 return p.get(); | 239 return p.get(); |
| 244 } | 240 } |
| 245 | 241 |
| 246 } // namespace WTF | 242 } // namespace WTF |
| 247 | 243 |
| 248 using WTF::OwnPtr; | 244 using WTF::OwnPtr; |
| 249 | 245 |
| 250 #endif // WTF_OwnPtr_h | 246 #endif // WTF_OwnPtr_h |
| OLD | NEW |