Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -12,9 +12,9 @@ using namespace gson;
mbgl::GeoJSONFeature Feature::convert(jni::JNIEnv& env, const jni::Object<Feature>& jFeature) {
static auto& javaClass = jni::Class<Feature>::Singleton(env);
static auto id = javaClass.GetMethod<jni::String ()>(env, "id");
static auto geometry = javaClass.GetMethod<jni::Object<Geometry> ()>(env, "geometry");
static auto properties = javaClass.GetMethod<jni::Object<gson::JsonObject> ()>(env, "properties");
static auto id = javaClass.GetMethod<jni::String()>(env, "id");
static auto geometry = javaClass.GetMethod<jni::Object<Geometry>()>(env, "geometry");
static auto properties = javaClass.GetMethod<jni::Object<gson::JsonObject>()>(env, "properties");
auto jId = jFeature.Call(env, id);
@@ -30,35 +30,35 @@ mbgl::GeoJSONFeature Feature::convert(jni::JNIEnv& env, const jni::Object<Featur
*/
class FeatureIdVisitor {
public:
template<class T>
template <class T>
std::string operator()(const T& i) const {
return util::toString(i);
}
std::string operator()(const std::string& i) const {
return i;
}
std::string operator()(const std::string& i) const { return i; }
std::string operator()(const std::nullptr_t&) const {
return {};
}
std::string operator()(const std::nullptr_t&) const { return {}; }
std::string operator()(const mapbox::feature::null_value_t&) const {
return {};
}
std::string operator()(const mapbox::feature::null_value_t&) const { return {}; }
};
jni::Local<jni::Object<Feature>> convertFeature(jni::JNIEnv& env, const mbgl::GeoJSONFeature& value) {
static auto& javaClass = jni::Class<Feature>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<Feature> (jni::Object<Geometry>, jni::Object<JsonObject>, jni::String)>(env, "fromGeometry");
static auto method =
javaClass.GetStaticMethod<jni::Object<Feature>(jni::Object<Geometry>, jni::Object<JsonObject>, jni::String)>(
env, "fromGeometry");
return javaClass.Call(env, method,
return javaClass.Call(
env,
method,
Geometry::New(env, value.geometry),
JsonObject::New(env, value.properties),
jni::Make<jni::String>(env, value.id.is<mbgl::NullValue>() ? std::string {} : value.id.match(FeatureIdVisitor())));
jni::Make<jni::String>(env,
value.id.is<mbgl::NullValue>() ? std::string{} : value.id.match(FeatureIdVisitor())));
}
jni::Local<jni::Array<jni::Object<Feature>>> Feature::convert(jni::JNIEnv& env, const std::vector<mbgl::Feature>& value) {
jni::Local<jni::Array<jni::Object<Feature>>> Feature::convert(jni::JNIEnv& env,
const std::vector<mbgl::Feature>& value) {
auto features = jni::Array<jni::Object<Feature>>::New(env, value.size());
for (size_t i = 0; i < value.size(); ++i) {