use platform-specific NSString for case changes on OS X/iOS

refs #309
This commit is contained in:
Konstantin Käfer
2014-08-22 12:37:23 +02:00
parent b9c7e1bdd9
commit 6610a6370b
7 changed files with 57 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
#include <mbgl/platform/platform.hpp>
#include <locale>
namespace mbgl {
namespace platform {
std::string uppercase(const std::string& string) {
// TODO: Use a proper Unicode Special Casing-aware algorithm.
const auto &convert = std::use_facet<std::ctype<char>>(std::locale());
std::string converted = string;
convert.toupper(&converted[0], &converted[0] + converted.size());
return converted;
}
std::string lowercase(const std::string& string) {
// TODO: Use a proper Unicode Special Casing-aware algorithm.
const auto &convert = std::use_facet<std::ctype<char>>(std::locale());
std::string converted = string;
convert.tolower(&converted[0], &converted[0] + converted.size());
return converted;
}
}
}