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" |
11 #include "fx_stream.h" | 11 #include "fx_stream.h" |
12 #include "fx_string.h" | 12 #include "fx_string.h" |
13 #include "fx_system.h" | 13 #include "fx_system.h" |
14 | 14 |
15 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. | 15 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. |
16 // The expression is a compile-time constant, and therefore can be | 16 // The expression is a compile-time constant, and therefore can be |
17 // used in defining new arrays, for example. If you use FX_ArraySize on | 17 // used in defining new arrays, for example. If you use FX_ArraySize on |
18 // a pointer by mistake, you will get a compile-time error. | 18 // a pointer by mistake, you will get a compile-time error. |
19 // | 19 // |
20 // One caveat is that FX_ArraySize() doesn't accept any array of an | 20 // One caveat is that FX_ArraySize() doesn't accept any array of an |
21 // anonymous type or a type defined inside a function. | 21 // anonymous type or a type defined inside a function. |
22 #define FX_ArraySize(array) (sizeof(ArraySizeHelper(array))) | 22 #define FX_ArraySize(array) (sizeof(ArraySizeHelper(array))) |
23 | 23 |
24 // This template function declaration is used in defining FX_ArraySize. | 24 // This template function declaration is used in defining FX_ArraySize. |
25 // Note that the function doesn't need an implementation, as we only | 25 // Note that the function doesn't need an implementation, as we only |
26 // use its type. | 26 // use its type. |
27 template <typename T, size_t N> | 27 template <typename T, size_t N> |
28 char(&ArraySizeHelper(T(&array)[N]))[N]; | 28 char(&ArraySizeHelper(T(&array)[N]))[N]; |
29 | 29 |
30 // Check whether a wide char is digital 0-9. | |
31 #define FX_ISWDIGIT(x) ((x) >= L'0' && (x) <= L'9') | |
32 // Check whether a wide char is an alphanumeric character A-Z or a-z. | |
33 #define FX_ISWALPHA(x) \ | |
Lei Zhang
2015/12/18 00:20:56
We already have FXSYS_islower() and friends in cor
Wei Li
2015/12/18 01:12:21
Done.
| |
34 (((x) >= L'A' && (x) <= L'Z') || ((x) >= L'a' && (x) <= L'z')) | |
35 | |
30 class CFX_BinaryBuf { | 36 class CFX_BinaryBuf { |
31 public: | 37 public: |
32 CFX_BinaryBuf(); | 38 CFX_BinaryBuf(); |
33 CFX_BinaryBuf(FX_STRSIZE size); | 39 CFX_BinaryBuf(FX_STRSIZE size); |
34 | 40 |
35 ~CFX_BinaryBuf(); | 41 ~CFX_BinaryBuf(); |
36 | 42 |
37 void Clear(); | 43 void Clear(); |
38 | 44 |
39 void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0); | 45 void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0); |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1141 FX_FLOAT c; | 1147 FX_FLOAT c; |
1142 FX_FLOAT d; | 1148 FX_FLOAT d; |
1143 FX_FLOAT e; | 1149 FX_FLOAT e; |
1144 FX_FLOAT f; | 1150 FX_FLOAT f; |
1145 FX_FLOAT g; | 1151 FX_FLOAT g; |
1146 FX_FLOAT h; | 1152 FX_FLOAT h; |
1147 FX_FLOAT i; | 1153 FX_FLOAT i; |
1148 }; | 1154 }; |
1149 | 1155 |
1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1156 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |