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 {
155 } ErrorCode;
156 
157 
159 class Base : public Object {
160  public:
166  FS_HANDLE Handle() const {
167  return handle_;
168  }
169  virtual ~Base(){}
170 
171  protected:
172  explicit Base(FS_HANDLE handle = NULL) : handle_(handle) {}
173  FS_HANDLE handle_;
174 };
175 
177 class Exception : public std::exception , public Object {
178  public:
189  Exception(const char* file_name, int line_number, const char* function_name, ErrorCode error_code);
190 
196  Exception(const Exception& exception)
197  : error_code_(exception.error_code_)
198  , error_message_(exception.error_message_)
199  , name_(exception.name_) {}
200 
208  Exception& operator = (const Exception& exception) {
209  error_code_ = exception.error_code_;
210  error_message_ = exception.error_message_;
211  return *this;
212  }
213 
215  ~Exception() throw() {}
216 
223  return error_code_;
224  }
225 
232  String GetMessage() const {
233  return error_message_;
234  }
235 
241  String GetName() const
242  { return name_; }
243 
244  private:
245  ErrorCode error_code_;
246  String error_message_;
247  String name_;
248 };
249 
250 #define throw(Exception)
251 
252 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
253 #define FS_FINAL final
254 #else
255 #define FS_FINAL
256 #endif
257 
258 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
259 #define FS_OVERRIDE override
260 #else
261 #define FS_OVERRIDE
262 #endif
263 
264 } // namespace foxit
265 #endif
ErrorCode GetErrCode() const
Get the error code.
Definition: fs_basictypes.h:222
String GetMessage() const
Get the error message string.
Definition: fs_basictypes.h:232
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
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:208
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:177
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:166
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:159
String GetName() const
Get the string of error code.
Definition: fs_basictypes.h:241
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:196
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:154
~Exception()
Destructor.
Definition: fs_basictypes.h:215
Out-of-memory error occurs.
Definition: fs_basictypes.h:133
Some types are not supported.
Definition: fs_basictypes.h:131