-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
97 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#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() { | ||
static GlobalParams instance; | ||
return instance; | ||
} | ||
|
||
const std::string &GlobalParams::odr_core_data_path() { | ||
return instance().m_odr_core_data_path; | ||
} | ||
|
||
const std::string &GlobalParams::fontforge_data_path() { | ||
return instance().m_fontforge_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_fontforge_data_path(const std::string &path) { | ||
instance().m_fontforge_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() { | ||
set_odr_core_data_path(""); // TODO | ||
set_fontforge_data_path(internal::project_info::fontconfig_data_path()); | ||
set_poppler_data_path(internal::project_info::poppler_data_path()); | ||
set_pdf2htmlex_data_path(internal::project_info::pdf2htmlex_data_path()); | ||
} | ||
|
||
} // namespace odr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace odr { | ||
|
||
class GlobalParams { | ||
public: | ||
static const std::string &odr_core_data_path(); | ||
static const std::string &fontforge_data_path(); | ||
static const std::string &poppler_data_path(); | ||
static const std::string &pdf2htmlex_data_path(); | ||
|
||
static void set_odr_core_data_path(const std::string &path); | ||
static void set_fontforge_data_path(const std::string &path); | ||
static void set_poppler_data_path(const std::string &path); | ||
static void set_pdf2htmlex_data_path(const std::string &path); | ||
|
||
private: | ||
static GlobalParams &instance(); | ||
|
||
GlobalParams(); | ||
|
||
std::string m_odr_core_data_path; | ||
std::string m_fontforge_data_path; | ||
std::string m_poppler_data_path; | ||
std::string m_pdf2htmlex_data_path; | ||
}; | ||
|
||
} // namespace odr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters