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 // 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_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ | 7 #ifndef CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ |
8 #define CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ | 8 #define CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_memory.h" | 10 #include "core/fxcrt/fx_memory.h" |
11 #include "core/fxcrt/include/fx_system.h" | 11 #include "core/fxcrt/fx_system.h" |
12 #include "third_party/base/numerics/safe_math.h" | 12 #include "third_party/base/numerics/safe_math.h" |
13 | 13 |
14 template <typename CharType> | 14 template <typename CharType> |
15 class CFX_StringDataTemplate { | 15 class CFX_StringDataTemplate { |
16 public: | 16 public: |
17 static CFX_StringDataTemplate* Create(FX_STRSIZE nLen) { | 17 static CFX_StringDataTemplate* Create(FX_STRSIZE nLen) { |
18 ASSERT(nLen > 0); | 18 ASSERT(nLen > 0); |
19 | 19 |
20 // Calculate space needed for the fixed portion of the struct plus the | 20 // Calculate space needed for the fixed portion of the struct plus the |
21 // NUL char that is not included in |m_nAllocLength|. | 21 // NUL char that is not included in |m_nAllocLength|. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 m_String[dataLen] = 0; | 106 m_String[dataLen] = 0; |
107 } | 107 } |
108 | 108 |
109 ~CFX_StringDataTemplate() = delete; | 109 ~CFX_StringDataTemplate() = delete; |
110 }; | 110 }; |
111 | 111 |
112 extern template class CFX_StringDataTemplate<FX_CHAR>; | 112 extern template class CFX_StringDataTemplate<FX_CHAR>; |
113 extern template class CFX_StringDataTemplate<FX_WCHAR>; | 113 extern template class CFX_StringDataTemplate<FX_WCHAR>; |
114 | 114 |
115 #endif // CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ | 115 #endif // CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ |
OLD | NEW |