[core][android] Remove unaccent from platform interfaces

The unaccent is used only within collator, thus, there is no
need to have separate platform interface for it.
This commit is contained in:
Alexander Shalamov
2019-09-23 14:30:02 +03:00
parent 7c2a7a263f
commit 30ffbe9b8d
9 changed files with 45 additions and 81 deletions

View File

@@ -2,8 +2,6 @@
#include <mbgl/text/language_tag.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/text/unaccent.hpp>
#include <jni/jni.hpp>
#include "../attach_env.hpp"
@@ -144,12 +142,10 @@ public:
// Because of the difference in locale-awareness, this means turning on case-sensitivity
// can _potentially_ change compare results for strings that don't actually have any case
// differences.
jni::Local<jni::String> jlhs = jni::Make<jni::String>(*env, useUnaccent ?
platform::unaccent(lhs) :
lhs);
jni::Local<jni::String> jrhs = jni::Make<jni::String>(*env, useUnaccent ?
platform::unaccent(rhs) :
rhs);
jni::Local<jni::String> jlhs = useUnaccent ? android::StringUtils::unaccent(*env, jni::Make<jni::String>(*env, lhs))
: jni::Make<jni::String>(*env, lhs);
jni::Local<jni::String> jrhs = useUnaccent ? android::StringUtils::unaccent(*env, jni::Make<jni::String>(*env, rhs))
: jni::Make<jni::String>(*env, rhs);
jni::jint result = android::Collator::compare(*env, collator, jlhs, jrhs);

View File

@@ -1,18 +0,0 @@
#include <mbgl/text/unaccent.hpp>
#include <string>
#include "attach_env.hpp"
#include "text/collator_jni.hpp"
#include <jni/jni.hpp>
namespace mbgl {
namespace platform {
std::string unaccent(const std::string& str) {
android::UniqueEnv env = android::AttachEnv();
jni::Local<jni::String> input = jni::Make<jni::String>(*env, str);
jni::Local<jni::String> unaccented = android::StringUtils::unaccent(*env, input);
return jni::Make<std::string>(*env, unaccented);
}
} // namespace platform
} // namespace mbgl