Definition at line 20 of file icu_util.cc.
◆ ICUContext() [1/2]
fml::icu::ICUContext::ICUContext |
( |
const std::string & |
icu_data_path | ) |
|
|
inlineexplicit |
Definition at line 22 of file icu_util.cc.
22 : valid_(false) {
24 }
bool SetupMapping(const std::string &icu_data_path)
◆ ICUContext() [2/2]
fml::icu::ICUContext::ICUContext |
( |
std::unique_ptr< Mapping > |
mapping | ) |
|
|
inlineexplicit |
Definition at line 26 of file icu_util.cc.
27 : mapping_(std::move(mapping)) {
29 }
◆ ~ICUContext()
fml::icu::ICUContext::~ICUContext |
( |
| ) |
|
|
default |
◆ GetMapping()
const uint8_t * fml::icu::ICUContext::GetMapping |
( |
| ) |
const |
|
inline |
Definition at line 80 of file icu_util.cc.
80 {
81 return mapping_ ? mapping_->GetMapping() : nullptr;
82 }
◆ GetSize()
size_t fml::icu::ICUContext::GetSize |
( |
| ) |
const |
|
inline |
Definition at line 84 of file icu_util.cc.
84{ return mapping_ ? mapping_->GetSize() : 0; }
◆ IsValid()
bool fml::icu::ICUContext::IsValid |
( |
| ) |
const |
|
inline |
◆ SetupICU()
bool fml::icu::ICUContext::SetupICU |
( |
| ) |
|
|
inline |
Definition at line 70 of file icu_util.cc.
70 {
72 return false;
73 }
74
75 UErrorCode err_code = U_ZERO_ERROR;
77 return (err_code == U_ZERO_ERROR);
78 }
const uint8_t * GetMapping() const
◆ SetupMapping()
bool fml::icu::ICUContext::SetupMapping |
( |
const std::string & |
icu_data_path | ) |
|
|
inline |
Definition at line 33 of file icu_util.cc.
33 {
34
35 auto fd =
37
38
39 if (!fd.is_valid()) {
41
42 if (!directory.first) {
43 return false;
44 }
45
46 std::string path_relative_to_executable =
48
49 fd =
fml::OpenFile(path_relative_to_executable.c_str(),
false,
51 }
52
53 if (!fd.is_valid()) {
54 return false;
55 }
56
57 std::initializer_list<FileMapping::Protection> protection = {
59
60 auto file_mapping = std::make_unique<FileMapping>(fd, protection);
61
62 if (file_mapping->GetSize() != 0) {
63 mapping_ = std::move(file_mapping);
64 return true;
65 }
66
67 return false;
68 }
std::string JoinPaths(std::initializer_list< std::string > components)
std::pair< bool, std::string > GetExecutableDirectoryPath()
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
The documentation for this class was generated from the following file: