diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-01-23 15:37:33 +0100 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2018-01-23 15:44:56 +0100 |
commit | f588815647069906581f9ff32647a1067327ddaa (patch) | |
tree | 6771f07bf7a0faadbdb69fe1d758dc6a2e5d55e0 /platform/android/src/style | |
parent | bb76dced78fa3bd72c233cba10d7844a0e975ce5 (diff) | |
download | qtlocation-mapboxgl-upstream/tvn-style-public-api.tar.gz |
[android] - simple JNI Style classupstream/tvn-style-public-api
Diffstat (limited to 'platform/android/src/style')
-rw-r--r-- | platform/android/src/style/style.cpp | 32 | ||||
-rw-r--r-- | platform/android/src/style/style.hpp | 33 |
2 files changed, 65 insertions, 0 deletions
diff --git a/platform/android/src/style/style.cpp b/platform/android/src/style/style.cpp new file mode 100644 index 0000000000..5e366e39a5 --- /dev/null +++ b/platform/android/src/style/style.cpp @@ -0,0 +1,32 @@ +#include "style.hpp" + +namespace mbgl { +namespace android { + +Style::Style(jni::JNIEnv &) { + +} + +Style::~Style() { +} + +jni::Class<Style> Style::javaClass; + +void Style::registerNative(jni::JNIEnv& env) { + //Register classes + Style::javaClass = *jni::Class<Style>::Find(env).NewGlobalRef(env).release(); + + #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) + + // Register the peer + jni::RegisterNativePeer<Style>( + env, Style::javaClass, "nativePtr", + std::make_unique<Style, JNIEnv&>, + "initialize", + "finalize" +); +} + + +} // namespace mbgl +} // namespace android
\ No newline at end of file diff --git a/platform/android/src/style/style.hpp b/platform/android/src/style/style.hpp new file mode 100644 index 0000000000..6c80c72bca --- /dev/null +++ b/platform/android/src/style/style.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include <mbgl/style/style.hpp> + +#include <jni/jni.hpp> + +namespace mbgl { +namespace android { + +/** + * Peer class for the Android Style holder. + */ +class Style { +public: + + // TODO move to style package + static constexpr auto Name() { return "com/mapbox/mapboxsdk/maps/Style"; }; + + Style(jni::JNIEnv &); + + ~Style(); + + static jni::Class<Style> javaClass; + + // TODO add methods + static void registerNative(jni::JNIEnv &); + +private: + +}; + +} +}
\ No newline at end of file |