Move JNI bindings code from mapbox-gl-native to this repo. (#301)
This commit is contained in:
62
MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs
Normal file
62
MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs
Normal file
@@ -0,0 +1,62 @@
|
||||
<%
|
||||
const type = locals.type;
|
||||
const properties = locals.properties;
|
||||
-%>
|
||||
// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "layer.hpp"
|
||||
#include "../transition_options.hpp"
|
||||
#include <mbgl/layermanager/<%- type.replace('-', '_') %>_layer_factory.hpp>
|
||||
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
|
||||
#include <jni/jni.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
class <%- camelize(type) %>Layer : public Layer {
|
||||
public:
|
||||
using SuperTag = Layer;
|
||||
static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/<%- camelize(type) %>Layer"; };
|
||||
|
||||
<% if (type === 'background') { -%>
|
||||
<%- camelize(type) %>Layer(jni::JNIEnv&, jni::String&);
|
||||
<% } else { -%>
|
||||
<%- camelize(type) %>Layer(jni::JNIEnv&, jni::String&, jni::String&);
|
||||
<% } -%>
|
||||
|
||||
<%- camelize(type) %>Layer(mbgl::style::<%- camelize(type) %>Layer&);
|
||||
|
||||
<%- camelize(type) %>Layer(std::unique_ptr<mbgl::style::<%- camelize(type) %>Layer>);
|
||||
|
||||
~<%- camelize(type) %>Layer();
|
||||
|
||||
// Properties
|
||||
<% for (const property of properties) { -%>
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> get<%- camelize(property.name) %>(jni::JNIEnv&);
|
||||
<% if (property.transition) { -%>
|
||||
void set<%- camelize(property.name) %>Transition(jni::JNIEnv&, jlong duration, jlong delay);
|
||||
jni::Local<jni::Object<TransitionOptions>> get<%- camelize(property.name) %>Transition(jni::JNIEnv&);
|
||||
<% } -%>
|
||||
<% } -%>
|
||||
|
||||
}; // class <%- camelize(type) %>Layer
|
||||
|
||||
class <%- camelize(type) %>JavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::<%- camelize(type) %>LayerFactory {
|
||||
public:
|
||||
~<%- camelize(type) %>JavaLayerPeerFactory() override;
|
||||
|
||||
// JavaLayerPeerFactory overrides.
|
||||
jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv&, mbgl::style::Layer&) final;
|
||||
jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv& env, std::unique_ptr<mbgl::style::Layer>) final;
|
||||
|
||||
void registerNative(jni::JNIEnv&) final;
|
||||
|
||||
LayerFactory* getLayerFactory() final { return this; }
|
||||
|
||||
}; // class <%- camelize(type) %>JavaLayerPeerFactory
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
Reference in New Issue
Block a user