| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 9 | 9 |
| 10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 m_pObject->m_RefCount--; | 877 m_pObject->m_RefCount--; |
| 878 if (m_pObject->m_RefCount <= 0) { | 878 if (m_pObject->m_RefCount <= 0) { |
| 879 delete m_pObject; | 879 delete m_pObject; |
| 880 } | 880 } |
| 881 } | 881 } |
| 882 m_pObject = ref.m_pObject; | 882 m_pObject = ref.m_pObject; |
| 883 } | 883 } |
| 884 | 884 |
| 885 void operator=(void* p) { | 885 void operator=(void* p) { |
| 886 FXSYS_assert(p == 0); | 886 FXSYS_assert(p == 0); |
| 887 if (m_pObject == NULL) { | 887 if (!m_pObject) { |
| 888 return; | 888 return; |
| 889 } | 889 } |
| 890 m_pObject->m_RefCount--; | 890 m_pObject->m_RefCount--; |
| 891 if (m_pObject->m_RefCount <= 0) { | 891 if (m_pObject->m_RefCount <= 0) { |
| 892 delete m_pObject; | 892 delete m_pObject; |
| 893 } | 893 } |
| 894 m_pObject = NULL; | 894 m_pObject = NULL; |
| 895 } | 895 } |
| 896 | 896 |
| 897 const ObjClass* GetObject() const { return m_pObject; } | 897 const ObjClass* GetObject() const { return m_pObject; } |
| 898 | 898 |
| 899 operator const ObjClass*() const { return m_pObject; } | 899 operator const ObjClass*() const { return m_pObject; } |
| 900 | 900 |
| 901 FX_BOOL IsNull() const { return m_pObject == NULL; } | 901 FX_BOOL IsNull() const { return !m_pObject; } |
| 902 | 902 |
| 903 FX_BOOL NotNull() const { return m_pObject != NULL; } | 903 FX_BOOL NotNull() const { return !IsNull(); } |
| 904 | 904 |
| 905 ObjClass* GetModify() { | 905 ObjClass* GetModify() { |
| 906 if (m_pObject == NULL) { | 906 if (!m_pObject) { |
| 907 m_pObject = new CountedObj; | 907 m_pObject = new CountedObj; |
| 908 m_pObject->m_RefCount = 1; | 908 m_pObject->m_RefCount = 1; |
| 909 } else if (m_pObject->m_RefCount > 1) { | 909 } else if (m_pObject->m_RefCount > 1) { |
| 910 m_pObject->m_RefCount--; | 910 m_pObject->m_RefCount--; |
| 911 CountedObj* pOldObject = m_pObject; | 911 CountedObj* pOldObject = m_pObject; |
| 912 m_pObject = new CountedObj(*pOldObject); | 912 m_pObject = new CountedObj(*pOldObject); |
| 913 m_pObject->m_RefCount = 1; | 913 m_pObject->m_RefCount = 1; |
| 914 } | 914 } |
| 915 return m_pObject; | 915 return m_pObject; |
| 916 } | 916 } |
| 917 | 917 |
| 918 void SetNull() { | 918 void SetNull() { |
| 919 if (m_pObject == NULL) { | 919 if (!m_pObject) { |
| 920 return; | 920 return; |
| 921 } | 921 } |
| 922 m_pObject->m_RefCount--; | 922 m_pObject->m_RefCount--; |
| 923 if (m_pObject->m_RefCount <= 0) { | 923 if (m_pObject->m_RefCount <= 0) { |
| 924 delete m_pObject; | 924 delete m_pObject; |
| 925 } | 925 } |
| 926 m_pObject = NULL; | 926 m_pObject = NULL; |
| 927 } | 927 } |
| 928 | 928 |
| 929 FX_BOOL operator==(const Ref& ref) const { | 929 FX_BOOL operator==(const Ref& ref) const { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 FX_FLOAT c; | 1141 FX_FLOAT c; |
| 1142 FX_FLOAT d; | 1142 FX_FLOAT d; |
| 1143 FX_FLOAT e; | 1143 FX_FLOAT e; |
| 1144 FX_FLOAT f; | 1144 FX_FLOAT f; |
| 1145 FX_FLOAT g; | 1145 FX_FLOAT g; |
| 1146 FX_FLOAT h; | 1146 FX_FLOAT h; |
| 1147 FX_FLOAT i; | 1147 FX_FLOAT i; |
| 1148 }; | 1148 }; |
| 1149 | 1149 |
| 1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| OLD | NEW |