-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathglobal_params.cpp
More file actions
71 lines (55 loc) · 1.89 KB
/
Copy pathglobal_params.cpp
File metadata and controls
71 lines (55 loc) · 1.89 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <odr/global_params.hpp>
#include <odr/internal/project_info.hpp>
#ifdef ODR_WITH_PDF2HTMLEX
#include <poppler/GlobalParams.h>
#endif
namespace odr {
GlobalParams &GlobalParams::instance() {
struct HolderAndInitializer {
GlobalParams params;
HolderAndInitializer() {
#ifdef ODR_WITH_PDF2HTMLEX
globalParams = std::make_unique<::GlobalParams>(
params.m_poppler_data_path.empty()
? nullptr
: params.m_poppler_data_path.c_str());
#endif
}
};
static HolderAndInitializer instance;
return instance.params;
}
const std::string &GlobalParams::odr_core_data_path() {
return instance().m_odr_core_data_path;
}
const std::string &GlobalParams::fontconfig_data_path() {
return instance().m_fontconfig_data_path;
}
const std::string &GlobalParams::poppler_data_path() {
return instance().m_poppler_data_path;
}
const std::string &GlobalParams::pdf2htmlex_data_path() {
return instance().m_pdf2htmlex_data_path;
}
void GlobalParams::set_odr_core_data_path(const std::string &path) {
instance().m_odr_core_data_path = path;
}
void GlobalParams::set_fontconfig_data_path(const std::string &path) {
instance().m_fontconfig_data_path = path;
}
void GlobalParams::set_poppler_data_path(const std::string &path) {
instance().m_poppler_data_path = path;
#ifdef ODR_WITH_PDF2HTMLEX
globalParams =
std::make_unique<::GlobalParams>(path.empty() ? nullptr : path.c_str());
#endif
}
void GlobalParams::set_pdf2htmlex_data_path(const std::string &path) {
instance().m_pdf2htmlex_data_path = path;
}
GlobalParams::GlobalParams()
: m_odr_core_data_path{internal::project_info::odr_data_path()},
m_fontconfig_data_path{internal::project_info::fontconfig_data_path()},
m_poppler_data_path{internal::project_info::poppler_data_path()},
m_pdf2htmlex_data_path{internal::project_info::pdf2htmlex_data_path()} {}
} // namespace odr