MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / SplitSearchPath

Function SplitSearchPath

plugins/jieba/src/JiebaSegmentationPlugin.cpp:121–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121std::vector<std::string> SplitSearchPath(const char* raw) {
122 std::vector<std::string> entries;
123 if (raw == nullptr || *raw == '\0') {
124 return entries;
125 }
126 const char separator =
127#if defined(_WIN32) || defined(_WIN64)
128 ';';
129#else
130 ':';
131#endif
132 std::string path(raw);
133 std::string::size_type start = 0;
134 while (start <= path.size()) {
135 const std::string::size_type end = path.find(separator, start);
136 const std::string entry = path.substr(start, end - start);
137 if (!entry.empty()) {
138 entries.push_back(entry);
139 }
140 if (end == std::string::npos) {
141 break;
142 }
143 start = end + 1;
144 }
145 return entries;
146}
147
148void SetError(opencc_error_t* error,
149 int code,

Callers 1

ResolveResourcePathFunction · 0.70

Calls 5

findMethod · 0.80
sizeMethod · 0.45
substrMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected