mirror of https://github.com/kiwix/libkiwix.git
NEW: Improve file size display in kiwix-serve
This commit is contained in:
parent
9b2e914dac
commit
a353513c9c
|
@ -50,6 +50,15 @@ std::string kiwix::beautifyInteger(const unsigned int number) {
|
|||
return numberString;
|
||||
}
|
||||
|
||||
std::string kiwix::beautifyFileSize(const unsigned int number) {
|
||||
if (number > 1024*1024) {
|
||||
return kiwix::beautifyInteger(number/(1024*1024)) + " GB";
|
||||
} else {
|
||||
return kiwix::beautifyInteger(number/1024 !=
|
||||
0 ? number/1024 : 1) + " MB";
|
||||
}
|
||||
}
|
||||
|
||||
std::string kiwix::removeAccents(const std::string &text) {
|
||||
loadICUExternalTables();
|
||||
ucnv_setDefaultName("UTF-8");
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace kiwix {
|
|||
|
||||
std::string removeAccents(const std::string &text);
|
||||
std::string beautifyInteger(const unsigned int number);
|
||||
std::string beautifyFileSize(const unsigned int number);
|
||||
std::string urlEncode(const std::string &c);
|
||||
void printStringInHexadecimal(const char *s);
|
||||
void printStringInHexadecimal(UnicodeString s);
|
||||
|
|
Loading…
Reference in New Issue