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 namespace std {
35 class exception;
36 }
37 
38 #ifndef TRUE
39 
40 #define TRUE true
41 #endif
42 
43 #ifndef FALSE
44 
45 #define FALSE false
46 #endif
47 
48 #ifndef NULL
49 
50 #define NULL ((void*)0)
51 #endif
52 
58 namespace foxit {
60 typedef FX_INT64 int64;
62 typedef FX_UINT64 uint64;
64 typedef FX_INT32 int32;
66 typedef FX_UINT32 uint32;
68 typedef FX_INT16 int16;
70 typedef FX_UINT16 uint16;
72 typedef FX_INT8 int8;
74 typedef FX_UINT8 uint8;
76 typedef void* FS_HANDLE;
77 
79 typedef CFX_Object Object;
84 
85 namespace file {
98 }
99 
105 typedef enum _ErrorCode {
157 } ErrorCode;
158 
159 
161 class Base : public Object {
162  public:
168  FS_HANDLE Handle() const {
169  return handle_;
170  }
171  virtual ~Base(){}
172 
173  protected:
174  explicit Base(FS_HANDLE handle = NULL) : handle_(handle) {}
175  FS_HANDLE handle_;
176 };
177 
179 class Exception : public std::exception , public Object {
180  public:
191  Exception(const char* file_name, int line_number, const char* function_name, ErrorCode error_code);
192 
198  Exception(const Exception& exception)
199  : error_code_(exception.error_code_)
200  , error_message_(exception.error_message_)
201  , name_(exception.name_) {}
202 
210  Exception& operator = (const Exception& exception) {
211  error_code_ = exception.error_code_;
212  error_message_ = exception.error_message_;
213  return *this;
214  }
215 
217  ~Exception() throw() {}
218 
225  return error_code_;
226  }
227 
234  String GetMessage() const {
235  return error_message_;
236  }
237 
243  String GetName() const
244  { return name_; }
245 
246  private:
247  ErrorCode error_code_;
248  String error_message_;
249  String name_;
250 };
251 
252 #define throw(Exception)
253 
254 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
255 #define FS_FINAL final
256 #else
257 #define FS_FINAL
258 #endif
259 
260 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
261 #define FS_OVERRIDE override
262 #else
263 #define FS_OVERRIDE
264 #endif
265 
266 } // namespace foxit
267 #endif
ErrorCode GetErrCode() const
Get the error code.
Definition: fs_basictypes.h:224
String GetMessage() const
Get the error message string.
Definition: fs_basictypes.h:234
Invalid password. Usually, this error may occur when loading a PDF document with password....
Definition: fs_basictypes.h:116
Format is invalid. For files, this may also mean that file is corrupted.
Definition: fs_basictypes.h:111
CFX_Object Object
Object type.
Definition: fs_basictypes.h:79
FX_DWORD FX_UINT32
unsigned 32bits integer.
Definition: fx_system.h:755
No "Office2PDF" module right.
Definition: fs_basictypes.h:154
FX_UINT8 uint8
8-bit unsigned integer.
Definition: fs_basictypes.h:74
No "PDF2Office" module right.
Definition: fs_basictypes.h:152
File cannot be found or could not be opened.
Definition: fs_basictypes.h:109
File reading interface.
Definition: fx_stream.h:566
Error handle.
Definition: fs_basictypes.h:118
PDF document is encrypted by some unsupported security handler.
Definition: fs_basictypes.h:135
Exception & operator=(const Exception &exception)
Assign operator.
Definition: fs_basictypes.h:210
WIDE STRING CLASS.
Definition: fx_string.h:1452
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:81
FX_UINT64 uint64
Unsigned 64-bit integer.
Definition: fs_basictypes.h:62
Definition: fs_basictypes.h:179
Parameter error: value of any input parameter for a function is invalid.
Definition: fs_basictypes.h:129
Current object has not been loaded yet.
Definition: fs_basictypes.h:150
Invalid license is used to initialize Foxit PDF Conversion SDK library.
Definition: fs_basictypes.h:127
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:168
The type of input object or current object is invalid.
Definition: fs_basictypes.h:141
Data is not ready. Usually this is used as an exception error code when loading document in asynchron...
Definition: fs_basictypes.h:148
Content has not been parsed yet. Usually, this represents PDF page has not been parsed yet.
Definition: fs_basictypes.h:137
Certificate error: PDF document is encrypted by digital certificate but current user does not have th...
Definition: fs_basictypes.h:123
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:105
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:143
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:60
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:66
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:76
CFX_ByteString String
Byte string.
Definition: fs_basictypes.h:83
FX_INT8 int8
8-bit signed integer.
Definition: fs_basictypes.h:72
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:64
Definition: fs_basictypes.h:161
String GetName() const
Get the string of error code.
Definition: fs_basictypes.h:243
FX_INT16 int16
16-bit signed integer.
Definition: fs_basictypes.h:68
Foxit namespace.
Definition: fs_basictypes.h:58
short FX_INT16
Signed 16bits integer.
Definition: fx_system.h:662
Exception(const Exception &exception)
Constructor, with another exception object.
Definition: fs_basictypes.h:198
BYTE STRING CLASS.
Definition: fx_string.h:317
FX_UINT16 uint16
16-bit unsigned integer.
Definition: fs_basictypes.h:70
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:107
Any unknown error occurs.
Definition: fs_basictypes.h:125
Expected data or object is not found.
Definition: fs_basictypes.h:139
No document permission to operate.
Definition: fs_basictypes.h:156
~Exception()
Destructor.
Definition: fs_basictypes.h:217
Out-of-memory error occurs.
Definition: fs_basictypes.h:133
Some types are not supported.
Definition: fs_basictypes.h:131