blob: b614e28dfcf5471c72ec56a11b7305e7d6568b2e (
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
26
27
|
#include <mbgl/util/platform.hpp>
#include "attach_env.hpp"
#include <jni/jni.hpp>
namespace mbgl {
namespace platform {
std::string uppercase(const std::string& str) {
auto env{ android::AttachEnv() };
jni::Local<jni::String> value = jni::Make<jni::String>(*env, str.c_str());
static auto& javaClass = jni::Class<jni::StringTag>::Singleton(*env);
static auto toUpperCase = javaClass.GetMethod<jni::String()>(*env, "toUpperCase");
auto result = value.Call(*env, toUpperCase);
return jni::Make<std::string>(*env, result);
}
std::string lowercase(const std::string& str) {
auto env{ android::AttachEnv() };
jni::Local<jni::String> value = jni::Make<jni::String>(*env, str.c_str());
static auto& javaClass = jni::Class<jni::StringTag>::Singleton(*env);
static auto toLowerCase = javaClass.GetMethod<jni::String()>(*env, "toLowerCase");
auto result = value.Call(*env, toLowerCase);
return jni::Make<std::string>(*env, result);
}
} // namespace platform
} // namespace mbgl
|