summaryrefslogtreecommitdiff
path: root/common/platform_default.cpp
blob: 1acbfa8508d69fa176803f78449bd5208cf613a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
}

}
}