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;
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 {
226 } ErrorCode;
227 
228 
230 class Base : public Object {
231  public:
237  FS_HANDLE Handle() const {
238  return handle_;
239  }
240  virtual ~Base(){}
241 
242  protected:
243  explicit Base(FS_HANDLE handle = NULL) : handle_(handle) {}
244  FS_HANDLE handle_;
245 };
246 
248 class Exception : public std::exception , public Object {
249  public:
260  Exception(const char* file_name, int line_number, const char* function_name, ErrorCode error_code);
261 
267  Exception(const Exception& exception)
268  : error_code_(exception.error_code_)
269  , error_message_(exception.error_message_)
270  , name_(exception.name_) {}
271 
279  Exception& operator = (const Exception& exception) {
280  error_code_ = exception.error_code_;
281  error_message_ = exception.error_message_;
282  return *this;
283  }
284 
286  ~Exception() throw() {}
287 
294  return error_code_;
295  }
296 
303  String GetMessage() const {
304  return error_message_;
305  }
306 
312  String GetName() const
313  { return name_; }
314 
315  private:
316  ErrorCode error_code_;
317  String error_message_;
318  String name_;
319 };
320 
321 #define throw(Exception)
322 
323 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
324 #define FS_FINAL final
325 #else
326 #define FS_FINAL
327 #endif
328 
329 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
330 #define FS_OVERRIDE override
331 #else
332 #define FS_OVERRIDE
333 #endif
334 
335 } // namespace foxit
336 #endif
ErrorCode GetErrCode() const
Get the error code.
Definition: fs_basictypes.h:293
String GetMessage() const
Get the error message string.
Definition: fs_basictypes.h:303
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:755
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
File cannot be found or could not be opened.
Definition: fs_basictypes.h:178
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:279
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:248
Parameter error: value of any input parameter for a function is invalid.
Definition: fs_basictypes.h:198
__int64 FX_INT64
Signed 64-bit integer.
Definition: fx_system.h:729
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:674
FS_HANDLE Handle() const
Get the handle of current object.
Definition: fs_basictypes.h:237
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:652
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:664
unsigned char FX_UINT8
Unsigned 8bits integer.
Definition: fx_system.h:654
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:130
Definition: fs_basictypes.h:230
String GetName() const
Get the string of error code.
Definition: fs_basictypes.h:312
FX_INT16 int16
16-bit signed integer.
Definition: fs_basictypes.h:134
Foxit namespace.
Definition: fs_basictypes.h:124
unsigned __int64 FX_UINT64
Unsigned 64-bit integer.
Definition: fx_system.h:731
short FX_INT16
Signed 16bits integer.
Definition: fx_system.h:662
Exception(const Exception &exception)
Constructor, with another exception object.
Definition: fs_basictypes.h:267
BYTE STRING CLASS.
Definition: fx_string.h:317
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:780
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:286
Out-of-memory error occurs.
Definition: fs_basictypes.h:202
Some types are not supported.
Definition: fs_basictypes.h:200