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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 FX_BOOL m_bEOF; | 1058 FX_BOOL m_bEOF; |
1059 | 1059 |
1060 FX_DWORD m_SrcPos; | 1060 FX_DWORD m_SrcPos; |
1061 | 1061 |
1062 CFX_DataFilter* m_pDestFilter; | 1062 CFX_DataFilter* m_pDestFilter; |
1063 }; | 1063 }; |
1064 | 1064 |
1065 template <typename T> | 1065 template <typename T> |
1066 class CFX_AutoRestorer { | 1066 class CFX_AutoRestorer { |
1067 public: | 1067 public: |
1068 explicit CFX_AutoRestorer(T* location) { | 1068 explicit CFX_AutoRestorer(T* location) |
1069 m_Location = location; | 1069 : m_Location(location), m_OldValue(*location) {} |
1070 m_OldValue = *location; | |
1071 } | |
1072 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } | 1070 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } |
1073 | 1071 |
1074 private: | 1072 private: |
1075 T* m_Location; | 1073 T* const m_Location; |
1076 T m_OldValue; | 1074 const T m_OldValue; |
1077 }; | 1075 }; |
1078 | 1076 |
1079 struct FxFreeDeleter { | 1077 struct FxFreeDeleter { |
1080 inline void operator()(void* ptr) const { FX_Free(ptr); } | 1078 inline void operator()(void* ptr) const { FX_Free(ptr); } |
1081 }; | 1079 }; |
1082 | 1080 |
1083 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. | 1081 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. |
1084 template <class T> | 1082 template <class T> |
1085 struct ReleaseDeleter { | 1083 struct ReleaseDeleter { |
1086 inline void operator()(T* ptr) const { ptr->Release(); } | 1084 inline void operator()(T* ptr) const { ptr->Release(); } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 FX_FLOAT c; | 1285 FX_FLOAT c; |
1288 FX_FLOAT d; | 1286 FX_FLOAT d; |
1289 FX_FLOAT e; | 1287 FX_FLOAT e; |
1290 FX_FLOAT f; | 1288 FX_FLOAT f; |
1291 FX_FLOAT g; | 1289 FX_FLOAT g; |
1292 FX_FLOAT h; | 1290 FX_FLOAT h; |
1293 FX_FLOAT i; | 1291 FX_FLOAT i; |
1294 }; | 1292 }; |
1295 | 1293 |
1296 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1294 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |