diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-09-23 15:42:06 +0300 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-09-26 10:55:47 +0300 |
commit | 9c8295c6a64b6f5b2c9b67fd01633a156481a3c8 (patch) | |
tree | 27cbdbff1757d0e4aa88c3616f17233a143270e2 /platform/android/src/i18n/collator_jni.hpp | |
parent | 30ffbe9b8d49d8d8a2820f7b452ebc1d1531f298 (diff) | |
download | qtlocation-mapboxgl-9c8295c6a64b6f5b2c9b67fd01633a156481a3c8.tar.gz |
[core][android][darwin] Move platform specific Collator impls from expression
Platform specific Collator implementations should not be part of an expression APIs.
Diffstat (limited to 'platform/android/src/i18n/collator_jni.hpp')
-rw-r--r-- | platform/android/src/i18n/collator_jni.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/platform/android/src/i18n/collator_jni.hpp b/platform/android/src/i18n/collator_jni.hpp new file mode 100644 index 0000000000..612f9b49f3 --- /dev/null +++ b/platform/android/src/i18n/collator_jni.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include <jni/jni.hpp> + +/* + android::Collator and android::Locale are + the JNI wrappers of + java/text/Collator and java/util/Locale + + mbgl::Collator is the portable interface + Both implementations are in collator.cpp + */ + +namespace mbgl { +namespace android { + +class Locale { +public: + static constexpr auto Name() { return "java/util/Locale"; }; + + /* Requires API level 21+ in order to support script/variant + static jni::Object<Locale> forLanguageTag(jni::JNIEnv&, jni::String); + static jni::String toLanguageTag(jni::JNIEnv&, jni::Object<Locale>); + */ + static jni::Local<jni::Object<Locale>> getDefault(jni::JNIEnv&); + static jni::Local<jni::String> getLanguage(jni::JNIEnv&, const jni::Object<Locale>&); + static jni::Local<jni::String> getCountry(jni::JNIEnv&, const jni::Object<Locale>&); + + static jni::Local<jni::Object<Locale>> New(jni::JNIEnv&, const jni::String&); + static jni::Local<jni::Object<Locale>> New(jni::JNIEnv&, const jni::String&, const jni::String&); + + + static void registerNative(jni::JNIEnv&); +}; + +class Collator { +public: + static constexpr auto Name() { return "java/text/Collator"; }; + + static jni::Local<jni::Object<Collator>> getInstance(jni::JNIEnv&, const jni::Object<Locale>&); + + static void setStrength(jni::JNIEnv&, const jni::Object<Collator>&, jni::jint); + + static jni::jint compare(jni::JNIEnv&, const jni::Object<Collator>&, const jni::String&, const jni::String&); + + + static void registerNative(jni::JNIEnv&); +}; + + +class StringUtils { +public: + static constexpr auto Name() { return "com/mapbox/mapboxsdk/utils/StringUtils"; }; + + static jni::Local<jni::String> unaccent(jni::JNIEnv&, const jni::String&); + + + static void registerNative(jni::JNIEnv&); +}; + +} // namespace android +} // namespace mbgl |