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;
132 typedef FX_UINT32 uint32;
134 typedef FX_INT16 int16;
136 typedef FX_UINT16 uint16;
138 typedef FX_INT8 int8;
140 typedef FX_UINT8 uint8;
142 typedef void* FS_HANDLE;
143
145 typedef CFX_Object Object;
147 typedef CFX_WideString WString;
149 typedef CFX_ByteString String;
150
152 FSDK_DEFINE_ARRAY(WStringArray, WString)
153
154 namespace file {
160 typedef IFX_FileRead ReaderCallback;
166 typedef IFX_FileStream StreamCallback;
167 }
168
174 typedef enum _ErrorCode {
176 e_ErrSuccess = 0,
178 e_ErrFile = 1,
180 e_ErrFormat = 2,
185 e_ErrPassword = 3,
187 e_ErrHandle = 4,
192 e_ErrCertificate = 5,
194 e_ErrUnknown = 6,
196 e_ErrInvalidLicense = 7,
198 e_ErrParam = 8,
200 e_ErrUnsupported = 9,
202 e_ErrOutOfMemory = 10,
204 e_ErrSecurityHandler = 11,
206 e_ErrNotParsed = 12,
208 e_ErrNotFound = 13,
210 e_ErrInvalidType = 14,
212 e_ErrUnknownState = 16,
217 e_ErrDataNotReady = 17,
219 e_ErrNotLoaded = 20,
221 e_ErrNoPDF2OfficeModuleRight = 77,
223 e_ErrNoOffice2PDFModuleRight = 78,
225 e_ErrNoDocumentPermission = 80,
227 e_ErrNotMatchFont = 82
228 } ErrorCode;
229
230
232 class Base : public Object {
233 public:
239 FS_HANDLE Handle() const {
240 return handle_;
241 }
242 virtual ~Base(){}
243
244 protected:
245 explicit Base(FS_HANDLE handle = NULL) : handle_(handle) {}
246 FS_HANDLE handle_;
247 };
248
250 class Exception : public std::exception , public Object {
251 public:
262 Exception(const char* file_name, int line_number, const char* function_name, ErrorCode error_code);
263
269 Exception(const Exception& exception)
270 : error_code_(exception.error_code_)
271 , error_message_(exception.error_message_)
272 , name_(exception.name_) {}
273
281 Exception& operator = (const Exception& exception) {
282 error_code_ = exception.error_code_;
283 error_message_ = exception.error_message_;
284 return *this;
285 }
286
288 ~Exception() throw() {}
289
295 ErrorCode GetErrCode() const {
296 return error_code_;
297 }
298
305 String GetMessage() const {
306 return error_message_;
307 }
308
314 String GetName() const
315 { return name_; }
316
317 private:
318 ErrorCode error_code_;
319 String error_message_;
320 String name_;
321 };
322
323 #define throw(Exception)
324
325 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
326 #define FS_FINAL final
327 #else
328 #define FS_FINAL
329 #endif
330
331 #if __cpluscplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
332 #define FS_OVERRIDE override
333 #else
334 #define FS_OVERRIDE
335 #endif
336
337 } // namespace foxit
338 #endif
foxit::Exception::GetErrCode
ErrorCode GetErrCode() const
Get the error code.
Definition: fs_basictypes.h:295
foxit::Exception::GetMessage
String GetMessage() const
Get the error message string.
Definition: fs_basictypes.h:305
foxit::e_ErrPassword
Invalid password. Usually, this error may occur when loading a PDF document with password....
Definition: fs_basictypes.h:185
foxit::e_ErrFormat
Format is invalid. For files, this may also mean that file is corrupted.
Definition: fs_basictypes.h:180
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:145
FX_UINT32
FX_DWORD FX_UINT32
unsigned 32bits integer.
Definition: fx_system.h:760
foxit::e_ErrNoOffice2PDFModuleRight
No "Office2PDF" module right.
Definition: fs_basictypes.h:223
foxit::uint8
FX_UINT8 uint8
8-bit unsigned integer.
Definition: fs_basictypes.h:140
foxit::WStringArray
Definition: fs_basictypes.h:152
foxit::e_ErrNoPDF2OfficeModuleRight
No "PDF2Office" module right.
Definition: fs_basictypes.h:221
foxit::e_ErrFile
File cannot be found or could not be opened.
Definition: fs_basictypes.h:178
foxit::e_ErrNotMatchFont
Not match font .
Definition: fs_basictypes.h:227
IFX_FileRead
File reading interface.
Definition: fx_stream.h:566
foxit::e_ErrHandle
Error handle.
Definition: fs_basictypes.h:187
foxit::e_ErrSecurityHandler
PDF document is encrypted by some unsupported security handler.
Definition: fs_basictypes.h:204
foxit::Exception::operator=
Exception & operator=(const Exception &exception)
Assign operator.
Definition: fs_basictypes.h:281
CFX_WideString
WIDE STRING CLASS.
Definition: fx_string.h:1452
foxit::WString
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:147
foxit::uint64
FX_UINT64 uint64
Unsigned 64-bit integer.
Definition: fs_basictypes.h:128
foxit::Exception
Definition: fs_basictypes.h:250
foxit::e_ErrParam
Parameter error: value of any input parameter for a function is invalid.
Definition: fs_basictypes.h:198
FX_INT64
__int64 FX_INT64
Signed 64-bit integer.
Definition: fx_system.h:734
foxit::e_ErrNotLoaded
Current object has not been loaded yet.
Definition: fs_basictypes.h:219
foxit::e_ErrInvalidLicense
Invalid license is used to initialize Foxit PDF Conversion SDK library.
Definition: fs_basictypes.h:196
FX_INT32
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:679
foxit::Base::Handle
FS_HANDLE Handle() const
Get the handle of current object.
Definition: fs_basictypes.h:239
foxit::e_ErrInvalidType
The type of input object or current object is invalid.
Definition: fs_basictypes.h:210
foxit::e_ErrDataNotReady
Data is not ready. Usually this is used as an exception error code when loading document in asynchron...
Definition: fs_basictypes.h:217
foxit::e_ErrNotParsed
Content has not been parsed yet. Usually, this represents PDF page has not been parsed yet.
Definition: fs_basictypes.h:206
foxit::e_ErrCertificate
Certificate error: PDF document is encrypted by digital certificate but current user does not have th...
Definition: fs_basictypes.h:192
foxit::ErrorCode
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:174
FX_INT8
signed char FX_INT8
Signed 8bits integer.
Definition: fx_system.h:657
IFX_FileStream
File stream interface, reading & writing.
Definition: fx_stream.h:669
foxit::e_ErrUnknownState
Any unknown state occurs.
Definition: fs_basictypes.h:212
foxit::Exception::Exception
Exception(const char *file_name, int line_number, const char *function_name, ErrorCode error_code)
Constructor, with parameters.
foxit::int64
FX_INT64 int64
Signed 64-bit integer.
Definition: fs_basictypes.h:126
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:132
foxit::FS_HANDLE
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:142
foxit::String
CFX_ByteString String
Byte string.
Definition: fs_basictypes.h:149
foxit::int8
FX_INT8 int8
8-bit signed integer.
Definition: fs_basictypes.h:138
FX_UINT16
unsigned short FX_UINT16
Unsigned 16bits integer.
Definition: fx_system.h:669
FX_UINT8
unsigned char FX_UINT8
Unsigned 8bits integer.
Definition: fx_system.h:659
foxit::int32
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:130
foxit::Base
Definition: fs_basictypes.h:232
foxit::Exception::GetName
String GetName() const
Get the string of error code.
Definition: fs_basictypes.h:314
foxit::int16
FX_INT16 int16
16-bit signed integer.
Definition: fs_basictypes.h:134
foxit
Foxit namespace.
Definition: fs_basictypes.h:124
FX_UINT64
unsigned __int64 FX_UINT64
Unsigned 64-bit integer.
Definition: fx_system.h:736
FX_INT16
short FX_INT16
Signed 16bits integer.
Definition: fx_system.h:667
foxit::Exception::Exception
Exception(const Exception &exception)
Constructor, with another exception object.
Definition: fs_basictypes.h:269
CFX_ByteString
BYTE STRING CLASS.
Definition: fx_string.h:317
foxit::uint16
FX_UINT16 uint16
16-bit unsigned integer.
Definition: fs_basictypes.h:136
fx_basic.h
Header file for basic data class.
NULL
#define NULL
The null-pointer value.
Definition: fx_system.h:785
foxit::e_ErrSuccess
Success, and no error occurs.
Definition: fs_basictypes.h:176
foxit::e_ErrUnknown
Any unknown error occurs.
Definition: fs_basictypes.h:194
foxit::e_ErrNotFound
Expected data or object is not found.
Definition: fs_basictypes.h:208
foxit::e_ErrNoDocumentPermission
No document permission to operate.
Definition: fs_basictypes.h:225
foxit::Exception::~Exception
~Exception()
Destructor.
Definition: fs_basictypes.h:288
foxit::e_ErrOutOfMemory
Out-of-memory error occurs.
Definition: fs_basictypes.h:202
foxit::e_ErrUnsupported
Some types are not supported.
Definition: fs_basictypes.h:200