Commit 9d1d6404 authored by Miro Knejp's avatar Miro Knejp

Refactored JNI code generation

- Renamed toJava/fromJava methods to fromCpp/toCpp for consistency among language generators
- fromCpp methods return LocaLRef<JniType> instead of JniType for improved exception safety
- Merged primitive converters into a single header file and fixed for LocalRef<T> changes
- Avoiding local temporaries where feasible
- Consistent call signatures
- Proper support for templated JNI types
parent 82ca9318
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
// This file generated by Djinni from example.djinni // This file generated by Djinni from example.djinni
#include "NativeItemList.hpp" // my header #include "NativeItemList.hpp" // my header
#include "HList.hpp" #include "Marshal.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeItemList::toJava(JNIEnv* jniEnv, ::textsort::ItemList c) { NativeItemList::NativeItemList() = default;
djinni::LocalRef<jobject> j_items(jniEnv, ::djinni::HList<::djinni::HString>::toJava(jniEnv, c.items));
const auto & data = djinni::JniClass<::djinni_generated::NativeItemList>::get(); NativeItemList::~NativeItemList() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_items.get());
djinni::jniExceptionCheck(jniEnv); auto NativeItemList::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeItemList>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::List<::djinni::String>::fromCpp(jniEnv, c.items).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::textsort::ItemList NativeItemList::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeItemList::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeItemList>::get(); const auto& data = ::djinni::JniClass<NativeItemList>::get();
return ::textsort::ItemList( return {::djinni::List<::djinni::String>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mItems))};
::djinni::HList<::djinni::HString>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mItems)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::textsort::ItemList; using CppType = ::textsort::ItemList;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::textsort::ItemList); using Boxed = NativeItemList;
static ::textsort::ItemList fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/textsort/ItemList") }; ~NativeItemList();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mItems { djinni::jniGetFieldID(clazz.get(), "mItems", "Ljava/util/ArrayList;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeItemList() {} NativeItemList();
friend class djinni::JniClass<::djinni_generated::NativeItemList>; friend ::djinni::JniClass<NativeItemList>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/textsort/ItemList") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mItems { ::djinni::jniGetFieldID(clazz.get(), "mItems", "Ljava/util/ArrayList;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
namespace djinni_generated { namespace djinni_generated {
NativeSortItems::NativeSortItems() : djinni::JniInterface<::textsort::SortItems, NativeSortItems>("com/dropbox/textsort/SortItems$CppProxy") {} NativeSortItems::NativeSortItems() : ::djinni::JniInterface<::textsort::SortItems, NativeSortItems>("com/dropbox/textsort/SortItems$CppProxy") {}
NativeSortItems::~NativeSortItems() = default;
using namespace ::djinni_generated;
CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{ {
...@@ -25,11 +26,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_native ...@@ -25,11 +26,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_native
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const std::shared_ptr<::textsort::SortItems> & ref = djinni::CppProxyHandle<::textsort::SortItems>::get(nativeRef); const auto& ref = ::djinni::CppProxyHandle<::textsort::SortItems>::get(nativeRef);
::textsort::sort_order c_order = NativeSortOrder::fromJava(jniEnv, j_order); ref->sort(::djinni_generated::NativeSortOrder::toCpp(jniEnv, j_order),
::textsort::ItemList c_items = NativeItemList::fromJava(jniEnv, j_items); ::djinni_generated::NativeItemList::toCpp(jniEnv, j_items));
ref->sort(c_order, c_items);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
} }
...@@ -37,11 +36,8 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_createWithListene ...@@ -37,11 +36,8 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_createWithListene
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv); DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<::textsort::TextboxListener> c_listener = NativeTextboxListener::fromJava(jniEnv, j_listener); auto r = ::textsort::SortItems::create_with_listener(::djinni_generated::NativeTextboxListener::toCpp(jniEnv, j_listener));
return ::djinni_generated::NativeSortItems::fromCpp(jniEnv, r).release();
std::shared_ptr<::textsort::SortItems> cr = ::textsort::SortItems::create_with_listener(c_listener);
return NativeSortItems::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
} }
......
...@@ -8,18 +8,23 @@ ...@@ -8,18 +8,23 @@
namespace djinni_generated { namespace djinni_generated {
class NativeSortItems final : djinni::JniInterface<::textsort::SortItems, NativeSortItems> { class NativeSortItems final : ::djinni::JniInterface<::textsort::SortItems, NativeSortItems> {
public: public:
using CppType = std::shared_ptr<::textsort::SortItems>; using CppType = std::shared_ptr<::textsort::SortItems>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::textsort::SortItems> c) { return djinni::JniClass<::djinni_generated::NativeSortItems>::get()._toJava(jniEnv, c); } using Boxed = NativeSortItems;
static std::shared_ptr<::textsort::SortItems> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeSortItems>::get()._fromJava(jniEnv, j); }
~NativeSortItems();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeSortItems>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeSortItems>::get()._toJava(jniEnv, c)}; }
private: private:
NativeSortItems(); NativeSortItems();
friend class djinni::JniClass<::djinni_generated::NativeSortItems>; friend ::djinni::JniClass<NativeSortItems>;
friend ::djinni::JniInterface<::textsort::SortItems, NativeSortItems>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -8,17 +8,19 @@ ...@@ -8,17 +8,19 @@
namespace djinni_generated { namespace djinni_generated {
class NativeSortOrder final : djinni::JniEnum { class NativeSortOrder final : ::djinni::JniEnum {
public: public:
using CppType = ::textsort::sort_order; using CppType = ::textsort::sort_order;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, ::textsort::sort_order c) { return djinni::JniClass<NativeSortOrder>::get().create(jniEnv, static_cast<int>(c)).release(); } using Boxed = NativeSortOrder;
static ::textsort::sort_order fromJava(JNIEnv* jniEnv, jobject j) { return static_cast<::textsort::sort_order>(djinni::JniClass<NativeSortOrder>::get().ordinal(jniEnv, j)); }
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeSortOrder>::get().ordinal(jniEnv, j)); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeSortOrder>::get().create(jniEnv, static_cast<jint>(c)); }
private: private:
NativeSortOrder() : JniEnum("com/dropbox/textsort/SortOrder") {} NativeSortOrder() : JniEnum("com/dropbox/textsort/SortOrder") {}
friend class djinni::JniClass<NativeSortOrder>; friend ::djinni::JniClass<NativeSortOrder>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -6,17 +6,21 @@ ...@@ -6,17 +6,21 @@
namespace djinni_generated { namespace djinni_generated {
NativeTextboxListener::NativeTextboxListener() : djinni::JniInterface<::textsort::TextboxListener, NativeTextboxListener>() {} NativeTextboxListener::NativeTextboxListener() : ::djinni::JniInterface<::textsort::TextboxListener, NativeTextboxListener>() {}
NativeTextboxListener::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {} NativeTextboxListener::~NativeTextboxListener() = default;
void NativeTextboxListener::JavaProxy::JavaProxy::update(const ::textsort::ItemList & c_items) { NativeTextboxListener::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j) { }
JNIEnv * const jniEnv = djinni::jniGetThreadEnv();
djinni::JniLocalScope jscope(jniEnv, 10); NativeTextboxListener::JavaProxy::~JavaProxy() = default;
djinni::LocalRef<jobject> j_items(jniEnv, NativeItemList::toJava(jniEnv, c_items));
const auto & data = djinni::JniClass<::djinni_generated::NativeTextboxListener>::get(); void NativeTextboxListener::JavaProxy::update(const ::textsort::ItemList & items) {
jniEnv->CallVoidMethod(getGlobalRef(), data.method_update, j_items.get()); auto jniEnv = ::djinni::jniGetThreadEnv();
djinni::jniExceptionCheck(jniEnv); ::djinni::JniLocalScope jscope(jniEnv, 10);
}; const auto& data = ::djinni::JniClass<::djinni_generated::NativeTextboxListener>::get();
jniEnv->CallVoidMethod(getGlobalRef(), data.method_update,
::djinni_generated::NativeItemList::fromCpp(jniEnv, items).get());
::djinni::jniExceptionCheck(jniEnv);
}
} // namespace djinni_generated } // namespace djinni_generated
...@@ -8,31 +8,39 @@ ...@@ -8,31 +8,39 @@
namespace djinni_generated { namespace djinni_generated {
class NativeTextboxListener final : djinni::JniInterface<::textsort::TextboxListener, NativeTextboxListener> { class NativeTextboxListener final : ::djinni::JniInterface<::textsort::TextboxListener, NativeTextboxListener> {
public: public:
using CppType = std::shared_ptr<::textsort::TextboxListener>; using CppType = std::shared_ptr<::textsort::TextboxListener>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::textsort::TextboxListener> c) { return djinni::JniClass<::djinni_generated::NativeTextboxListener>::get()._toJava(jniEnv, c); } using Boxed = NativeTextboxListener;
static std::shared_ptr<::textsort::TextboxListener> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeTextboxListener>::get()._fromJava(jniEnv, j); }
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/textsort/TextboxListener") }; ~NativeTextboxListener();
const jmethodID method_update { djinni::jniGetMethodID(clazz.get(), "update", "(Lcom/dropbox/textsort/ItemList;)V") };
class JavaProxy final : djinni::JavaProxyCacheEntry, public ::textsort::TextboxListener { static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeTextboxListener>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeTextboxListener>::get()._toJava(jniEnv, c)}; }
private:
NativeTextboxListener();
friend ::djinni::JniClass<NativeTextboxListener>;
friend ::djinni::JniInterface<::textsort::TextboxListener, NativeTextboxListener>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::textsort::TextboxListener
{
public: public:
JavaProxy(jobject obj); JavaProxy(JniType j);
virtual void update(const ::textsort::ItemList & items) override; ~JavaProxy();
void update(const ::textsort::ItemList & items) override;
private: private:
using djinni::JavaProxyCacheEntry::getGlobalRef; using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend class djinni::JniInterface<::textsort::TextboxListener, ::djinni_generated::NativeTextboxListener>; friend ::djinni::JniInterface<::textsort::TextboxListener, ::djinni_generated::NativeTextboxListener>;
friend class djinni::JavaProxyCache<JavaProxy>; friend ::djinni::JavaProxyCache<JavaProxy>;
}; };
private: const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/textsort/TextboxListener") };
NativeTextboxListener(); const jmethodID method_update { ::djinni::jniGetMethodID(clazz.get(), "update", "(Lcom/dropbox/textsort/ItemList;)V") };
friend class djinni::JniClass<::djinni_generated::NativeTextboxListener>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
This diff is collapsed.
...@@ -22,9 +22,16 @@ class JNIMarshal(spec: Spec) extends Marshal(spec) { ...@@ -22,9 +22,16 @@ class JNIMarshal(spec: Spec) extends Marshal(spec) {
override def fieldType(tm: MExpr): String = paramType(tm) override def fieldType(tm: MExpr): String = paramType(tm)
override def fqFieldType(tm: MExpr): String = fqParamType(tm) override def fqFieldType(tm: MExpr): String = fqParamType(tm)
override def toCpp(tm: MExpr, expr: String): String = {
s"${helperClass(tm)}::toCpp(jniEnv, $expr)"
}
override def fromCpp(tm: MExpr, expr: String): String = {
s"${helperClass(tm)}::fromCpp(jniEnv, $expr)"
}
// Name for the autogenerated class containing field/method IDs and toJava()/fromJava() methods // Name for the autogenerated class containing field/method IDs and toJava()/fromJava() methods
def helperClass(name: String) = spec.jniClassIdentStyle(name) def helperClass(name: String) = spec.jniClassIdentStyle(name)
def fqHelperClass(name: String) = withNs(Some(spec.jniNamespace), helperClass(name)) private def helperClass(tm: MExpr) = helperName(tm) + helperTemplates(tm)
def toJniType(ty: TypeRef): String = toJniType(ty.resolved, false) def toJniType(ty: TypeRef): String = toJniType(ty.resolved, false)
def toJniType(m: MExpr, needRef: Boolean): String = m.base match { def toJniType(m: MExpr, needRef: Boolean): String = m.base match {
...@@ -61,4 +68,54 @@ class JNIMarshal(spec: Spec) extends Marshal(spec) { ...@@ -61,4 +68,54 @@ class JNIMarshal(spec: Spec) extends Marshal(spec) {
case d: MDef => s"L${undecoratedTypename(d.name, d.body)};" case d: MDef => s"L${undecoratedTypename(d.name, d.body)};"
} }
def javaMethodSignature(params: Iterable[Field], ret: Option[TypeRef]) = {
params.map(f => typename(f.ty)).mkString("(", "", ")") + ret.fold("V")(typename)
}
private def helperName(tm: MExpr): String = tm.base match {
case d: MDef => withNs(Some(spec.jniNamespace), helperClass(d.name))
case o => withNs(Some("djinni"), o match {
case p: MPrimitive => p.idlName match {
case "i8" => "I8"
case "i16" => "I16"
case "i32" => "I32"
case "i64" => "I64"
case "f64" => "F64"
case "bool" => "Bool"
}
case MOptional => "Optional"
case MBinary => "Binary"
case MString => "String"
case MDate => "Date"
case MList => "List"
case MSet => "Set"
case MMap => "Map"
case d: MDef => throw new AssertionError("unreachable")
case p: MParam => throw new AssertionError("not applicable")
})
}
private def helperTemplates(tm: MExpr): String = {
def f() = if(tm.args.isEmpty) "" else tm.args.map(helperClass).mkString("<", ", ", ">")
tm.base match {
case MOptional =>
assert(tm.args.size == 1)
val argHelperClass = helperClass(tm.args.head)
s"<${spec.cppOptionalTemplate}, $argHelperClass>"
case MList | MSet =>
assert(tm.args.size == 1)
f
case MMap =>
assert(tm.args.size == 2)
f
case _ => f
}
}
def isJavaHeapObject(ty: TypeRef): Boolean = isJavaHeapObject(ty.resolved.base)
def isJavaHeapObject(m: Meta): Boolean = m match {
case _: MPrimitive => false
case _ => true
}
} }
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "djinni_support.hpp"
#include <cstdlib>
namespace djinni {
class HBinary {
public:
using CppType = std::vector<uint8_t>;
using JniType = jbyteArray;
static std::vector<uint8_t> fromJava(JNIEnv * jniEnv, jbyteArray j) {
const auto deleter = [jniEnv, j] (void * c) {
jniEnv->ReleasePrimitiveArrayCritical(j, c, JNI_ABORT);
};
std::unique_ptr<uint8_t, decltype(deleter)> ptr(
reinterpret_cast<uint8_t *>(jniEnv->GetPrimitiveArrayCritical(j, nullptr)),
deleter);
jniExceptionCheck(jniEnv);
return std::vector<uint8_t>(ptr.get(), ptr.get() + jniEnv->GetArrayLength(j));
}
static jbyteArray toJava(JNIEnv* jniEnv, const std::vector<uint8_t> & c) {
LocalRef<jbyteArray> j(jniEnv, jniEnv->NewByteArray(c.size()));
DJINNI_ASSERT(j, jniEnv);
jniEnv->SetByteArrayRegion(j.get(), 0, c.size(),
reinterpret_cast<const jbyte *>(c.data()));
return j.release();
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HBool : public Primitive<HBool, bool, jboolean> {
HBool() : Primitive("java/lang/Boolean",
"valueOf", "(Z)Ljava/lang/Boolean;",
"booleanValue", "()Z") {}
friend class JniClass<HBool>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "djinni_support.hpp"
#include <chrono>
namespace djinni {
class HDateJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/Date") };
const jmethodID constructor { jniGetMethodID(clazz.get(), "<init>", "(J)V") };
const jmethodID method_get_time { jniGetMethodID(clazz.get(), "getTime", "()J") };
};
class HDate {
public:
using CppType = std::chrono::system_clock::time_point;
using JniType = jobject;
static std::chrono::system_clock::time_point fromJava(JNIEnv* jniEnv, jobject j) {
static const auto POSIX_EPOCH = std::chrono::system_clock::from_time_t(0);
assert(j != nullptr);
const auto & data = JniClass<HDateJniInfo>::get();
assert(jniEnv->IsInstanceOf(j, data.clazz.get()));
const jlong time_millis = jniEnv->CallLongMethod(j, data.method_get_time);
return POSIX_EPOCH + std::chrono::milliseconds{time_millis};
}
static jobject toJava(JNIEnv* jniEnv, std::chrono::system_clock::time_point value) {
static const auto POSIX_EPOCH = std::chrono::system_clock::from_time_t(0);
const auto & data = JniClass<HDateJniInfo>::get();
const auto cpp_millis = std::chrono::duration_cast<std::chrono::milliseconds>(value - POSIX_EPOCH);
const jlong millis = static_cast<jlong>(cpp_millis.count());
LocalRef<jobject> j(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor, millis));
jniExceptionCheck(jniEnv);
return j.release();
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HF64 : public Primitive<HF64, double, jdouble> {
HF64() : Primitive("java/lang/Double",
"valueOf", "(D)Ljava/lang/Double;",
"doubleValue", "()D") {}
friend class JniClass<HF64>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HI16 : public Primitive<HI16, int16_t, jshort> {
HI16() : Primitive("java/lang/Short",
"valueOf", "(S)Ljava/lang/Short;",
"shortValue", "()S") {}
friend class JniClass<HI16>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HI32 : public Primitive<HI32, int32_t, jint> {
HI32() : Primitive("java/lang/Integer",
"valueOf", "(I)Ljava/lang/Integer;",
"intValue", "()I") {}
friend class JniClass<HI32>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HI64 : public Primitive<HI64, int64_t, jlong> {
HI64() : Primitive("java/lang/Long",
"valueOf", "(J)Ljava/lang/Long;",
"longValue", "()J") {}
friend class JniClass<HI64>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "Primitive.hpp"
namespace djinni {
class HI8 : public Primitive<HI8, int8_t, jbyte> {
HI8() : Primitive("java/lang/Byte",
"valueOf", "(B)Ljava/lang/Byte;",
"byteValue", "()B") {}
friend class JniClass<HI8>;
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "djinni_support.hpp"
namespace djinni {
class HIteJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/Iterator") };
const jmethodID method_next { jniGetMethodID(clazz.get(), "next", "()Ljava/lang/Object;") };
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "djinni_support.hpp"
#include <set>
namespace djinni {
class HListJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/ArrayList") };
const jmethodID constructor { jniGetMethodID(clazz.get(), "<init>", "(I)V") };
const jmethodID method_add { jniGetMethodID(clazz.get(), "add", "(Ljava/lang/Object;)Z") };
const jmethodID method_get { jniGetMethodID(clazz.get(), "get", "(I)Ljava/lang/Object;") };
const jmethodID method_size { jniGetMethodID(clazz.get(), "size", "()I") };
};
template <class HElement>
class HList {
using ECppType = typename HElement::CppType;
using EJniType = typename HElement::JniType;
public:
using CppType = std::vector<ECppType>;
using JniType = jobject;
static std::vector<ECppType> fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
const auto & data = JniClass<HListJniInfo>::get();
assert(jniEnv->IsInstanceOf(j, data.clazz.get()));
jint size = jniEnv->CallIntMethod(j, data.method_size);
std::vector<ECppType> c;
c.reserve(size);
for (jint i = 0; i < size; i++) {
LocalRef<EJniType> je(jniEnv, static_cast<EJniType>(jniEnv->CallObjectMethod(j, data.method_get, i)));
jniExceptionCheck(jniEnv);
ECppType ce = HElement::fromJava(jniEnv, je.get());
c.push_back(std::move(ce));
}
return c;
}
static jobject toJava(JNIEnv* jniEnv, std::vector<ECppType> c) {
const auto & data = JniClass<HListJniInfo>::get();
assert(c.size() <= std::numeric_limits<jint>::max());
jint size = c.size();
LocalRef<jobject> j(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor, size));
jniExceptionCheck(jniEnv);
for (const auto & ce : c) {
LocalRef<jobject> je(jniEnv, HElement::toJava(jniEnv, ce));
jniEnv->CallBooleanMethod(j.get(), data.method_add, je.get());
jniExceptionCheck(jniEnv);
}
return j.release();
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "HIteJniInfo.hpp"
#include "djinni_support.hpp"
namespace djinni {
class HMapJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/HashMap") };
const jmethodID constructor { jniGetMethodID(clazz.get(), "<init>", "()V") };
const jmethodID method_put { jniGetMethodID(clazz.get(), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") };
const jmethodID method_size { jniGetMethodID(clazz.get(), "size", "()I") };
const jmethodID method_entrySet { jniGetMethodID(clazz.get(), "entrySet", "()Ljava/util/Set;") };
};
class HEntrySetJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/Set") };
const jmethodID method_iterator { jniGetMethodID(clazz.get(), "iterator", "()Ljava/util/Iterator;") };
};
class HEntryJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/Map$Entry") };
const jmethodID method_getKey { jniGetMethodID(clazz.get(), "getKey", "()Ljava/lang/Object;") };
const jmethodID method_getValue { jniGetMethodID(clazz.get(), "getValue", "()Ljava/lang/Object;") };
};
template <class HKey, class HValue>
class HMap {
using KCppType = typename HKey::CppType;
using KJniType = typename HKey::JniType;
using VCppType = typename HValue::CppType;
using VJniType = typename HValue::JniType;
public:
using CppType = std::unordered_map<KCppType, VCppType>;
using JniType = jobject;
static std::unordered_map<KCppType, VCppType> fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
const auto & data = JniClass<HMapJniInfo>::get();
const auto & entrySetData = JniClass<HEntrySetJniInfo>::get();
const auto & entryData = JniClass<HEntryJniInfo>::get();
const auto & iteData = JniClass<HIteJniInfo>::get();
assert(jniEnv->IsInstanceOf(j, data.clazz.get()));
jint size = jniEnv->CallIntMethod(j, data.method_size);
LocalRef<jobject> entrySet(jniEnv, jniEnv->CallObjectMethod(j, data.method_entrySet));
std::unordered_map<KCppType, VCppType> c;
c.reserve(size);
LocalRef<jobject> it(jniEnv, jniEnv->CallObjectMethod(entrySet.get(), entrySetData.method_iterator));
for (jint i = 0; i < size; i++) {
LocalRef<jobject> je(jniEnv, jniEnv->CallObjectMethod(it.get(), iteData.method_next));
LocalRef<KJniType> jKey(jniEnv, static_cast<KJniType>(jniEnv->CallObjectMethod(je.get(), entryData.method_getKey)));
LocalRef<VJniType> jValue(jniEnv, static_cast<VJniType>(jniEnv->CallObjectMethod(je.get(), entryData.method_getValue)));
jniExceptionCheck(jniEnv);
c.emplace(HKey::fromJava(jniEnv, jKey.get()),
HValue::fromJava(jniEnv, jValue.get()));
}
return c;
}
static jobject toJava(JNIEnv* jniEnv, std::unordered_map<KCppType, VCppType> c) {
const auto & data = JniClass<HMapJniInfo>::get();
assert(c.size() <= std::numeric_limits<jint>::max());
jint size = c.size();
LocalRef<jobject> j(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor, size));
jniExceptionCheck(jniEnv);
for (const auto & ce : c) {
LocalRef<jobject> jKey(jniEnv, HKey::toJava(jniEnv, ce.first));
LocalRef<jobject> jValue(jniEnv, HValue::toJava(jniEnv, ce.second));
jniEnv->CallObjectMethod(j.get(), data.method_put, jKey.get(), jValue.get());
jniExceptionCheck(jniEnv);
}
return j.release();
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "djinni_support.hpp"
namespace djinni {
template <template <class> class Optional, class HElement>
class HOptional {
using ECppType = typename HElement::CppType;
using EJniType = typename HElement::JniType;
public:
using CppType = Optional<ECppType>;
using JniType = EJniType;
static CppType fromJava(JNIEnv* jniEnv, JniType j) {
if (j != nullptr) {
return HElement::fromJava(jniEnv, j);
}
return {};
}
static JniType toJava(JNIEnv* jniEnv, const CppType & c) {
if (c) {
return HElement::toJava(jniEnv, *c);
}
return nullptr;
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "HIteJniInfo.hpp"
#include "djinni_support.hpp"
namespace djinni {
class HSetJniInfo {
public:
const GlobalRef<jclass> clazz { jniFindClass("java/util/HashSet") };
const jmethodID constructor { jniGetMethodID(clazz.get(), "<init>", "()V") };
const jmethodID method_add { jniGetMethodID(clazz.get(), "add", "(Ljava/lang/Object;)Z") };
const jmethodID method_size { jniGetMethodID(clazz.get(), "size", "()I") };
const jmethodID method_iterator { jniGetMethodID(clazz.get(), "iterator", "()Ljava/util/Iterator;") };
};
template <class HElement>
class HSet {
using ECppType = typename HElement::CppType;
using EJniType = typename HElement::JniType;
public:
using CppType = std::unordered_set<ECppType>;
using JniType = jobject;
static std::unordered_set<ECppType> fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
const auto & data = JniClass<HSetJniInfo>::get();
const auto & iteData = JniClass<HIteJniInfo>::get();
assert(jniEnv->IsInstanceOf(j, data.clazz.get()));
jint size = jniEnv->CallIntMethod(j, data.method_size);
std::unordered_set<ECppType> c;
LocalRef<jobject> it(jniEnv, jniEnv->CallObjectMethod(j, data.method_iterator));
for (jint i = 0; i < size; i++) {
LocalRef<EJniType> je(jniEnv, static_cast<EJniType>(jniEnv->CallObjectMethod(it.get(), iteData.method_next)));
jniExceptionCheck(jniEnv);
c.insert(HElement::fromJava(jniEnv, je.get()));
}
return c;
}
static jobject toJava(JNIEnv* jniEnv, std::unordered_set<ECppType> c) {
const auto & data = JniClass<HSetJniInfo>::get();
LocalRef<jobject> j(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor));
jniExceptionCheck(jniEnv);
for (const auto & ce : c) {
LocalRef<jobject> je(jniEnv, HElement::toJava(jniEnv, ce));
jniEnv->CallBooleanMethod(j.get(), data.method_add, je.get());
jniExceptionCheck(jniEnv);
}
return j.release();
}
};
} // namespace djinni
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "djinni_support.hpp"
namespace djinni {
class HString {
public:
using CppType = std::string;
using JniType = jstring;
static std::string fromJava(JNIEnv* jniEnv, jstring j) {
assert(j != nullptr);
return jniUTF8FromString(jniEnv, j);
}
static jstring toJava(JNIEnv* jniEnv, const std::string & c) {
return jniStringFromUTF8(jniEnv, c);
}
};
} // namespace djinni
This diff is collapsed.
//
// Copyright 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
#include "djinni_support.hpp"
namespace djinni {
template <class JniType>
JniType jniUnboxMethodCall(JNIEnv* jniEnv, jmethodID method, jobject thiz);
template <class Self, class _CppType, class UnboxedJniType>
class Primitive {
public:
using CppType = _CppType;
using JniType = jobject;
static CppType fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
const auto & data = JniClass<Self>::get();
assert(jniEnv->IsInstanceOf(j, data.clazz.get()));
UnboxedJniType jni = jniUnboxMethodCall<UnboxedJniType>(jniEnv, data.method_unbox, j);
CppType c = Primitive::Unboxed::fromJava(jniEnv, jni);
return c;
}
static jobject toJava(JNIEnv* jniEnv, CppType c) {
const auto & data = JniClass<Self>::get();
UnboxedJniType jni = Primitive::Unboxed::toJava(jniEnv, c);
jobject j = jniEnv->CallStaticObjectMethod(data.clazz.get(), data.method_box, jni);
jniExceptionCheck(jniEnv);
return j;
}
class Unboxed {
public:
static CppType fromJava(JNIEnv* /*jniEnv*/, UnboxedJniType j) {
return static_cast<CppType>(j);
}
static UnboxedJniType toJava(JNIEnv* /*jniEnv*/, CppType c) {
return static_cast<UnboxedJniType>(c);
}
};
protected:
Primitive(
const char* javaClassSpec,
const char* staticBoxMethod,
const char* staticBoxMethodSignature,
const char* unboxMethod,
const char* unboxMethodSignature) :
clazz(jniFindClass(javaClassSpec)),
method_box(jniGetStaticMethodID(clazz.get(), staticBoxMethod, staticBoxMethodSignature)),
method_unbox(jniGetMethodID(clazz.get(), unboxMethod, unboxMethodSignature)) {}
private:
const GlobalRef<jclass> clazz;
const jmethodID method_box;
const jmethodID method_unbox;
};
template <>
inline
jbyte jniUnboxMethodCall<jbyte>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jbyte ret = jniEnv->CallByteMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
template <>
inline
jshort jniUnboxMethodCall<jshort>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jshort ret = jniEnv->CallShortMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
template <>
inline
jint jniUnboxMethodCall<jint>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jint ret = jniEnv->CallIntMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
template <>
inline
jlong jniUnboxMethodCall<jlong>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jlong ret = jniEnv->CallLongMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
template <>
inline
jboolean jniUnboxMethodCall<jboolean>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jboolean ret = jniEnv->CallBooleanMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
template <>
inline
jdouble jniUnboxMethodCall<jdouble>(JNIEnv* jniEnv, jmethodID method, jobject thiz) {
jdouble ret = jniEnv->CallDoubleMethod(thiz, method);
jniExceptionCheck(jniEnv);
return ret;
}
} // namespace djinni
...@@ -91,6 +91,10 @@ public: ...@@ -91,6 +91,10 @@ public:
explicit LocalRef(PointerType localRef) explicit LocalRef(PointerType localRef)
: std::unique_ptr<typename std::remove_pointer<PointerType>::type, LocalRefDeleter>( : std::unique_ptr<typename std::remove_pointer<PointerType>::type, LocalRefDeleter>(
localRef) {} localRef) {}
// Allow implicit conversion to PointerType so it can be passed
// as argument to JNI functions expecting PointerType.
// All functions creating new local references should return LocalRef instead of PointerType
operator PointerType() const { return this->get(); }
}; };
/* /*
......
...@@ -2,41 +2,40 @@ ...@@ -2,41 +2,40 @@
// This file generated by Djinni from inttypes.djinni // This file generated by Djinni from inttypes.djinni
#include "NativeAssortedIntegers.hpp" // my header #include "NativeAssortedIntegers.hpp" // my header
#include "HI16.hpp" #include "Marshal.hpp"
#include "HI32.hpp"
#include "HI64.hpp"
#include "HI8.hpp"
#include "HOptional.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, ::AssortedIntegers c) { NativeAssortedIntegers::NativeAssortedIntegers() = default;
jbyte j_eight = ::djinni::HI8::Unboxed::toJava(jniEnv, c.eight);
jshort j_sixteen = ::djinni::HI16::Unboxed::toJava(jniEnv, c.sixteen); NativeAssortedIntegers::~NativeAssortedIntegers() = default;
jint j_thirtytwo = ::djinni::HI32::Unboxed::toJava(jniEnv, c.thirtytwo);
jlong j_sixtyfour = ::djinni::HI64::Unboxed::toJava(jniEnv, c.sixtyfour); auto NativeAssortedIntegers::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
djinni::LocalRef<jobject> j_o_eight(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI8>::toJava(jniEnv, c.o_eight)); const auto& data = ::djinni::JniClass<NativeAssortedIntegers>::get();
djinni::LocalRef<jobject> j_o_sixteen(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI16>::toJava(jniEnv, c.o_sixteen)); auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
djinni::LocalRef<jobject> j_o_thirtytwo(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI32>::toJava(jniEnv, c.o_thirtytwo)); ::djinni::I8::fromCpp(jniEnv, c.eight),
djinni::LocalRef<jobject> j_o_sixtyfour(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI64>::toJava(jniEnv, c.o_sixtyfour)); ::djinni::I16::fromCpp(jniEnv, c.sixteen),
const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get(); ::djinni::I32::fromCpp(jniEnv, c.thirtytwo),
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_eight, j_sixteen, j_thirtytwo, j_sixtyfour, j_o_eight.get(), j_o_sixteen.get(), j_o_thirtytwo.get(), j_o_sixtyfour.get()); ::djinni::I64::fromCpp(jniEnv, c.sixtyfour),
djinni::jniExceptionCheck(jniEnv); ::djinni::Optional<std::experimental::optional, ::djinni::I8>::fromCpp(jniEnv, c.o_eight).get(),
::djinni::Optional<std::experimental::optional, ::djinni::I16>::fromCpp(jniEnv, c.o_sixteen).get(),
::djinni::Optional<std::experimental::optional, ::djinni::I32>::fromCpp(jniEnv, c.o_thirtytwo).get(),
::djinni::Optional<std::experimental::optional, ::djinni::I64>::fromCpp(jniEnv, c.o_sixtyfour).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeAssortedIntegers::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get(); const auto& data = ::djinni::JniClass<NativeAssortedIntegers>::get();
return ::AssortedIntegers( return {::djinni::I8::toCpp(jniEnv, jniEnv->GetByteField(j, data.field_mEight)),
::djinni::HI8::Unboxed::fromJava(jniEnv, jniEnv->GetByteField(j, data.field_mEight)), ::djinni::I16::toCpp(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)),
::djinni::HI16::Unboxed::fromJava(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)), ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)), ::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mSixtyfour)),
::djinni::HI64::Unboxed::fromJava(jniEnv, jniEnv->GetLongField(j, data.field_mSixtyfour)), ::djinni::Optional<std::experimental::optional, ::djinni::I8>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mOEight)),
::djinni::HOptional<std::experimental::optional, ::djinni::HI8>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOEight)).get()), ::djinni::Optional<std::experimental::optional, ::djinni::I16>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixteen)),
::djinni::HOptional<std::experimental::optional, ::djinni::HI16>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixteen)).get()), ::djinni::Optional<std::experimental::optional, ::djinni::I32>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mOThirtytwo)),
::djinni::HOptional<std::experimental::optional, ::djinni::HI32>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOThirtytwo)).get()), ::djinni::Optional<std::experimental::optional, ::djinni::I64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixtyfour))};
::djinni::HOptional<std::experimental::optional, ::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixtyfour)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,23 +13,27 @@ public: ...@@ -13,23 +13,27 @@ public:
using CppType = ::AssortedIntegers; using CppType = ::AssortedIntegers;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::AssortedIntegers); using Boxed = NativeAssortedIntegers;
static ::AssortedIntegers fromJava(JNIEnv*, jobject);
~NativeAssortedIntegers();
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/AssortedIntegers") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(BSIJLjava/lang/Byte;Ljava/lang/Short;Ljava/lang/Integer;Ljava/lang/Long;)V") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
const jfieldID field_mEight { djinni::jniGetFieldID(clazz.get(), "mEight", "B") }; static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
const jfieldID field_mSixteen { djinni::jniGetFieldID(clazz.get(), "mSixteen", "S") };
const jfieldID field_mThirtytwo { djinni::jniGetFieldID(clazz.get(), "mThirtytwo", "I") };
const jfieldID field_mSixtyfour { djinni::jniGetFieldID(clazz.get(), "mSixtyfour", "J") };
const jfieldID field_mOEight { djinni::jniGetFieldID(clazz.get(), "mOEight", "Ljava/lang/Byte;") };
const jfieldID field_mOSixteen { djinni::jniGetFieldID(clazz.get(), "mOSixteen", "Ljava/lang/Short;") };
const jfieldID field_mOThirtytwo { djinni::jniGetFieldID(clazz.get(), "mOThirtytwo", "Ljava/lang/Integer;") };
const jfieldID field_mOSixtyfour { djinni::jniGetFieldID(clazz.get(), "mOSixtyfour", "Ljava/lang/Long;") };
private: private:
NativeAssortedIntegers() {} NativeAssortedIntegers();
friend class djinni::JniClass<::djinni_generated::NativeAssortedIntegers>; friend ::djinni::JniClass<NativeAssortedIntegers>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/AssortedIntegers") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(BSIJLjava/lang/Byte;Ljava/lang/Short;Ljava/lang/Integer;Ljava/lang/Long;)V") };
const jfieldID field_mEight { ::djinni::jniGetFieldID(clazz.get(), "mEight", "B") };
const jfieldID field_mSixteen { ::djinni::jniGetFieldID(clazz.get(), "mSixteen", "S") };
const jfieldID field_mThirtytwo { ::djinni::jniGetFieldID(clazz.get(), "mThirtytwo", "I") };
const jfieldID field_mSixtyfour { ::djinni::jniGetFieldID(clazz.get(), "mSixtyfour", "J") };
const jfieldID field_mOEight { ::djinni::jniGetFieldID(clazz.get(), "mOEight", "Ljava/lang/Byte;") };
const jfieldID field_mOSixteen { ::djinni::jniGetFieldID(clazz.get(), "mOSixteen", "Ljava/lang/Short;") };
const jfieldID field_mOThirtytwo { ::djinni::jniGetFieldID(clazz.get(), "mOThirtytwo", "Ljava/lang/Integer;") };
const jfieldID field_mOSixtyfour { ::djinni::jniGetFieldID(clazz.get(), "mOSixtyfour", "Ljava/lang/Long;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,27 +2,29 @@ ...@@ -2,27 +2,29 @@
// This file generated by Djinni from client_interface.djinni // This file generated by Djinni from client_interface.djinni
#include "NativeClientInterface.hpp" // my header #include "NativeClientInterface.hpp" // my header
#include "HI64.hpp" #include "Marshal.hpp"
#include "HOptional.hpp"
#include "HString.hpp"
#include "NativeClientReturnedRecord.hpp" #include "NativeClientReturnedRecord.hpp"
namespace djinni_generated { namespace djinni_generated {
NativeClientInterface::NativeClientInterface() : djinni::JniInterface<::ClientInterface, NativeClientInterface>() {} NativeClientInterface::NativeClientInterface() : ::djinni::JniInterface<::ClientInterface, NativeClientInterface>() {}
NativeClientInterface::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {} NativeClientInterface::~NativeClientInterface() = default;
::ClientReturnedRecord NativeClientInterface::JavaProxy::JavaProxy::get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) { NativeClientInterface::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j) { }
JNIEnv * const jniEnv = djinni::jniGetThreadEnv();
djinni::JniLocalScope jscope(jniEnv, 10); NativeClientInterface::JavaProxy::~JavaProxy() = default;
jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c_record_id);
djinni::LocalRef<jstring> j_utf8string(jniEnv, ::djinni::HString::toJava(jniEnv, c_utf8string)); ::ClientReturnedRecord NativeClientInterface::JavaProxy::get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) {
djinni::LocalRef<jstring> j_misc(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HString>::toJava(jniEnv, c_misc)); auto jniEnv = ::djinni::jniGetThreadEnv();
const auto & data = djinni::JniClass<::djinni_generated::NativeClientInterface>::get(); ::djinni::JniLocalScope jscope(jniEnv, 10);
djinni::LocalRef<jobject> jret(jniEnv, jniEnv->CallObjectMethod(getGlobalRef(), data.method_getRecord, j_record_id, j_utf8string.get(), j_misc.get())); const auto& data = ::djinni::JniClass<::djinni_generated::NativeClientInterface>::get();
djinni::jniExceptionCheck(jniEnv); auto jret = jniEnv->CallObjectMethod(getGlobalRef(), data.method_getRecord,
return NativeClientReturnedRecord::fromJava(jniEnv, jret.get()); ::djinni::I64::fromCpp(jniEnv, record_id),
}; ::djinni::String::fromCpp(jniEnv, utf8string).get(),
::djinni::Optional<std::experimental::optional, ::djinni::String>::fromCpp(jniEnv, misc).get());
::djinni::jniExceptionCheck(jniEnv);
return ::djinni_generated::NativeClientReturnedRecord::toCpp(jniEnv, jret);
}
} // namespace djinni_generated } // namespace djinni_generated
...@@ -8,31 +8,39 @@ ...@@ -8,31 +8,39 @@
namespace djinni_generated { namespace djinni_generated {
class NativeClientInterface final : djinni::JniInterface<::ClientInterface, NativeClientInterface> { class NativeClientInterface final : ::djinni::JniInterface<::ClientInterface, NativeClientInterface> {
public: public:
using CppType = std::shared_ptr<::ClientInterface>; using CppType = std::shared_ptr<::ClientInterface>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::ClientInterface> c) { return djinni::JniClass<::djinni_generated::NativeClientInterface>::get()._toJava(jniEnv, c); } using Boxed = NativeClientInterface;
static std::shared_ptr<::ClientInterface> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeClientInterface>::get()._fromJava(jniEnv, j); }
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientInterface") }; ~NativeClientInterface();
const jmethodID method_getRecord { djinni::jniGetMethodID(clazz.get(), "getRecord", "(JLjava/lang/String;Ljava/lang/String;)Lcom/dropbox/djinni/test/ClientReturnedRecord;") };
class JavaProxy final : djinni::JavaProxyCacheEntry, public ::ClientInterface { static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeClientInterface>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeClientInterface>::get()._toJava(jniEnv, c)}; }
private:
NativeClientInterface();
friend ::djinni::JniClass<NativeClientInterface>;
friend ::djinni::JniInterface<::ClientInterface, NativeClientInterface>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::ClientInterface
{
public: public:
JavaProxy(jobject obj); JavaProxy(JniType j);
virtual ::ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) override; ~JavaProxy();
::ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) override;
private: private:
using djinni::JavaProxyCacheEntry::getGlobalRef; using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend class djinni::JniInterface<::ClientInterface, ::djinni_generated::NativeClientInterface>; friend ::djinni::JniInterface<::ClientInterface, ::djinni_generated::NativeClientInterface>;
friend class djinni::JavaProxyCache<JavaProxy>; friend ::djinni::JavaProxyCache<JavaProxy>;
}; };
private: const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/ClientInterface") };
NativeClientInterface(); const jmethodID method_getRecord { ::djinni::jniGetMethodID(clazz.get(), "getRecord", "(JLjava/lang/String;Ljava/lang/String;)Lcom/dropbox/djinni/test/ClientReturnedRecord;") };
friend class djinni::JniClass<::djinni_generated::NativeClientInterface>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,29 +2,30 @@ ...@@ -2,29 +2,30 @@
// This file generated by Djinni from client_interface.djinni // This file generated by Djinni from client_interface.djinni
#include "NativeClientReturnedRecord.hpp" // my header #include "NativeClientReturnedRecord.hpp" // my header
#include "HI64.hpp" #include "Marshal.hpp"
#include "HOptional.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ::ClientReturnedRecord c) { NativeClientReturnedRecord::NativeClientReturnedRecord() = default;
jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c.record_id);
djinni::LocalRef<jstring> j_content(jniEnv, ::djinni::HString::toJava(jniEnv, c.content)); NativeClientReturnedRecord::~NativeClientReturnedRecord() = default;
djinni::LocalRef<jstring> j_misc(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HString>::toJava(jniEnv, c.misc));
const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get(); auto NativeClientReturnedRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_record_id, j_content.get(), j_misc.get()); const auto& data = ::djinni::JniClass<NativeClientReturnedRecord>::get();
djinni::jniExceptionCheck(jniEnv); auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::I64::fromCpp(jniEnv, c.record_id),
::djinni::String::fromCpp(jniEnv, c.content).get(),
::djinni::Optional<std::experimental::optional, ::djinni::String>::fromCpp(jniEnv, c.misc).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::ClientReturnedRecord NativeClientReturnedRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeClientReturnedRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get(); const auto& data = ::djinni::JniClass<NativeClientReturnedRecord>::get();
return ::ClientReturnedRecord( return {::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mRecordId)),
::djinni::HI64::Unboxed::fromJava(jniEnv, jniEnv->GetLongField(j, data.field_mRecordId)), ::djinni::String::toCpp(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mContent))),
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mContent))).get()), ::djinni::Optional<std::experimental::optional, ::djinni::String>::toCpp(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mMisc)))};
::djinni::HOptional<std::experimental::optional, ::djinni::HString>::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mMisc))).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,18 +13,22 @@ public: ...@@ -13,18 +13,22 @@ public:
using CppType = ::ClientReturnedRecord; using CppType = ::ClientReturnedRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::ClientReturnedRecord); using Boxed = NativeClientReturnedRecord;
static ::ClientReturnedRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientReturnedRecord") }; ~NativeClientReturnedRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(JLjava/lang/String;Ljava/lang/String;)V") };
const jfieldID field_mRecordId { djinni::jniGetFieldID(clazz.get(), "mRecordId", "J") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
const jfieldID field_mContent { djinni::jniGetFieldID(clazz.get(), "mContent", "Ljava/lang/String;") }; static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
const jfieldID field_mMisc { djinni::jniGetFieldID(clazz.get(), "mMisc", "Ljava/lang/String;") };
private: private:
NativeClientReturnedRecord() {} NativeClientReturnedRecord();
friend class djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>; friend ::djinni::JniClass<NativeClientReturnedRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/ClientReturnedRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(JLjava/lang/String;Ljava/lang/String;)V") };
const jfieldID field_mRecordId { ::djinni::jniGetFieldID(clazz.get(), "mRecordId", "J") };
const jfieldID field_mContent { ::djinni::jniGetFieldID(clazz.get(), "mContent", "Ljava/lang/String;") };
const jfieldID field_mMisc { ::djinni::jniGetFieldID(clazz.get(), "mMisc", "Ljava/lang/String;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -8,17 +8,19 @@ ...@@ -8,17 +8,19 @@
namespace djinni_generated { namespace djinni_generated {
class NativeColor final : djinni::JniEnum { class NativeColor final : ::djinni::JniEnum {
public: public:
using CppType = ::color; using CppType = ::color;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, ::color c) { return djinni::JniClass<NativeColor>::get().create(jniEnv, static_cast<int>(c)).release(); } using Boxed = NativeColor;
static ::color fromJava(JNIEnv* jniEnv, jobject j) { return static_cast<::color>(djinni::JniClass<NativeColor>::get().ordinal(jniEnv, j)); }
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeColor>::get().ordinal(jniEnv, j)); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeColor>::get().create(jniEnv, static_cast<jint>(c)); }
private: private:
NativeColor() : JniEnum("com/dropbox/djinni/test/Color") {} NativeColor() : JniEnum("com/dropbox/djinni/test/Color") {}
friend class djinni::JniClass<NativeColor>; friend ::djinni::JniClass<NativeColor>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,26 +2,28 @@ ...@@ -2,26 +2,28 @@
// This file generated by Djinni from constants.djinni // This file generated by Djinni from constants.djinni
#include "NativeConstants.hpp" // my header #include "NativeConstants.hpp" // my header
#include "HI32.hpp" #include "Marshal.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeConstants::toJava(JNIEnv* jniEnv, ::Constants c) { NativeConstants::NativeConstants() = default;
jint j_some_integer = ::djinni::HI32::Unboxed::toJava(jniEnv, c.some_integer);
djinni::LocalRef<jstring> j_some_string(jniEnv, ::djinni::HString::toJava(jniEnv, c.some_string)); NativeConstants::~NativeConstants() = default;
const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_some_integer, j_some_string.get()); auto NativeConstants::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
djinni::jniExceptionCheck(jniEnv); const auto& data = ::djinni::JniClass<NativeConstants>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::I32::fromCpp(jniEnv, c.some_integer),
::djinni::String::fromCpp(jniEnv, c.some_string).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::Constants NativeConstants::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeConstants::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get(); const auto& data = ::djinni::JniClass<NativeConstants>::get();
return ::Constants( return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mSomeInteger)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mSomeInteger)), ::djinni::String::toCpp(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mSomeString)))};
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mSomeString))).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,17 +13,21 @@ public: ...@@ -13,17 +13,21 @@ public:
using CppType = ::Constants; using CppType = ::Constants;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::Constants); using Boxed = NativeConstants;
static ::Constants fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/Constants") }; ~NativeConstants();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
const jfieldID field_mSomeInteger { djinni::jniGetFieldID(clazz.get(), "mSomeInteger", "I") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
const jfieldID field_mSomeString { djinni::jniGetFieldID(clazz.get(), "mSomeString", "Ljava/lang/String;") }; static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeConstants() {} NativeConstants();
friend class djinni::JniClass<::djinni_generated::NativeConstants>; friend ::djinni::JniClass<NativeConstants>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/Constants") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
const jfieldID field_mSomeInteger { ::djinni::jniGetFieldID(clazz.get(), "mSomeInteger", "I") };
const jfieldID field_mSomeString { ::djinni::jniGetFieldID(clazz.get(), "mSomeString", "Ljava/lang/String;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,14 +2,15 @@ ...@@ -2,14 +2,15 @@
// This file generated by Djinni from exception.djinni // This file generated by Djinni from exception.djinni
#include "NativeCppException.hpp" // my header #include "NativeCppException.hpp" // my header
#include "HI32.hpp" #include "Marshal.hpp"
#include "NativeCppException.hpp" #include "NativeCppException.hpp"
namespace djinni_generated { namespace djinni_generated {
NativeCppException::NativeCppException() : djinni::JniInterface<::CppException, NativeCppException>("com/dropbox/djinni/test/CppException$CppProxy") {} NativeCppException::NativeCppException() : ::djinni::JniInterface<::CppException, NativeCppException>("com/dropbox/djinni/test/CppException$CppProxy") {}
NativeCppException::~NativeCppException() = default;
using namespace ::djinni_generated;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{ {
...@@ -23,11 +24,9 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_ ...@@ -23,11 +24,9 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const std::shared_ptr<::CppException> & ref = djinni::CppProxyHandle<::CppException>::get(nativeRef); const auto& ref = ::djinni::CppProxyHandle<::CppException>::get(nativeRef);
auto r = ref->throw_an_exception();
int32_t cr = ref->throw_an_exception(); return ::djinni::I32::fromCpp(jniEnv, r);
return ::djinni::HI32::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
} }
...@@ -35,10 +34,8 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv* ...@@ -35,10 +34,8 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv*
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv); DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::CppException::get();
std::shared_ptr<::CppException> cr = ::CppException::get(); return ::djinni_generated::NativeCppException::fromCpp(jniEnv, r).release();
return NativeCppException::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
} }
......
...@@ -8,18 +8,23 @@ ...@@ -8,18 +8,23 @@
namespace djinni_generated { namespace djinni_generated {
class NativeCppException final : djinni::JniInterface<::CppException, NativeCppException> { class NativeCppException final : ::djinni::JniInterface<::CppException, NativeCppException> {
public: public:
using CppType = std::shared_ptr<::CppException>; using CppType = std::shared_ptr<::CppException>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::CppException> c) { return djinni::JniClass<::djinni_generated::NativeCppException>::get()._toJava(jniEnv, c); } using Boxed = NativeCppException;
static std::shared_ptr<::CppException> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeCppException>::get()._fromJava(jniEnv, j); }
~NativeCppException();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeCppException>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeCppException>::get()._toJava(jniEnv, c)}; }
private: private:
NativeCppException(); NativeCppException();
friend class djinni::JniClass<::djinni_generated::NativeCppException>; friend ::djinni::JniClass<NativeCppException>;
friend ::djinni::JniInterface<::CppException, NativeCppException>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,23 +2,26 @@ ...@@ -2,23 +2,26 @@
// This file generated by Djinni from date.djinni // This file generated by Djinni from date.djinni
#include "NativeDateRecord.hpp" // my header #include "NativeDateRecord.hpp" // my header
#include "HDate.hpp" #include "Marshal.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeDateRecord::toJava(JNIEnv* jniEnv, ::DateRecord c) { NativeDateRecord::NativeDateRecord() = default;
djinni::LocalRef<jobject> j_created_at(jniEnv, ::djinni::HDate::toJava(jniEnv, c.created_at));
const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get(); NativeDateRecord::~NativeDateRecord() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_created_at.get());
djinni::jniExceptionCheck(jniEnv); auto NativeDateRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeDateRecord>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::Date::fromCpp(jniEnv, c.created_at).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::DateRecord NativeDateRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeDateRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get(); const auto& data = ::djinni::JniClass<NativeDateRecord>::get();
return ::DateRecord( return {::djinni::Date::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mCreatedAt))};
::djinni::HDate::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mCreatedAt)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::DateRecord; using CppType = ::DateRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::DateRecord); using Boxed = NativeDateRecord;
static ::DateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/DateRecord") }; ~NativeDateRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/Date;)V") };
const jfieldID field_mCreatedAt { djinni::jniGetFieldID(clazz.get(), "mCreatedAt", "Ljava/util/Date;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeDateRecord() {} NativeDateRecord();
friend class djinni::JniClass<::djinni_generated::NativeDateRecord>; friend ::djinni::JniClass<NativeDateRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/DateRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/Date;)V") };
const jfieldID field_mCreatedAt { ::djinni::jniGetFieldID(clazz.get(), "mCreatedAt", "Ljava/util/Date;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,25 +2,26 @@ ...@@ -2,25 +2,26 @@
// This file generated by Djinni from date.djinni // This file generated by Djinni from date.djinni
#include "NativeMapDateRecord.hpp" // my header #include "NativeMapDateRecord.hpp" // my header
#include "HDate.hpp" #include "Marshal.hpp"
#include "HMap.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapDateRecord::toJava(JNIEnv* jniEnv, ::MapDateRecord c) { NativeMapDateRecord::NativeMapDateRecord() = default;
djinni::LocalRef<jobject> j_dates_by_id(jniEnv, ::djinni::HMap<::djinni::HString, ::djinni::HDate>::toJava(jniEnv, c.dates_by_id));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::get(); NativeMapDateRecord::~NativeMapDateRecord() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_dates_by_id.get());
djinni::jniExceptionCheck(jniEnv); auto NativeMapDateRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeMapDateRecord>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::Map<::djinni::String, ::djinni::Date>::fromCpp(jniEnv, c.dates_by_id).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::MapDateRecord NativeMapDateRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeMapDateRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::get(); const auto& data = ::djinni::JniClass<NativeMapDateRecord>::get();
return ::MapDateRecord( return {::djinni::Map<::djinni::String, ::djinni::Date>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mDatesById))};
::djinni::HMap<::djinni::HString, ::djinni::HDate>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mDatesById)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::MapDateRecord; using CppType = ::MapDateRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::MapDateRecord); using Boxed = NativeMapDateRecord;
static ::MapDateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapDateRecord") }; ~NativeMapDateRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
const jfieldID field_mDatesById { djinni::jniGetFieldID(clazz.get(), "mDatesById", "Ljava/util/HashMap;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeMapDateRecord() {} NativeMapDateRecord();
friend class djinni::JniClass<::djinni_generated::NativeMapDateRecord>; friend ::djinni::JniClass<NativeMapDateRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/MapDateRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
const jfieldID field_mDatesById { ::djinni::jniGetFieldID(clazz.get(), "mDatesById", "Ljava/util/HashMap;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,26 +2,26 @@ ...@@ -2,26 +2,26 @@
// This file generated by Djinni from map.djinni // This file generated by Djinni from map.djinni
#include "NativeMapListRecord.hpp" // my header #include "NativeMapListRecord.hpp" // my header
#include "HI64.hpp" #include "Marshal.hpp"
#include "HList.hpp"
#include "HMap.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapListRecord::toJava(JNIEnv* jniEnv, ::MapListRecord c) { NativeMapListRecord::NativeMapListRecord() = default;
djinni::LocalRef<jobject> j_map_list(jniEnv, ::djinni::HList<::djinni::HMap<::djinni::HString, ::djinni::HI64>>::toJava(jniEnv, c.map_list));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::get(); NativeMapListRecord::~NativeMapListRecord() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map_list.get());
djinni::jniExceptionCheck(jniEnv); auto NativeMapListRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeMapListRecord>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::List<::djinni::Map<::djinni::String, ::djinni::I64>>::fromCpp(jniEnv, c.map_list).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::MapListRecord NativeMapListRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeMapListRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::get(); const auto& data = ::djinni::JniClass<NativeMapListRecord>::get();
return ::MapListRecord( return {::djinni::List<::djinni::Map<::djinni::String, ::djinni::I64>>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mMapList))};
::djinni::HList<::djinni::HMap<::djinni::HString, ::djinni::HI64>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMapList)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::MapListRecord; using CppType = ::MapListRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::MapListRecord); using Boxed = NativeMapListRecord;
static ::MapListRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapListRecord") }; ~NativeMapListRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mMapList { djinni::jniGetFieldID(clazz.get(), "mMapList", "Ljava/util/ArrayList;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeMapListRecord() {} NativeMapListRecord();
friend class djinni::JniClass<::djinni_generated::NativeMapListRecord>; friend ::djinni::JniClass<NativeMapListRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/MapListRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mMapList { ::djinni::jniGetFieldID(clazz.get(), "mMapList", "Ljava/util/ArrayList;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,25 +2,26 @@ ...@@ -2,25 +2,26 @@
// This file generated by Djinni from map.djinni // This file generated by Djinni from map.djinni
#include "NativeMapRecord.hpp" // my header #include "NativeMapRecord.hpp" // my header
#include "HI64.hpp" #include "Marshal.hpp"
#include "HMap.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapRecord::toJava(JNIEnv* jniEnv, ::MapRecord c) { NativeMapRecord::NativeMapRecord() = default;
djinni::LocalRef<jobject> j_map(jniEnv, ::djinni::HMap<::djinni::HString, ::djinni::HI64>::toJava(jniEnv, c.map));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get(); NativeMapRecord::~NativeMapRecord() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map.get());
djinni::jniExceptionCheck(jniEnv); auto NativeMapRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeMapRecord>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::Map<::djinni::String, ::djinni::I64>::fromCpp(jniEnv, c.map).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::MapRecord NativeMapRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeMapRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get(); const auto& data = ::djinni::JniClass<NativeMapRecord>::get();
return ::MapRecord( return {::djinni::Map<::djinni::String, ::djinni::I64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mMap))};
::djinni::HMap<::djinni::HString, ::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMap)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::MapRecord; using CppType = ::MapRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::MapRecord); using Boxed = NativeMapRecord;
static ::MapRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapRecord") }; ~NativeMapRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
const jfieldID field_mMap { djinni::jniGetFieldID(clazz.get(), "mMap", "Ljava/util/HashMap;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeMapRecord() {} NativeMapRecord();
friend class djinni::JniClass<::djinni_generated::NativeMapRecord>; friend ::djinni::JniClass<NativeMapRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/MapRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
const jfieldID field_mMap { ::djinni::jniGetFieldID(clazz.get(), "mMap", "Ljava/util/HashMap;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,25 +2,26 @@ ...@@ -2,25 +2,26 @@
// This file generated by Djinni from nested_collection.djinni // This file generated by Djinni from nested_collection.djinni
#include "NativeNestedCollection.hpp" // my header #include "NativeNestedCollection.hpp" // my header
#include "HList.hpp" #include "Marshal.hpp"
#include "HSet.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeNestedCollection::toJava(JNIEnv* jniEnv, ::NestedCollection c) { NativeNestedCollection::NativeNestedCollection() = default;
djinni::LocalRef<jobject> j_set_list(jniEnv, ::djinni::HList<::djinni::HSet<::djinni::HString>>::toJava(jniEnv, c.set_list));
const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::get(); NativeNestedCollection::~NativeNestedCollection() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set_list.get());
djinni::jniExceptionCheck(jniEnv); auto NativeNestedCollection::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeNestedCollection>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::List<::djinni::Set<::djinni::String>>::fromCpp(jniEnv, c.set_list).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::NestedCollection NativeNestedCollection::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeNestedCollection::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::get(); const auto& data = ::djinni::JniClass<NativeNestedCollection>::get();
return ::NestedCollection( return {::djinni::List<::djinni::Set<::djinni::String>>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mSetList))};
::djinni::HList<::djinni::HSet<::djinni::HString>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSetList)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::NestedCollection; using CppType = ::NestedCollection;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::NestedCollection); using Boxed = NativeNestedCollection;
static ::NestedCollection fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/NestedCollection") }; ~NativeNestedCollection();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mSetList { djinni::jniGetFieldID(clazz.get(), "mSetList", "Ljava/util/ArrayList;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeNestedCollection() {} NativeNestedCollection();
friend class djinni::JniClass<::djinni_generated::NativeNestedCollection>; friend ::djinni::JniClass<NativeNestedCollection>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/NestedCollection") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mSetList { ::djinni::jniGetFieldID(clazz.get(), "mSetList", "Ljava/util/ArrayList;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
// This file generated by Djinni from primitive_list.djinni // This file generated by Djinni from primitive_list.djinni
#include "NativePrimitiveList.hpp" // my header #include "NativePrimitiveList.hpp" // my header
#include "HI64.hpp" #include "Marshal.hpp"
#include "HList.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, ::PrimitiveList c) { NativePrimitiveList::NativePrimitiveList() = default;
djinni::LocalRef<jobject> j_list(jniEnv, ::djinni::HList<::djinni::HI64>::toJava(jniEnv, c.list));
const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get(); NativePrimitiveList::~NativePrimitiveList() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_list.get());
djinni::jniExceptionCheck(jniEnv); auto NativePrimitiveList::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativePrimitiveList>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::List<::djinni::I64>::fromCpp(jniEnv, c.list).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::PrimitiveList NativePrimitiveList::fromJava(JNIEnv* jniEnv, jobject j) { auto NativePrimitiveList::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get(); const auto& data = ::djinni::JniClass<NativePrimitiveList>::get();
return ::PrimitiveList( return {::djinni::List<::djinni::I64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mList))};
::djinni::HList<::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mList)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::PrimitiveList; using CppType = ::PrimitiveList;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::PrimitiveList); using Boxed = NativePrimitiveList;
static ::PrimitiveList fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/PrimitiveList") }; ~NativePrimitiveList();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mList { djinni::jniGetFieldID(clazz.get(), "mList", "Ljava/util/ArrayList;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativePrimitiveList() {} NativePrimitiveList();
friend class djinni::JniClass<::djinni_generated::NativePrimitiveList>; friend ::djinni::JniClass<NativePrimitiveList>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/PrimitiveList") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
const jfieldID field_mList { ::djinni::jniGetFieldID(clazz.get(), "mList", "Ljava/util/ArrayList;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,26 +2,28 @@ ...@@ -2,26 +2,28 @@
// This file generated by Djinni from derivings.djinni // This file generated by Djinni from derivings.djinni
#include "NativeRecordWithDerivings.hpp" // my header #include "NativeRecordWithDerivings.hpp" // my header
#include "HI32.hpp" #include "Marshal.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, ::RecordWithDerivings c) { NativeRecordWithDerivings::NativeRecordWithDerivings() = default;
jint j_key1 = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key1);
djinni::LocalRef<jstring> j_key2(jniEnv, ::djinni::HString::toJava(jniEnv, c.key2)); NativeRecordWithDerivings::~NativeRecordWithDerivings() = default;
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_key1, j_key2.get()); auto NativeRecordWithDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
djinni::jniExceptionCheck(jniEnv); const auto& data = ::djinni::JniClass<NativeRecordWithDerivings>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::I32::fromCpp(jniEnv, c.key1),
::djinni::String::fromCpp(jniEnv, c.key2).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::RecordWithDerivings NativeRecordWithDerivings::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeRecordWithDerivings::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get(); const auto& data = ::djinni::JniClass<NativeRecordWithDerivings>::get();
return ::RecordWithDerivings( return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mKey1)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey1)), ::djinni::String::toCpp(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mKey2)))};
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mKey2))).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,17 +13,21 @@ public: ...@@ -13,17 +13,21 @@ public:
using CppType = ::RecordWithDerivings; using CppType = ::RecordWithDerivings;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::RecordWithDerivings); using Boxed = NativeRecordWithDerivings;
static ::RecordWithDerivings fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/RecordWithDerivings") }; ~NativeRecordWithDerivings();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
const jfieldID field_mKey1 { djinni::jniGetFieldID(clazz.get(), "mKey1", "I") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
const jfieldID field_mKey2 { djinni::jniGetFieldID(clazz.get(), "mKey2", "Ljava/lang/String;") }; static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeRecordWithDerivings() {} NativeRecordWithDerivings();
friend class djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>; friend ::djinni::JniClass<NativeRecordWithDerivings>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/RecordWithDerivings") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
const jfieldID field_mKey1 { ::djinni::jniGetFieldID(clazz.get(), "mKey1", "I") };
const jfieldID field_mKey2 { ::djinni::jniGetFieldID(clazz.get(), "mKey2", "Ljava/lang/String;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,26 +2,29 @@ ...@@ -2,26 +2,29 @@
// This file generated by Djinni from derivings.djinni // This file generated by Djinni from derivings.djinni
#include "NativeRecordWithNestedDerivings.hpp" // my header #include "NativeRecordWithNestedDerivings.hpp" // my header
#include "HI32.hpp" #include "Marshal.hpp"
#include "NativeRecordWithDerivings.hpp" #include "NativeRecordWithDerivings.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, ::RecordWithNestedDerivings c) { NativeRecordWithNestedDerivings::NativeRecordWithNestedDerivings() = default;
jint j_key = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key);
djinni::LocalRef<jobject> j_rec(jniEnv, NativeRecordWithDerivings::toJava(jniEnv, c.rec)); NativeRecordWithNestedDerivings::~NativeRecordWithNestedDerivings() = default;
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_key, j_rec.get()); auto NativeRecordWithNestedDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
djinni::jniExceptionCheck(jniEnv); const auto& data = ::djinni::JniClass<NativeRecordWithNestedDerivings>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::I32::fromCpp(jniEnv, c.key),
::djinni_generated::NativeRecordWithDerivings::fromCpp(jniEnv, c.rec).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::RecordWithNestedDerivings NativeRecordWithNestedDerivings::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeRecordWithNestedDerivings::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get(); const auto& data = ::djinni::JniClass<NativeRecordWithNestedDerivings>::get();
return ::RecordWithNestedDerivings( return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mKey)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey)), ::djinni_generated::NativeRecordWithDerivings::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mRec))};
NativeRecordWithDerivings::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mRec)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,17 +13,21 @@ public: ...@@ -13,17 +13,21 @@ public:
using CppType = ::RecordWithNestedDerivings; using CppType = ::RecordWithNestedDerivings;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::RecordWithNestedDerivings); using Boxed = NativeRecordWithNestedDerivings;
static ::RecordWithNestedDerivings fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/RecordWithNestedDerivings") }; ~NativeRecordWithNestedDerivings();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILcom/dropbox/djinni/test/RecordWithDerivings;)V") };
const jfieldID field_mKey { djinni::jniGetFieldID(clazz.get(), "mKey", "I") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
const jfieldID field_mRec { djinni::jniGetFieldID(clazz.get(), "mRec", "Lcom/dropbox/djinni/test/RecordWithDerivings;") }; static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeRecordWithNestedDerivings() {} NativeRecordWithNestedDerivings();
friend class djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>; friend ::djinni::JniClass<NativeRecordWithNestedDerivings>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/RecordWithNestedDerivings") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(ILcom/dropbox/djinni/test/RecordWithDerivings;)V") };
const jfieldID field_mKey { ::djinni::jniGetFieldID(clazz.get(), "mKey", "I") };
const jfieldID field_mRec { ::djinni::jniGetFieldID(clazz.get(), "mRec", "Lcom/dropbox/djinni/test/RecordWithDerivings;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
// This file generated by Djinni from set.djinni // This file generated by Djinni from set.djinni
#include "NativeSetRecord.hpp" // my header #include "NativeSetRecord.hpp" // my header
#include "HSet.hpp" #include "Marshal.hpp"
#include "HString.hpp"
namespace djinni_generated { namespace djinni_generated {
jobject NativeSetRecord::toJava(JNIEnv* jniEnv, ::SetRecord c) { NativeSetRecord::NativeSetRecord() = default;
djinni::LocalRef<jobject> j_set(jniEnv, ::djinni::HSet<::djinni::HString>::toJava(jniEnv, c.set));
const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get(); NativeSetRecord::~NativeSetRecord() = default;
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set.get());
djinni::jniExceptionCheck(jniEnv); auto NativeSetRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeSetRecord>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::Set<::djinni::String>::fromCpp(jniEnv, c.set).get())};
::djinni::jniExceptionCheck(jniEnv);
return r; return r;
} }
::SetRecord NativeSetRecord::fromJava(JNIEnv* jniEnv, jobject j) { auto NativeSetRecord::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get(); const auto& data = ::djinni::JniClass<NativeSetRecord>::get();
return ::SetRecord( return {::djinni::Set<::djinni::String>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mSet))};
::djinni::HSet<::djinni::HString>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSet)).get()));
} }
} // namespace djinni_generated } // namespace djinni_generated
...@@ -13,16 +13,20 @@ public: ...@@ -13,16 +13,20 @@ public:
using CppType = ::SetRecord; using CppType = ::SetRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ::SetRecord); using Boxed = NativeSetRecord;
static ::SetRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/SetRecord") }; ~NativeSetRecord();
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashSet;)V") };
const jfieldID field_mSet { djinni::jniGetFieldID(clazz.get(), "mSet", "Ljava/util/HashSet;") }; static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private: private:
NativeSetRecord() {} NativeSetRecord();
friend class djinni::JniClass<::djinni_generated::NativeSetRecord>; friend ::djinni::JniClass<NativeSetRecord>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/SetRecord") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashSet;)V") };
const jfieldID field_mSet { ::djinni::jniGetFieldID(clazz.get(), "mSet", "Ljava/util/HashSet;") };
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -8,18 +8,23 @@ ...@@ -8,18 +8,23 @@
namespace djinni_generated { namespace djinni_generated {
class NativeTestHelpers final : djinni::JniInterface<::TestHelpers, NativeTestHelpers> { class NativeTestHelpers final : ::djinni::JniInterface<::TestHelpers, NativeTestHelpers> {
public: public:
using CppType = std::shared_ptr<::TestHelpers>; using CppType = std::shared_ptr<::TestHelpers>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::TestHelpers> c) { return djinni::JniClass<::djinni_generated::NativeTestHelpers>::get()._toJava(jniEnv, c); } using Boxed = NativeTestHelpers;
static std::shared_ptr<::TestHelpers> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeTestHelpers>::get()._fromJava(jniEnv, j); }
~NativeTestHelpers();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeTestHelpers>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeTestHelpers>::get()._toJava(jniEnv, c)}; }
private: private:
NativeTestHelpers(); NativeTestHelpers();
friend class djinni::JniClass<::djinni_generated::NativeTestHelpers>; friend ::djinni::JniClass<NativeTestHelpers>;
friend ::djinni::JniInterface<::TestHelpers, NativeTestHelpers>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
...@@ -5,10 +5,14 @@ ...@@ -5,10 +5,14 @@
namespace djinni_generated { namespace djinni_generated {
NativeToken::NativeToken() : djinni::JniInterface<::Token, NativeToken>("com/dropbox/djinni/test/Token$CppProxy") {} NativeToken::NativeToken() : ::djinni::JniInterface<::Token, NativeToken>("com/dropbox/djinni/test/Token$CppProxy") {}
NativeToken::~NativeToken() = default;
NativeToken::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j) { }
NativeToken::JavaProxy::~JavaProxy() = default;
NativeToken::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {}
using namespace ::djinni_generated;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Token_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Token_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{ {
......
...@@ -8,29 +8,37 @@ ...@@ -8,29 +8,37 @@
namespace djinni_generated { namespace djinni_generated {
class NativeToken final : djinni::JniInterface<::Token, NativeToken> { class NativeToken final : ::djinni::JniInterface<::Token, NativeToken> {
public: public:
using CppType = std::shared_ptr<::Token>; using CppType = std::shared_ptr<::Token>;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::Token> c) { return djinni::JniClass<::djinni_generated::NativeToken>::get()._toJava(jniEnv, c); } using Boxed = NativeToken;
static std::shared_ptr<::Token> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeToken>::get()._fromJava(jniEnv, j); }
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/Token") }; ~NativeToken();
class JavaProxy final : djinni::JavaProxyCacheEntry, public ::Token { static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeToken>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeToken>::get()._toJava(jniEnv, c)}; }
private:
NativeToken();
friend ::djinni::JniClass<NativeToken>;
friend ::djinni::JniInterface<::Token, NativeToken>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::Token
{
public: public:
JavaProxy(jobject obj); JavaProxy(JniType j);
~JavaProxy();
private: private:
using djinni::JavaProxyCacheEntry::getGlobalRef; using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend class djinni::JniInterface<::Token, ::djinni_generated::NativeToken>; friend ::djinni::JniInterface<::Token, ::djinni_generated::NativeToken>;
friend class djinni::JavaProxyCache<JavaProxy>; friend ::djinni::JavaProxyCache<JavaProxy>;
}; };
private: const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/Token") };
NativeToken();
friend class djinni::JniClass<::djinni_generated::NativeToken>;
}; };
} // namespace djinni_generated } // namespace djinni_generated
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment