OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ | 5 #ifndef CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ |
6 #define CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ | 6 #define CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "core/fxcrt/include/fx_memory.h" | 10 #include "core/fxcrt/include/fx_memory.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 Reset(that.Get()); | 39 Reset(that.Get()); |
40 return *this; | 40 return *this; |
41 } | 41 } |
42 | 42 |
43 bool operator==(const CFX_RetainPtr& that) const { | 43 bool operator==(const CFX_RetainPtr& that) const { |
44 return Get() == that.Get(); | 44 return Get() == that.Get(); |
45 } | 45 } |
46 | 46 |
47 bool operator!=(const CFX_RetainPtr& that) const { return !(*this == that); } | 47 bool operator!=(const CFX_RetainPtr& that) const { return !(*this == that); } |
48 | 48 |
49 operator bool() const { return !!m_pObj; } | 49 explicit operator bool() const { return !!m_pObj; } |
50 T& operator*() const { return *m_pObj.get(); } | 50 T& operator*() const { return *m_pObj.get(); } |
51 T* operator->() const { return m_pObj.get(); } | 51 T* operator->() const { return m_pObj.get(); } |
52 | 52 |
53 private: | 53 private: |
54 std::unique_ptr<T, ReleaseDeleter<T>> m_pObj; | 54 std::unique_ptr<T, ReleaseDeleter<T>> m_pObj; |
55 }; | 55 }; |
56 | 56 |
57 #endif // CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ | 57 #endif // CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_ |
OLD | NEW |