mirror of https://github.com/kiwix/libkiwix.git
+ change call of function appendToFirstOccurence() and replaceRegex()
This commit is contained in:
parent
084af011dd
commit
28138e7ff9
|
@ -63,10 +63,10 @@ namespace kiwix {
|
|||
std::string id = path;
|
||||
if (!id.empty()) {
|
||||
removeAccents(id);
|
||||
replaceRegex(id, "", "^.*/");
|
||||
replaceRegex(id, "", "\\.zim[a-z]*$");
|
||||
replaceRegex(id, "_", " ");
|
||||
replaceRegex(id, "plus", "\\+");
|
||||
id = replaceRegex(id, "", "^.*/");
|
||||
id = replaceRegex(id, "", "\\.zim[a-z]*$");
|
||||
id = replaceRegex(id, "_", " ");
|
||||
id = replaceRegex(id, "plus", "\\+");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ bool matchRegex(const std::string &content, const std::string ®ex) {
|
|||
return matcher->find();
|
||||
}
|
||||
|
||||
void replaceRegex(std::string &content, const std::string &replacement, const std::string ®ex) {
|
||||
std::string replaceRegex(const std::string &content, const std::string &replacement, const std::string ®ex) {
|
||||
ucnv_setDefaultName("UTF-8");
|
||||
UnicodeString ucontent = UnicodeString(content.c_str());
|
||||
UnicodeString ureplacement = UnicodeString(replacement.c_str());
|
||||
|
@ -63,10 +63,10 @@ void replaceRegex(std::string &content, const std::string &replacement, const st
|
|||
UnicodeString uresult = matcher->replaceAll(ureplacement, status);
|
||||
std::string tmp;
|
||||
uresult.toUTF8String(tmp);
|
||||
content=tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void appendToFirstOccurence(std::string &content, const std::string regex, const std::string &replacement) {
|
||||
std::string appendToFirstOccurence(const std::string &content, const std::string regex, const std::string &replacement) {
|
||||
ucnv_setDefaultName("UTF-8");
|
||||
UnicodeString ucontent = UnicodeString(content.c_str());
|
||||
UnicodeString ureplacement = UnicodeString(replacement.c_str());
|
||||
|
@ -78,7 +78,9 @@ void appendToFirstOccurence(std::string &content, const std::string regex, cons
|
|||
ucontent.insert(matcher->end(status), ureplacement);
|
||||
std::string tmp;
|
||||
ucontent.toUTF8String(tmp);
|
||||
content=tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <map>
|
||||
|
||||
bool matchRegex(const std::string &content, const std::string ®ex);
|
||||
void replaceRegex(std::string &content, const std::string &replacement, const std::string ®ex);
|
||||
void appendToFirstOccurence(std::string &content, const std::string regex, const std::string &replacement);
|
||||
std::string replaceRegex(const std::string &content, const std::string &replacement, const std::string ®ex);
|
||||
std::string appendToFirstOccurence(const std::string &content, const std::string regex, const std::string &replacement);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue