-
Notifications
You must be signed in to change notification settings - Fork 1
/
Interprocess.hh
52 lines (50 loc) · 1.61 KB
/
Interprocess.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef INTERPROCESS_HH
#define INTERPROCESS_HH
#define BOOST_DATE_TIME_NO_LIB
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
using namespace boost::interprocess;
enum ERROR_CODE {
PROCESSING_FILE = 0,
SUCCESS,
UNIMPLEMENTED,
NOT_EXIST_FILE,
NOT_FILE,
NOT_LOAD_FILE,
LOCKED_FILE,
FAIL_INIT_TESS,
CANCLED_BY_USER,
FAIL_OPEN_FILE,
NO_PAGE,
FAIL_PARSE_XML,
FAIL_FIND_SHARE_MEMORY,
CANT_NOT_GENERATE_IMAGE,
FAIL_CREATE_PAGE
};
struct ProgressInfo {
public:
ProgressInfo(int progress)
: m_progress(progress), m_errCode(ERROR_CODE::PROCESSING_FILE) {}
int m_progress;
ERROR_CODE m_errCode;
};
//Define an STL compatible allocator of ints that allocates from the managed_shared_memory.
//This allocator will allow placing containers in the segment
typedef allocator<char, managed_shared_memory::segment_manager> ShmemAllocator;
typedef basic_string<char, std::char_traits<char>, ShmemAllocator> MyString;
typedef std::pair<int, int> PageRange;
struct PdfPostProcess {
public:
PdfPostProcess() {}
PdfPostProcess(int fontScale, int fontSize, bool uniformziLineSpacing, int preserveSpaceWidth)
: m_fontScale(fontScale), m_fontSize(fontSize), m_uniformziLineSpacing(uniformziLineSpacing)
, m_preserveSpaceWidth(preserveSpaceWidth) {
}
int m_fontScale;/*0~100*/
int m_fontSize;
bool m_uniformziLineSpacing;
int m_preserveSpaceWidth;
};
#endif // INTERPROCESS_HH