Foxit PDF Conversion SDK
fs_basictypes.h
Go to the documentation of this file.
1 
16 #ifndef FS_BASIC_TYPES_H_
17 #define FS_BASIC_TYPES_H_
18 
19 #include <cstddef>
20 #include <string>
21 #include <memory>
22 #include <vector>
23 #include <exception>
24 #include <cmath>
25 #include <cfloat>
26 #include <stdlib.h>
27 #include <string.h>
28 #include "fxcrt/fx_basic.h"
29 
30 #if defined(_WIN32) || defined(_WIN64)
31 #include <Windows.h>
32 #endif // defined(_WIN32) || defined(_WIN64)
33 
34 #define FSDK_DEFINE_ARRAY(ArrayName, Type) \
35 class ArrayName : public CFX_Object { \
36  public: \
37 \
38  ArrayName(); \
39 \
40  ~ArrayName(); \
41 \
45  ArrayName(const ArrayName& other); \
46 \
51  ArrayName& operator = (const ArrayName& other); \
52 \
56  size_t GetSize() const; \
57 \
62  Type GetAt(size_t index) const; \
63 \
68  Type& operator[](size_t index) const; \
69 \
74  void Add(const Type& element); \
75 \
81  void RemoveAt(size_t index); \
82 \
89  void InsertAt(size_t index, const Type& element); \
90 \
94  void RemoveAll(); \
95  \
96  private: \
97  void* data_; \
98 };
99 
100 namespace std {
101 class exception;
102 }
103 
104 #ifndef TRUE
105 
106 #define TRUE true
107 #endif
108 
109 #ifndef FALSE
110 
111 #define FALSE false
112 #endif
113 
114 #ifndef NULL
115 
116 #define NULL ((void*)0)
117 #endif
118 
124 namespace foxit {
126 typedef FX_INT64 int64;
128 typedef FX_UINT64 uint64;
130 typedef FX_INT32 int32;
134 typedef FX_INT16 int16;
138 typedef FX_INT8 int8;
140 typedef FX_UINT8 uint8;
142 typedef void* FS_HANDLE;
143 
145 typedef CFX_Object Object;
150 
152 FSDK_DEFINE_ARRAY(WStringArray, WString)
153 
154 namespace file {
167 }
168 
174 typedef enum _ErrorCode {
234 } ErrorCode;
235 
236 
238 class Base : public Object {
239  public:
245  FS_HANDLE Handle() const {
246  return handle_;
247  }
248  virtual ~Base(){}
249 
250  protected:
251  explicit Base(FS_HANDLE handle = NULL) : handle_(handle) {}
252  FS_HANDLE handle_;
253 };
254 
256 class Exception : public std::exception , public Object {
257  public:
268  Exception(const char* file_name, int line_number, const char* function_name, ErrorCode error_code);
269 
275  Exception(const Exception& exception)
276  : error_code_(exception.error_code_)
277  , error_message_(exception.error_message_)
278  , name_(exception.name_) {}
279 
287  Exception& operator = (const Exception& exception) {
288  error_code_ = exception.error_code_;
289  error_message_ = exception.error_message_;
290  return *this;
291  }
292 
294  ~Exception() throw() {}
295 
302  return error_code_;
303  }
304 
311  String GetMessage() const {
312  return error_message_;
313  }
314 
320  String GetName() const
321  { return name_; }
322 
323  private:
324  ErrorCode error_code_;
325  String error_message_;
326  String name_;
327 };
328 
329 #define throw(Exception)
330 
331 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
332 #define FS_FINAL final
333 #else
334 #define FS_FINAL
335 #endif
336 
337 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
338 #define FS_OVERRIDE override
339 #else
340 #define FS_OVERRIDE
341 #endif
342 
343 } // namespace foxit
344 #endif
ErrorCode GetErrCode() const
Get the error code.
Definition: fs_basictypes.h:301
String GetMessage() const
Get the error message string.
Definition: fs_basictypes.h:311
Invalid password. Usually, this error may occur when loading a PDF document with password....
Definition: fs_basictypes.h:185
Format is invalid. For files, this may also mean that file is corrupted.
Definition: fs_basictypes.h:180
CFX_Object Object
Object type.
Definition: fs_basictypes.h:145
FX_DWORD FX_UINT32
unsigned 32bits integer.
Definition: fx_system.h:768
No "Office2PDF" module right.
Definition: fs_basictypes.h:223
FX_UINT8 uint8
8-bit unsigned integer.
Definition: fs_basictypes.h:140
Definition: fs_basictypes.h:152
No "PDF2Office" module right.
Definition: fs_basictypes.h:221
No "MD2PDF" module right.
Definition: fs_basictypes.h:229
File cannot be found or could not be opened.
Definition: fs_basictypes.h:178
Not match font .
Definition: fs_basictypes.h:227
File reading interface.
Definition: fx_stream.h:566
Error handle.
Definition: fs_basictypes.h:187
PDF document is encrypted by some unsupported security handler.
Definition: fs_basictypes.h:204
Exception & operator=(const Exception &exception)
Assign operator.
Definition: fs_basictypes.h:287
WIDE STRING CLASS.
Definition: fx_string.h:1452
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:147
FX_UINT64 uint64
Unsigned 64-bit integer.
Definition: fs_basictypes.h:128
Definition: fs_basictypes.h:256
Parameter error: value of any input parameter for a function is invalid.
Definition: fs_basictypes.h:198
Current object has not been loaded yet.
Definition: fs_basictypes.h:219
Invalid license is used to initialize Foxit PDF Conversion SDK library.
Definition: fs_basictypes.h:196
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:687
FS_HANDLE Handle() const
Get the handle of current object.
Definition: fs_basictypes.h:245
The type of input object or current object is invalid.
Definition: fs_basictypes.h:210
Data is not ready. Usually this is used as an exception error code when loading document in asynchron...
Definition: fs_basictypes.h:217
Content has not been parsed yet. Usually, this represents PDF page has not been parsed yet.
Definition: fs_basictypes.h:206
Certificate error: PDF document is encrypted by digital certificate but current user does not have th...
Definition: fs_basictypes.h:192
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:174
signed char FX_INT8
Signed 8bits integer.
Definition: fx_system.h:665
File stream interface, reading & writing.
Definition: fx_stream.h:669
Any unknown state occurs.
Definition: fs_basictypes.h:212
Exception(const char *file_name, int line_number, const char *function_name, ErrorCode error_code)
Constructor, with parameters.
FX_INT64 int64
Signed 64-bit integer.
Definition: fs_basictypes.h:126
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:132
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:142
CFX_ByteString String
Byte string.
Definition: fs_basictypes.h:149
FX_INT8 int8
8-bit signed integer.
Definition: fs_basictypes.h:138
unsigned short FX_UINT16
Unsigned 16bits integer.
Definition: fx_system.h:677
unsigned char FX_UINT8
Unsigned 8bits integer.
Definition: fx_system.h:667
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:130
Definition: fs_basictypes.h:238
String GetName() const
Get the string of error code.
Definition: fs_basictypes.h:320
Page contains only path/image objects and requires OCR before conversion.
Definition: fs_basictypes.h:231
FX_INT16 int16
16-bit signed integer.
Definition: fs_basictypes.h:134
Foxit namespace.
Definition: fs_basictypes.h:124
short FX_INT16
Signed 16bits integer.
Definition: fx_system.h:675
Exception(const Exception &exception)
Constructor, with another exception object.
Definition: fs_basictypes.h:275
BYTE STRING CLASS.
Definition: fx_string.h:317
No "PDF2MD" module right.
Definition: fs_basictypes.h:233
FX_UINT16 uint16
16-bit unsigned integer.
Definition: fs_basictypes.h:136
Header file for basic data class.
#define NULL
The null-pointer value.
Definition: fx_system.h:793
Success, and no error occurs.
Definition: fs_basictypes.h:176
Any unknown error occurs.
Definition: fs_basictypes.h:194
Expected data or object is not found.
Definition: fs_basictypes.h:208
No document permission to operate.
Definition: fs_basictypes.h:225
~Exception()
Destructor.
Definition: fs_basictypes.h:294
Out-of-memory error occurs.
Definition: fs_basictypes.h:202
Some types are not supported.
Definition: fs_basictypes.h:200