Commit 30e73aeb authored by Jacob Potter's avatar Jacob Potter

Fix namespace handling

Previously we didn't properly distinguish between declarations in the root namespace (::foo)
and unqualified declarations (foo).
parent 6b35e333
...@@ -105,7 +105,7 @@ class CppGenerator(spec: Spec) extends Generator(spec) { ...@@ -105,7 +105,7 @@ class CppGenerator(spec: Spec) extends Generator(spec) {
if (spec.cppEnumHashWorkaround) { if (spec.cppEnumHashWorkaround) {
val fqSelf = marshal.fqTypename(ident, e) val fqSelf = marshal.fqTypename(ident, e)
w.wl w.wl
wrapNamespace(w, Some("std"), wrapNamespace(w, "std",
(w: IndentWriter) => { (w: IndentWriter) => {
w.wl("template <>") w.wl("template <>")
w.w(s"struct hash<$fqSelf>").bracedSemi { w.w(s"struct hash<$fqSelf>").bracedSemi {
......
...@@ -13,18 +13,18 @@ class CppMarshal(spec: Spec) extends Marshal(spec) { ...@@ -13,18 +13,18 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
case r: Record => idCpp.ty(name) case r: Record => idCpp.ty(name)
} }
override def fqTypename(tm: MExpr): String = toCppType(tm, spec.cppNamespace) override def fqTypename(tm: MExpr): String = toCppType(tm, Some(spec.cppNamespace))
def fqTypename(name: String, ty: TypeDef): String = ty match { def fqTypename(name: String, ty: TypeDef): String = ty match {
case e: Enum => withNs(spec.cppNamespace, idCpp.enumType(name)) case e: Enum => withNs(Some(spec.cppNamespace), idCpp.enumType(name))
case i: Interface => withNs(spec.cppNamespace, idCpp.ty(name)) case i: Interface => withNs(Some(spec.cppNamespace), idCpp.ty(name))
case r: Record => withNs(spec.cppNamespace, idCpp.ty(name)) case r: Record => withNs(Some(spec.cppNamespace), idCpp.ty(name))
} }
override def paramType(tm: MExpr): String = toCppParamType(tm) override def paramType(tm: MExpr): String = toCppParamType(tm)
override def fqParamType(tm: MExpr): String = toCppParamType(tm, spec.cppNamespace) override def fqParamType(tm: MExpr): String = toCppParamType(tm, Some(spec.cppNamespace))
override def returnType(ret: Option[TypeRef]): String = ret.fold("void")(toCppType(_, None)) override def returnType(ret: Option[TypeRef]): String = ret.fold("void")(toCppType(_, None))
override def fqReturnType(ret: Option[TypeRef]): String = ret.fold("void")(toCppType(_, spec.cppNamespace)) override def fqReturnType(ret: Option[TypeRef]): String = ret.fold("void")(toCppType(_, Some(spec.cppNamespace)))
override def fieldType(tm: MExpr): String = typename(tm) override def fieldType(tm: MExpr): String = typename(tm)
override def fqFieldType(tm: MExpr): String = fqTypename(tm) override def fqFieldType(tm: MExpr): String = fqTypename(tm)
......
...@@ -31,9 +31,9 @@ class JNIGenerator(spec: Spec) extends Generator(spec) { ...@@ -31,9 +31,9 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
val jniBaseLibClassIdentStyle = IdentStyle.prefix("H", IdentStyle.camelUpper) val jniBaseLibClassIdentStyle = IdentStyle.prefix("H", IdentStyle.camelUpper)
val jniBaseLibFileIdentStyle = jniBaseLibClassIdentStyle val jniBaseLibFileIdentStyle = jniBaseLibClassIdentStyle
val writeJniCppFile = writeCppFileGeneric(spec.jniOutFolder.get, Some(spec.jniNamespace), spec.jniFileIdentStyle, spec.jniIncludePrefix) _ val writeJniCppFile = writeCppFileGeneric(spec.jniOutFolder.get, spec.jniNamespace, spec.jniFileIdentStyle, spec.jniIncludePrefix) _
def writeJniHppFile(name: String, origin: String, includes: Iterable[String], fwds: Iterable[String], f: IndentWriter => Unit, f2: IndentWriter => Unit = (w => {})) = def writeJniHppFile(name: String, origin: String, includes: Iterable[String], fwds: Iterable[String], f: IndentWriter => Unit, f2: IndentWriter => Unit = (w => {})) =
writeHppFileGeneric(spec.jniHeaderOutFolder.get, Some(spec.jniNamespace), spec.jniFileIdentStyle)(name, origin, includes, fwds, f, f2) writeHppFileGeneric(spec.jniHeaderOutFolder.get, spec.jniNamespace, spec.jniFileIdentStyle)(name, origin, includes, fwds, f, f2)
class JNIRefs(name: String) { class JNIRefs(name: String) {
var jniHpp = mutable.TreeSet[String]() var jniHpp = mutable.TreeSet[String]()
......
...@@ -25,7 +25,7 @@ object Main { ...@@ -25,7 +25,7 @@ object Main {
def main(args: Array[String]) { def main(args: Array[String]) {
var idlFile: File = null var idlFile: File = null
var cppOutFolder: Option[File] = None var cppOutFolder: Option[File] = None
var cppNamespace: Option[String] = None var cppNamespace: String = ""
var cppIncludePrefix: String = "" var cppIncludePrefix: String = ""
var cppFileIdentStyle: IdentConverter = IdentStyle.underLower var cppFileIdentStyle: IdentConverter = IdentStyle.underLower
var cppOptionalTemplate: String = "std::optional" var cppOptionalTemplate: String = "std::optional"
...@@ -94,7 +94,7 @@ object Main { ...@@ -94,7 +94,7 @@ object Main {
.text("The output folder for C++ header files (default: the same as --cpp-out).") .text("The output folder for C++ header files (default: the same as --cpp-out).")
opt[String]("cpp-include-prefix").valueName("<prefix>").foreach(cppIncludePrefix = _) opt[String]("cpp-include-prefix").valueName("<prefix>").foreach(cppIncludePrefix = _)
.text("The prefix for #includes of header files from C++ files.") .text("The prefix for #includes of header files from C++ files.")
opt[String]("cpp-namespace").valueName("...").foreach(x => cppNamespace = Some(x)) opt[String]("cpp-namespace").valueName("...").foreach(x => cppNamespace = x)
.text("The namespace name to use for generated C++ classes.") .text("The namespace name to use for generated C++ classes.")
opt[String]("cpp-ext").valueName("<ext>").foreach(cppExt = _) opt[String]("cpp-ext").valueName("<ext>").foreach(cppExt = _)
.text("The filename extension for C++ files (default: \"cpp\").") .text("The filename extension for C++ files (default: \"cpp\").")
......
...@@ -35,5 +35,9 @@ abstract class Marshal(spec: Spec) { ...@@ -35,5 +35,9 @@ abstract class Marshal(spec: Spec) {
protected val idJava = spec.javaIdentStyle protected val idJava = spec.javaIdentStyle
protected val idObjc = spec.objcIdentStyle protected val idObjc = spec.objcIdentStyle
protected def withNs(namespace: Option[String], t: String) = namespace.fold(t)("::" + _ + "::" + t) protected def withNs(namespace: Option[String], t: String) = namespace match {
case None => t
case Some("") => "::" + t
case Some(s) => "::" + s + "::" + t
}
} }
...@@ -167,7 +167,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -167,7 +167,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
w.wl w.wl
w.wl((if(i.ext.objc) "@protocol " else "@class ") + self + ";") w.wl((if(i.ext.objc) "@protocol " else "@class ") + self + ";")
w.wl w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => { wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"struct $helperClass") w.wl(s"struct $helperClass")
w.bracedSemi { w.bracedSemi {
w.wl(s"using CppType = std::shared_ptr<$cppSelf>;") w.wl(s"using CppType = std::shared_ptr<$cppSelf>;")
...@@ -200,7 +200,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -200,7 +200,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
w.wl w.wl
w.wl("@end") w.wl("@end")
w.wl w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => { wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType") w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType")
w.braced { w.braced {
w.wl(s"return objc ? objc.cppRef.get() : nullptr;") w.wl(s"return objc ? objc.cppRef.get() : nullptr;")
...@@ -272,7 +272,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -272,7 +272,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
} }
}) })
w.wl w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => { wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType") w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType")
w.braced { w.braced {
w.wl(s"return objc ? djinni::DbxObjcWrapperCache<$objcExtSelf>::getInstance()->get(objc) : nullptr;") w.wl(s"return objc ? djinni::DbxObjcWrapperCache<$objcExtSelf>::getInstance()->get(objc) : nullptr;")
......
...@@ -36,7 +36,7 @@ package object generatorTools { ...@@ -36,7 +36,7 @@ package object generatorTools {
cppOutFolder: Option[File], cppOutFolder: Option[File],
cppHeaderOutFolder: Option[File], cppHeaderOutFolder: Option[File],
cppIncludePrefix: String, cppIncludePrefix: String,
cppNamespace: Option[String], cppNamespace: String,
cppIdentStyle: CppIdentStyle, cppIdentStyle: CppIdentStyle,
cppFileIdentStyle: IdentConverter, cppFileIdentStyle: IdentConverter,
cppOptionalTemplate: String, cppOptionalTemplate: String,
...@@ -213,10 +213,10 @@ abstract class Generator(spec: Spec) ...@@ -213,10 +213,10 @@ abstract class Generator(spec: Spec)
val idJava = spec.javaIdentStyle val idJava = spec.javaIdentStyle
val idObjc = spec.objcIdentStyle val idObjc = spec.objcIdentStyle
def wrapNamespace(w: IndentWriter, ns: Option[String], f: IndentWriter => Unit) { def wrapNamespace(w: IndentWriter, ns: String, f: IndentWriter => Unit) {
ns match { ns match {
case None => f(w) case "" => f(w)
case Some(s) => case s =>
val parts = s.split("::") val parts = s.split("::")
w.wl(parts.map("namespace "+_+" {").mkString(" ")).wl w.wl(parts.map("namespace "+_+" {").mkString(" ")).wl
f(w) f(w)
...@@ -233,7 +233,7 @@ abstract class Generator(spec: Spec) ...@@ -233,7 +233,7 @@ abstract class Generator(spec: Spec)
w.wl("} // end anonymous namespace") w.wl("} // end anonymous namespace")
} }
def writeHppFileGeneric(folder: File, namespace: Option[String], fileIdentStyle: IdentConverter)(name: String, origin: String, includes: Iterable[String], fwds: Iterable[String], f: IndentWriter => Unit, f2: IndentWriter => Unit) { def writeHppFileGeneric(folder: File, namespace: String, fileIdentStyle: IdentConverter)(name: String, origin: String, includes: Iterable[String], fwds: Iterable[String], f: IndentWriter => Unit, f2: IndentWriter => Unit) {
createFile(folder, fileIdentStyle(name) + "." + spec.cppHeaderExt, (w: IndentWriter) => { createFile(folder, fileIdentStyle(name) + "." + spec.cppHeaderExt, (w: IndentWriter) => {
w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!") w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!")
w.wl("// This file generated by Djinni from " + origin) w.wl("// This file generated by Djinni from " + origin)
...@@ -257,7 +257,7 @@ abstract class Generator(spec: Spec) ...@@ -257,7 +257,7 @@ abstract class Generator(spec: Spec)
}) })
} }
def writeCppFileGeneric(folder: File, namespace: Option[String], fileIdentStyle: IdentConverter, includePrefix: String)(name: String, origin: String, includes: Iterable[String], f: IndentWriter => Unit) { def writeCppFileGeneric(folder: File, namespace: String, fileIdentStyle: IdentConverter, includePrefix: String)(name: String, origin: String, includes: Iterable[String], f: IndentWriter => Unit) {
createFile(folder, fileIdentStyle(name) + "." + spec.cppExt, (w: IndentWriter) => { createFile(folder, fileIdentStyle(name) + "." + spec.cppExt, (w: IndentWriter) => {
w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!") w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!")
w.wl("// This file generated by Djinni from " + origin) w.wl("// This file generated by Djinni from " + origin)
...@@ -289,7 +289,11 @@ abstract class Generator(spec: Spec) ...@@ -289,7 +289,11 @@ abstract class Generator(spec: Spec)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Render type expression // Render type expression
def withNs(namespace: Option[String], t: String) = namespace.fold(t)("::"+_+"::"+t) def withNs(namespace: Option[String], t: String) = namespace match {
case None => t
case Some("") => "::" + t
case Some(s) => "::" + s + "::" + t
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
......
...@@ -23,8 +23,8 @@ enum class color : int { ...@@ -23,8 +23,8 @@ enum class color : int {
namespace std { namespace std {
template <> template <>
struct hash<color> { struct hash<::color> {
size_t operator()(color type) const { size_t operator()(::color type) const {
return std::hash<int>()(static_cast<int>(type)); return std::hash<int>()(static_cast<int>(type));
} }
}; };
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, AssortedIntegers c) { jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, ::AssortedIntegers c) {
jbyte j_eight = ::djinni::HI8::Unboxed::toJava(jniEnv, c.eight); jbyte j_eight = ::djinni::HI8::Unboxed::toJava(jniEnv, c.eight);
jshort j_sixteen = ::djinni::HI16::Unboxed::toJava(jniEnv, c.sixteen); jshort j_sixteen = ::djinni::HI16::Unboxed::toJava(jniEnv, c.sixteen);
jint j_thirtytwo = ::djinni::HI32::Unboxed::toJava(jniEnv, c.thirtytwo); jint j_thirtytwo = ::djinni::HI32::Unboxed::toJava(jniEnv, c.thirtytwo);
...@@ -25,10 +25,10 @@ jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, AssortedIntegers c) { ...@@ -25,10 +25,10 @@ jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, AssortedIntegers c) {
return r; return r;
} }
AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) { ::AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get();
return AssortedIntegers( return ::AssortedIntegers(
::djinni::HI8::Unboxed::fromJava(jniEnv, jniEnv->GetByteField(j, data.field_mEight)), ::djinni::HI8::Unboxed::fromJava(jniEnv, jniEnv->GetByteField(j, data.field_mEight)),
::djinni::HI16::Unboxed::fromJava(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)), ::djinni::HI16::Unboxed::fromJava(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)), ::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)),
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeAssortedIntegers final { class NativeAssortedIntegers final {
public: public:
using CppType = AssortedIntegers; using CppType = ::AssortedIntegers;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, AssortedIntegers); static jobject toJava(JNIEnv*, ::AssortedIntegers);
static AssortedIntegers fromJava(JNIEnv*, jobject); static ::AssortedIntegers fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/AssortedIntegers") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(BSIJLjava/lang/Byte;Ljava/lang/Short;Ljava/lang/Integer;Ljava/lang/Long;)V") };
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
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::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {}
ClientReturnedRecord NativeClientInterface::JavaProxy::JavaProxy::get_record(int64_t c_record_id, const std::string & c_utf8string) { ::ClientReturnedRecord NativeClientInterface::JavaProxy::JavaProxy::get_record(int64_t c_record_id, const std::string & c_utf8string) {
JNIEnv * const jniEnv = djinni::jniGetThreadEnv(); JNIEnv * const jniEnv = djinni::jniGetThreadEnv();
djinni::JniLocalScope jscope(jniEnv, 10); djinni::JniLocalScope jscope(jniEnv, 10);
jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c_record_id); jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c_record_id);
......
...@@ -8,25 +8,25 @@ ...@@ -8,25 +8,25 @@
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); } static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::ClientInterface> c) { return djinni::JniClass<::djinni_generated::NativeClientInterface>::get()._toJava(jniEnv, c); }
static std::shared_ptr<ClientInterface> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeClientInterface>::get()._fromJava(jniEnv, j); } 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") }; const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientInterface") };
const jmethodID method_getRecord { djinni::jniGetMethodID(clazz.get(), "getRecord", "(JLjava/lang/String;)Lcom/dropbox/djinni/test/ClientReturnedRecord;") }; const jmethodID method_getRecord { djinni::jniGetMethodID(clazz.get(), "getRecord", "(JLjava/lang/String;)Lcom/dropbox/djinni/test/ClientReturnedRecord;") };
class JavaProxy final : djinni::JavaProxyCacheEntry, public ClientInterface { class JavaProxy final : djinni::JavaProxyCacheEntry, public ::ClientInterface {
public: public:
JavaProxy(jobject obj); JavaProxy(jobject obj);
virtual ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string) override; virtual ::ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string) override;
private: private:
using djinni::JavaProxyCacheEntry::getGlobalRef; using djinni::JavaProxyCacheEntry::getGlobalRef;
friend class djinni::JniInterface<ClientInterface, ::djinni_generated::NativeClientInterface>; friend class djinni::JniInterface<::ClientInterface, ::djinni_generated::NativeClientInterface>;
friend class djinni::JavaProxyCache<JavaProxy>; friend class djinni::JavaProxyCache<JavaProxy>;
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ClientReturnedRecord c) { jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ::ClientReturnedRecord c) {
jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c.record_id); jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c.record_id);
djinni::LocalRef<jstring> j_content(jniEnv, ::djinni::HString::toJava(jniEnv, c.content)); djinni::LocalRef<jstring> j_content(jniEnv, ::djinni::HString::toJava(jniEnv, c.content));
const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get();
...@@ -16,10 +16,10 @@ jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ClientReturnedRecord ...@@ -16,10 +16,10 @@ jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ClientReturnedRecord
return r; return r;
} }
ClientReturnedRecord NativeClientReturnedRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::ClientReturnedRecord NativeClientReturnedRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get();
return ClientReturnedRecord( return ::ClientReturnedRecord(
::djinni::HI64::Unboxed::fromJava(jniEnv, jniEnv->GetLongField(j, data.field_mRecordId)), ::djinni::HI64::Unboxed::fromJava(jniEnv, jniEnv->GetLongField(j, data.field_mRecordId)),
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mContent))).get())); ::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mContent))).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeClientReturnedRecord final { class NativeClientReturnedRecord final {
public: public:
using CppType = ClientReturnedRecord; using CppType = ::ClientReturnedRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, ClientReturnedRecord); static jobject toJava(JNIEnv*, ::ClientReturnedRecord);
static ClientReturnedRecord fromJava(JNIEnv*, jobject); static ::ClientReturnedRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientReturnedRecord") }; const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientReturnedRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(JLjava/lang/String;)V") }; const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(JLjava/lang/String;)V") };
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ 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(); } static jobject toJava(JNIEnv* jniEnv, ::color c) { return djinni::JniClass<NativeColor>::get().create(jniEnv, static_cast<int>(c)).release(); }
static color fromJava(JNIEnv* jniEnv, jobject j) { return static_cast<color>(djinni::JniClass<NativeColor>::get().ordinal(jniEnv, j)); } static ::color fromJava(JNIEnv* jniEnv, jobject j) { return static_cast<::color>(djinni::JniClass<NativeColor>::get().ordinal(jniEnv, j)); }
private: private:
NativeColor() : JniEnum("com/dropbox/djinni/test/Color") {} NativeColor() : JniEnum("com/dropbox/djinni/test/Color") {}
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeConstants::toJava(JNIEnv* jniEnv, Constants c) { jobject NativeConstants::toJava(JNIEnv* jniEnv, ::Constants c) {
jint j_some_integer = ::djinni::HI32::Unboxed::toJava(jniEnv, c.some_integer); 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)); djinni::LocalRef<jstring> j_some_string(jniEnv, ::djinni::HString::toJava(jniEnv, c.some_string));
const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get();
...@@ -16,10 +16,10 @@ jobject NativeConstants::toJava(JNIEnv* jniEnv, Constants c) { ...@@ -16,10 +16,10 @@ jobject NativeConstants::toJava(JNIEnv* jniEnv, Constants c) {
return r; return r;
} }
Constants NativeConstants::fromJava(JNIEnv* jniEnv, jobject j) { ::Constants NativeConstants::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get();
return Constants( return ::Constants(
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mSomeInteger)), ::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mSomeInteger)),
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mSomeString))).get())); ::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mSomeString))).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeConstants final { class NativeConstants final {
public: public:
using CppType = Constants; using CppType = ::Constants;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, Constants); static jobject toJava(JNIEnv*, ::Constants);
static Constants fromJava(JNIEnv*, jobject); static ::Constants fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/Constants") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
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") {}
using namespace ::djinni_generated; using namespace ::djinni_generated;
...@@ -15,7 +15,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_ ...@@ -15,7 +15,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<CppException>*>(nativeRef); delete reinterpret_cast<djinni::CppProxyHandle<::CppException>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
} }
...@@ -23,7 +23,7 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_ ...@@ -23,7 +23,7 @@ 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 std::shared_ptr<::CppException> & ref = djinni::CppProxyHandle<::CppException>::get(nativeRef);
int32_t cr = ref->throw_an_exception(); int32_t cr = ref->throw_an_exception();
...@@ -36,7 +36,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv* ...@@ -36,7 +36,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv*
try { try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv); DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<CppException> cr = CppException::get(); std::shared_ptr<::CppException> cr = ::CppException::get();
return NativeCppException::toJava(jniEnv, cr); 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,13 +8,13 @@ ...@@ -8,13 +8,13 @@
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); } static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::CppException> c) { return djinni::JniClass<::djinni_generated::NativeCppException>::get()._toJava(jniEnv, c); }
static std::shared_ptr<CppException> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeCppException>::get()._fromJava(jniEnv, j); } static std::shared_ptr<::CppException> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeCppException>::get()._fromJava(jniEnv, j); }
private: private:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeDateRecord::toJava(JNIEnv* jniEnv, DateRecord c) { jobject NativeDateRecord::toJava(JNIEnv* jniEnv, ::DateRecord c) {
djinni::LocalRef<jobject> j_created_at(jniEnv, ::djinni::HDate::toJava(jniEnv, c.created_at)); djinni::LocalRef<jobject> j_created_at(jniEnv, ::djinni::HDate::toJava(jniEnv, c.created_at));
const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_created_at.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_created_at.get());
...@@ -14,10 +14,10 @@ jobject NativeDateRecord::toJava(JNIEnv* jniEnv, DateRecord c) { ...@@ -14,10 +14,10 @@ jobject NativeDateRecord::toJava(JNIEnv* jniEnv, DateRecord c) {
return r; return r;
} }
DateRecord NativeDateRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::DateRecord NativeDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::get();
return DateRecord( return ::DateRecord(
::djinni::HDate::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mCreatedAt)).get())); ::djinni::HDate::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mCreatedAt)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeDateRecord final { class NativeDateRecord final {
public: public:
using CppType = DateRecord; using CppType = ::DateRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, DateRecord); static jobject toJava(JNIEnv*, ::DateRecord);
static DateRecord fromJava(JNIEnv*, jobject); static ::DateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/DateRecord") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/Date;)V") };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapDateRecord::toJava(JNIEnv* jniEnv, MapDateRecord c) { jobject NativeMapDateRecord::toJava(JNIEnv* jniEnv, ::MapDateRecord c) {
djinni::LocalRef<jobject> j_dates_by_id(jniEnv, ::djinni::HMap<::djinni::HString, ::djinni::HDate>::toJava(jniEnv, c.dates_by_id)); 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(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_dates_by_id.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_dates_by_id.get());
...@@ -16,10 +16,10 @@ jobject NativeMapDateRecord::toJava(JNIEnv* jniEnv, MapDateRecord c) { ...@@ -16,10 +16,10 @@ jobject NativeMapDateRecord::toJava(JNIEnv* jniEnv, MapDateRecord c) {
return r; return r;
} }
MapDateRecord NativeMapDateRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::MapDateRecord NativeMapDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::get();
return MapDateRecord( return ::MapDateRecord(
::djinni::HMap<::djinni::HString, ::djinni::HDate>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mDatesById)).get())); ::djinni::HMap<::djinni::HString, ::djinni::HDate>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mDatesById)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapDateRecord final { class NativeMapDateRecord final {
public: public:
using CppType = MapDateRecord; using CppType = ::MapDateRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, MapDateRecord); static jobject toJava(JNIEnv*, ::MapDateRecord);
static MapDateRecord fromJava(JNIEnv*, jobject); static ::MapDateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapDateRecord") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapListRecord::toJava(JNIEnv* jniEnv, MapListRecord c) { jobject NativeMapListRecord::toJava(JNIEnv* jniEnv, ::MapListRecord c) {
djinni::LocalRef<jobject> j_map_list(jniEnv, ::djinni::HList<::djinni::HMap<::djinni::HString, ::djinni::HI64>>::toJava(jniEnv, c.map_list)); 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(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map_list.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map_list.get());
...@@ -17,10 +17,10 @@ jobject NativeMapListRecord::toJava(JNIEnv* jniEnv, MapListRecord c) { ...@@ -17,10 +17,10 @@ jobject NativeMapListRecord::toJava(JNIEnv* jniEnv, MapListRecord c) {
return r; return r;
} }
MapListRecord NativeMapListRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::MapListRecord NativeMapListRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::get();
return MapListRecord( return ::MapListRecord(
::djinni::HList<::djinni::HMap<::djinni::HString, ::djinni::HI64>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMapList)).get())); ::djinni::HList<::djinni::HMap<::djinni::HString, ::djinni::HI64>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMapList)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapListRecord final { class NativeMapListRecord final {
public: public:
using CppType = MapListRecord; using CppType = ::MapListRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, MapListRecord); static jobject toJava(JNIEnv*, ::MapListRecord);
static MapListRecord fromJava(JNIEnv*, jobject); static ::MapListRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapListRecord") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeMapRecord::toJava(JNIEnv* jniEnv, MapRecord c) { jobject NativeMapRecord::toJava(JNIEnv* jniEnv, ::MapRecord c) {
djinni::LocalRef<jobject> j_map(jniEnv, ::djinni::HMap<::djinni::HString, ::djinni::HI64>::toJava(jniEnv, c.map)); 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(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map.get());
...@@ -16,10 +16,10 @@ jobject NativeMapRecord::toJava(JNIEnv* jniEnv, MapRecord c) { ...@@ -16,10 +16,10 @@ jobject NativeMapRecord::toJava(JNIEnv* jniEnv, MapRecord c) {
return r; return r;
} }
MapRecord NativeMapRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::MapRecord NativeMapRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get();
return MapRecord( return ::MapRecord(
::djinni::HMap<::djinni::HString, ::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMap)).get())); ::djinni::HMap<::djinni::HString, ::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mMap)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapRecord final { class NativeMapRecord final {
public: public:
using CppType = MapRecord; using CppType = ::MapRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, MapRecord); static jobject toJava(JNIEnv*, ::MapRecord);
static MapRecord fromJava(JNIEnv*, jobject); static ::MapRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapRecord") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeNestedCollection::toJava(JNIEnv* jniEnv, NestedCollection c) { jobject NativeNestedCollection::toJava(JNIEnv* jniEnv, ::NestedCollection c) {
djinni::LocalRef<jobject> j_set_list(jniEnv, ::djinni::HList<::djinni::HSet<::djinni::HString>>::toJava(jniEnv, c.set_list)); 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(); const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set_list.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set_list.get());
...@@ -16,10 +16,10 @@ jobject NativeNestedCollection::toJava(JNIEnv* jniEnv, NestedCollection c) { ...@@ -16,10 +16,10 @@ jobject NativeNestedCollection::toJava(JNIEnv* jniEnv, NestedCollection c) {
return r; return r;
} }
NestedCollection NativeNestedCollection::fromJava(JNIEnv* jniEnv, jobject j) { ::NestedCollection NativeNestedCollection::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::get();
return NestedCollection( return ::NestedCollection(
::djinni::HList<::djinni::HSet<::djinni::HString>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSetList)).get())); ::djinni::HList<::djinni::HSet<::djinni::HString>>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSetList)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeNestedCollection final { class NativeNestedCollection final {
public: public:
using CppType = NestedCollection; using CppType = ::NestedCollection;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, NestedCollection); static jobject toJava(JNIEnv*, ::NestedCollection);
static NestedCollection fromJava(JNIEnv*, jobject); static ::NestedCollection fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/NestedCollection") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, PrimitiveList c) { jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, ::PrimitiveList c) {
djinni::LocalRef<jobject> j_list(jniEnv, ::djinni::HList<::djinni::HI64>::toJava(jniEnv, c.list)); djinni::LocalRef<jobject> j_list(jniEnv, ::djinni::HList<::djinni::HI64>::toJava(jniEnv, c.list));
const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_list.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_list.get());
...@@ -15,10 +15,10 @@ jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, PrimitiveList c) { ...@@ -15,10 +15,10 @@ jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, PrimitiveList c) {
return r; return r;
} }
PrimitiveList NativePrimitiveList::fromJava(JNIEnv* jniEnv, jobject j) { ::PrimitiveList NativePrimitiveList::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get();
return PrimitiveList( return ::PrimitiveList(
::djinni::HList<::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mList)).get())); ::djinni::HList<::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mList)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativePrimitiveList final { class NativePrimitiveList final {
public: public:
using CppType = PrimitiveList; using CppType = ::PrimitiveList;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, PrimitiveList); static jobject toJava(JNIEnv*, ::PrimitiveList);
static PrimitiveList fromJava(JNIEnv*, jobject); static ::PrimitiveList fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/PrimitiveList") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, RecordWithDerivings c) { jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, ::RecordWithDerivings c) {
jint j_key1 = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key1); jint j_key1 = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key1);
djinni::LocalRef<jstring> j_key2(jniEnv, ::djinni::HString::toJava(jniEnv, c.key2)); djinni::LocalRef<jstring> j_key2(jniEnv, ::djinni::HString::toJava(jniEnv, c.key2));
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get();
...@@ -16,10 +16,10 @@ jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, RecordWithDerivings c) ...@@ -16,10 +16,10 @@ jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, RecordWithDerivings c)
return r; return r;
} }
RecordWithDerivings NativeRecordWithDerivings::fromJava(JNIEnv* jniEnv, jobject j) { ::RecordWithDerivings NativeRecordWithDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get();
return RecordWithDerivings( return ::RecordWithDerivings(
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey1)), ::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey1)),
::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mKey2))).get())); ::djinni::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mKey2))).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeRecordWithDerivings final { class NativeRecordWithDerivings final {
public: public:
using CppType = RecordWithDerivings; using CppType = ::RecordWithDerivings;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, RecordWithDerivings); static jobject toJava(JNIEnv*, ::RecordWithDerivings);
static RecordWithDerivings fromJava(JNIEnv*, jobject); static ::RecordWithDerivings fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/RecordWithDerivings") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, RecordWithNestedDerivings c) { jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, ::RecordWithNestedDerivings c) {
jint j_key = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key); jint j_key = ::djinni::HI32::Unboxed::toJava(jniEnv, c.key);
djinni::LocalRef<jobject> j_rec(jniEnv, NativeRecordWithDerivings::toJava(jniEnv, c.rec)); djinni::LocalRef<jobject> j_rec(jniEnv, NativeRecordWithDerivings::toJava(jniEnv, c.rec));
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get();
...@@ -16,10 +16,10 @@ jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, RecordWithNested ...@@ -16,10 +16,10 @@ jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, RecordWithNested
return r; return r;
} }
RecordWithNestedDerivings NativeRecordWithNestedDerivings::fromJava(JNIEnv* jniEnv, jobject j) { ::RecordWithNestedDerivings NativeRecordWithNestedDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get();
return RecordWithNestedDerivings( return ::RecordWithNestedDerivings(
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey)), ::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mKey)),
NativeRecordWithDerivings::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mRec)).get())); NativeRecordWithDerivings::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mRec)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeRecordWithNestedDerivings final { class NativeRecordWithNestedDerivings final {
public: public:
using CppType = RecordWithNestedDerivings; using CppType = ::RecordWithNestedDerivings;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, RecordWithNestedDerivings); static jobject toJava(JNIEnv*, ::RecordWithNestedDerivings);
static RecordWithNestedDerivings fromJava(JNIEnv*, jobject); static ::RecordWithNestedDerivings fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/RecordWithNestedDerivings") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILcom/dropbox/djinni/test/RecordWithDerivings;)V") };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace djinni_generated { namespace djinni_generated {
jobject NativeSetRecord::toJava(JNIEnv* jniEnv, SetRecord c) { jobject NativeSetRecord::toJava(JNIEnv* jniEnv, ::SetRecord c) {
djinni::LocalRef<jobject> j_set(jniEnv, ::djinni::HSet<::djinni::HString>::toJava(jniEnv, c.set)); djinni::LocalRef<jobject> j_set(jniEnv, ::djinni::HSet<::djinni::HString>::toJava(jniEnv, c.set));
const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set.get()); jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set.get());
...@@ -15,10 +15,10 @@ jobject NativeSetRecord::toJava(JNIEnv* jniEnv, SetRecord c) { ...@@ -15,10 +15,10 @@ jobject NativeSetRecord::toJava(JNIEnv* jniEnv, SetRecord c) {
return r; return r;
} }
SetRecord NativeSetRecord::fromJava(JNIEnv* jniEnv, jobject j) { ::SetRecord NativeSetRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr); assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get(); const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get();
return SetRecord( return ::SetRecord(
::djinni::HSet<::djinni::HString>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSet)).get())); ::djinni::HSet<::djinni::HString>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mSet)).get()));
} }
......
...@@ -10,11 +10,11 @@ namespace djinni_generated { ...@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeSetRecord final { class NativeSetRecord final {
public: public:
using CppType = SetRecord; using CppType = ::SetRecord;
using JniType = jobject; using JniType = jobject;
static jobject toJava(JNIEnv*, SetRecord); static jobject toJava(JNIEnv*, ::SetRecord);
static SetRecord fromJava(JNIEnv*, jobject); static ::SetRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/SetRecord") }; 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 jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashSet;)V") };
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
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); } static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::TestHelpers> c) { return djinni::JniClass<::djinni_generated::NativeTestHelpers>::get()._toJava(jniEnv, c); }
static std::shared_ptr<TestHelpers> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeTestHelpers>::get()._fromJava(jniEnv, j); } static std::shared_ptr<::TestHelpers> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeTestHelpers>::get()._fromJava(jniEnv, j); }
private: private:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
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::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {} NativeToken::JavaProxy::JavaProxy(jobject obj) : JavaProxyCacheEntry(obj) {}
using namespace ::djinni_generated; using namespace ::djinni_generated;
...@@ -14,7 +14,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Token_00024CppProxy_nativeD ...@@ -14,7 +14,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Token_00024CppProxy_nativeD
{ {
try { try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<Token>*>(nativeRef); delete reinterpret_cast<djinni::CppProxyHandle<::Token>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
} }
......
...@@ -8,23 +8,23 @@ ...@@ -8,23 +8,23 @@
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); } static jobject toJava(JNIEnv* jniEnv, std::shared_ptr<::Token> c) { return djinni::JniClass<::djinni_generated::NativeToken>::get()._toJava(jniEnv, c); }
static std::shared_ptr<Token> fromJava(JNIEnv* jniEnv, jobject j) { return djinni::JniClass<::djinni_generated::NativeToken>::get()._fromJava(jniEnv, j); } 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") }; const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/Token") };
class JavaProxy final : djinni::JavaProxyCacheEntry, public Token { class JavaProxy final : djinni::JavaProxyCacheEntry, public ::Token {
public: public:
JavaProxy(jobject obj); JavaProxy(jobject obj);
private: private:
using djinni::JavaProxyCacheEntry::getGlobalRef; using djinni::JavaProxyCacheEntry::getGlobalRef;
friend class djinni::JniInterface<Token, ::djinni_generated::NativeToken>; friend class djinni::JniInterface<::Token, ::djinni_generated::NativeToken>;
friend class djinni::JavaProxyCache<JavaProxy>; friend class djinni::JavaProxyCache<JavaProxy>;
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBAssortedIntegers () @interface DBAssortedIntegers ()
- (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers; - (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers;
- (AssortedIntegers)cppAssortedIntegers; - (::AssortedIntegers)cppAssortedIntegers;
@end @end
...@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers - (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers
{ {
if (self = [super init]) { if (self = [super init]) {
_eight = ::djinni::I8::fromCpp(assortedIntegers.eight); _eight = ::djinni::I8::fromCpp(assortedIntegers.eight);
...@@ -89,7 +89,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -89,7 +89,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (AssortedIntegers)cppAssortedIntegers - (::AssortedIntegers)cppAssortedIntegers
{ {
int8_t eight = ::djinni::I8::toCpp(_eight); int8_t eight = ::djinni::I8::toCpp(_eight);
int16_t sixteen = ::djinni::I16::toCpp(_sixteen); int16_t sixteen = ::djinni::I16::toCpp(_sixteen);
...@@ -115,7 +115,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -115,7 +115,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
int64_t optValue = ::djinni::I64::Boxed::toCpp(_oSixtyfour); int64_t optValue = ::djinni::I64::Boxed::toCpp(_oSixtyfour);
oSixtyfour = optValue; oSixtyfour = optValue;
} }
return AssortedIntegers( return ::AssortedIntegers(
std::move(eight), std::move(eight),
std::move(sixteen), std::move(sixteen),
std::move(thirtytwo), std::move(thirtytwo),
......
...@@ -12,7 +12,7 @@ namespace djinni_generated { ...@@ -12,7 +12,7 @@ namespace djinni_generated {
struct ClientInterface struct ClientInterface
{ {
using CppType = std::shared_ptr<ClientInterface>; using CppType = std::shared_ptr<::ClientInterface>;
using ObjcType = id<DBClientInterface>; using ObjcType = id<DBClientInterface>;
static CppType toCpp(ObjcType objc); static CppType toCpp(ObjcType objc);
......
...@@ -13,12 +13,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -13,12 +13,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
namespace { // anonymous namespace namespace { // anonymous namespace
class ObjcProxy final class ObjcProxy final
: public ClientInterface : public ::ClientInterface
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle , public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{ {
public: public:
using Handle::Handle; using Handle::Handle;
ClientReturnedRecord get_record (int64_t record_id, const std::string & utf8string) override; ::ClientReturnedRecord get_record (int64_t record_id, const std::string & utf8string) override;
}; };
} // end anonymous namespace } // end anonymous namespace
...@@ -38,13 +38,13 @@ auto ClientInterface::fromCpp(const CppType& cpp) -> ObjcType ...@@ -38,13 +38,13 @@ auto ClientInterface::fromCpp(const CppType& cpp) -> ObjcType
} // namespace djinni_generated } // namespace djinni_generated
ClientReturnedRecord ObjcProxy::get_record (int64_t record_id, const std::string & utf8string) ::ClientReturnedRecord ObjcProxy::get_record (int64_t record_id, const std::string & utf8string)
{ {
@autoreleasepool { @autoreleasepool {
int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id); int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id);
NSString *cpp_utf8string = ::djinni::String::fromCpp(utf8string); NSString *cpp_utf8string = ::djinni::String::fromCpp(utf8string);
DBClientReturnedRecord * objcRet = [Handle::get() getRecord:cpp_record_id utf8string:cpp_utf8string]; DBClientReturnedRecord * objcRet = [Handle::get() getRecord:cpp_record_id utf8string:cpp_utf8string];
ClientReturnedRecord cppRet = std::move([objcRet cppClientReturnedRecord]); ::ClientReturnedRecord cppRet = std::move([objcRet cppClientReturnedRecord]);
return cppRet; return cppRet;
} }
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBClientReturnedRecord () @interface DBClientReturnedRecord ()
- (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord; - (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord;
- (ClientReturnedRecord)cppClientReturnedRecord; - (::ClientReturnedRecord)cppClientReturnedRecord;
@end @end
...@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord - (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord
{ {
if (self = [super init]) { if (self = [super init]) {
_recordId = ::djinni::I64::fromCpp(clientReturnedRecord.record_id); _recordId = ::djinni::I64::fromCpp(clientReturnedRecord.record_id);
...@@ -39,11 +39,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -39,11 +39,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (ClientReturnedRecord)cppClientReturnedRecord - (::ClientReturnedRecord)cppClientReturnedRecord
{ {
int64_t recordId = ::djinni::I64::toCpp(_recordId); int64_t recordId = ::djinni::I64::toCpp(_recordId);
std::string content = ::djinni::String::toCpp(_content); std::string content = ::djinni::String::toCpp(_content);
return ClientReturnedRecord( return ::ClientReturnedRecord(
std::move(recordId), std::move(recordId),
std::move(content)); std::move(content));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBConstants () @interface DBConstants ()
- (id)initWithCppConstants:(const Constants &)constants; - (id)initWithCppConstants:(const ::Constants &)constants;
- (Constants)cppConstants; - (::Constants)cppConstants;
@end @end
...@@ -54,7 +54,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -54,7 +54,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppConstants:(const Constants &)constants - (id)initWithCppConstants:(const ::Constants &)constants
{ {
if (self = [super init]) { if (self = [super init]) {
_someInteger = ::djinni::I32::fromCpp(constants.some_integer); _someInteger = ::djinni::I32::fromCpp(constants.some_integer);
...@@ -63,11 +63,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -63,11 +63,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (Constants)cppConstants - (::Constants)cppConstants
{ {
int32_t someInteger = ::djinni::I32::toCpp(_someInteger); int32_t someInteger = ::djinni::I32::toCpp(_someInteger);
std::string someString = ::djinni::String::toCpp(_someString); std::string someString = ::djinni::String::toCpp(_someString);
return Constants( return ::Constants(
std::move(someInteger), std::move(someInteger),
std::move(someString)); std::move(someString));
} }
......
...@@ -12,7 +12,7 @@ namespace djinni_generated { ...@@ -12,7 +12,7 @@ namespace djinni_generated {
struct CppException struct CppException
{ {
using CppType = std::shared_ptr<CppException>; using CppType = std::shared_ptr<::CppException>;
using ObjcType = DBCppException*; using ObjcType = DBCppException*;
static CppType toCpp(ObjcType objc); static CppType toCpp(ObjcType objc);
......
...@@ -16,9 +16,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -16,9 +16,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBCppException () @interface DBCppException ()
@property (nonatomic, readonly) djinni::DbxCppWrapperCache<CppException>::Handle cppRef; @property (nonatomic, readonly) djinni::DbxCppWrapperCache<::CppException>::Handle cppRef;
- (id)initWithCpp:(const std::shared_ptr<CppException>&)cppRef; - (id)initWithCpp:(const std::shared_ptr<::CppException>&)cppRef;
@end @end
...@@ -31,7 +31,7 @@ auto CppException::toCpp(ObjcType objc) -> CppType ...@@ -31,7 +31,7 @@ auto CppException::toCpp(ObjcType objc) -> CppType
auto CppException::fromCpp(const CppType& cpp) -> ObjcType auto CppException::fromCpp(const CppType& cpp) -> ObjcType
{ {
return !cpp ? nil : djinni::DbxCppWrapperCache<CppException>::getInstance()->get(cpp, [] (const auto& p) return !cpp ? nil : djinni::DbxCppWrapperCache<::CppException>::getInstance()->get(cpp, [] (const auto& p)
{ {
return [[DBCppException alloc] initWithCpp:p]; return [[DBCppException alloc] initWithCpp:p];
}); });
...@@ -41,7 +41,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType ...@@ -41,7 +41,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
@implementation DBCppException @implementation DBCppException
- (id)initWithCpp:(const std::shared_ptr<CppException>&)cppRef - (id)initWithCpp:(const std::shared_ptr<::CppException>&)cppRef
{ {
if (self = [super init]) { if (self = [super init]) {
_cppRef.assign(cppRef); _cppRef.assign(cppRef);
...@@ -59,7 +59,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType ...@@ -59,7 +59,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
+ (DBCppException *)get { + (DBCppException *)get {
try { try {
std::shared_ptr<CppException> cppRet = CppException::get(); std::shared_ptr<::CppException> cppRet = ::CppException::get();
DBCppException* objcRet = ::djinni_generated::CppException::fromCpp(cppRet); DBCppException* objcRet = ::djinni_generated::CppException::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBDateRecord () @interface DBDateRecord ()
- (id)initWithCppDateRecord:(const DateRecord &)dateRecord; - (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord;
- (DateRecord)cppDateRecord; - (::DateRecord)cppDateRecord;
@end @end
...@@ -28,7 +28,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -28,7 +28,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppDateRecord:(const DateRecord &)dateRecord - (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord
{ {
if (self = [super init]) { if (self = [super init]) {
_createdAt = [NSDate dateWithTimeIntervalSince1970: _createdAt = [NSDate dateWithTimeIntervalSince1970:
...@@ -37,10 +37,10 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -37,10 +37,10 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (DateRecord)cppDateRecord - (::DateRecord)cppDateRecord
{ {
std::chrono::system_clock::time_point createdAt = ::djinni::convert_date([_createdAt timeIntervalSince1970]); std::chrono::system_clock::time_point createdAt = ::djinni::convert_date([_createdAt timeIntervalSince1970]);
return DateRecord( return ::DateRecord(
std::move(createdAt)); std::move(createdAt));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBMapDateRecord () @interface DBMapDateRecord ()
- (id)initWithCppMapDateRecord:(const MapDateRecord &)mapDateRecord; - (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord;
- (MapDateRecord)cppMapDateRecord; - (::MapDateRecord)cppMapDateRecord;
@end @end
...@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppMapDateRecord:(const MapDateRecord &)mapDateRecord - (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSString *> _datesByIdTempKeyVector; std::vector<NSString *> _datesByIdTempKeyVector;
...@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (MapDateRecord)cppMapDateRecord - (::MapDateRecord)cppMapDateRecord
{ {
std::unordered_map<std::string, std::chrono::system_clock::time_point> datesById; std::unordered_map<std::string, std::chrono::system_clock::time_point> datesById;
for (id objcKey_0 in _datesById) { for (id objcKey_0 in _datesById) {
...@@ -66,7 +66,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -66,7 +66,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::chrono::system_clock::time_point cppValue_0 = ::djinni::convert_date([[_datesById objectForKey:objcKey_0] timeIntervalSince1970]); std::chrono::system_clock::time_point cppValue_0 = ::djinni::convert_date([[_datesById objectForKey:objcKey_0] timeIntervalSince1970]);
datesById.emplace(std::move(cppKey_0), std::move(cppValue_0)); datesById.emplace(std::move(cppKey_0), std::move(cppValue_0));
} }
return MapDateRecord( return ::MapDateRecord(
std::move(datesById)); std::move(datesById));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBMapListRecord () @interface DBMapListRecord ()
- (id)initWithCppMapListRecord:(const MapListRecord &)mapListRecord; - (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord;
- (MapListRecord)cppMapListRecord; - (::MapListRecord)cppMapListRecord;
@end @end
...@@ -46,7 +46,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -46,7 +46,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppMapListRecord:(const MapListRecord &)mapListRecord - (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSDictionary *> _mapListTempVector; std::vector<NSDictionary *> _mapListTempVector;
...@@ -70,7 +70,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -70,7 +70,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (MapListRecord)cppMapListRecord - (::MapListRecord)cppMapListRecord
{ {
std::vector<std::unordered_map<std::string, int64_t>> mapList; std::vector<std::unordered_map<std::string, int64_t>> mapList;
mapList.reserve([_mapList count]); mapList.reserve([_mapList count]);
...@@ -83,7 +83,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -83,7 +83,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
} }
mapList.push_back(std::move(cppValue_0)); mapList.push_back(std::move(cppValue_0));
} }
return MapListRecord( return ::MapListRecord(
std::move(mapList)); std::move(mapList));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBMapRecord () @interface DBMapRecord ()
- (id)initWithCppMapRecord:(const MapRecord &)mapRecord; - (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord;
- (MapRecord)cppMapRecord; - (::MapRecord)cppMapRecord;
@end @end
...@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppMapRecord:(const MapRecord &)mapRecord - (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSString *> _mapTempKeyVector; std::vector<NSString *> _mapTempKeyVector;
...@@ -57,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -57,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (MapRecord)cppMapRecord - (::MapRecord)cppMapRecord
{ {
std::unordered_map<std::string, int64_t> map; std::unordered_map<std::string, int64_t> map;
for (id objcKey_0 in _map) { for (id objcKey_0 in _map) {
...@@ -65,7 +65,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -65,7 +65,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([_map objectForKey:objcKey_0]); int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([_map objectForKey:objcKey_0]);
map.emplace(std::move(cppKey_0), std::move(cppValue_0)); map.emplace(std::move(cppKey_0), std::move(cppValue_0));
} }
return MapRecord( return ::MapRecord(
std::move(map)); std::move(map));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBNestedCollection () @interface DBNestedCollection ()
- (id)initWithCppNestedCollection:(const NestedCollection &)nestedCollection; - (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection;
- (NestedCollection)cppNestedCollection; - (::NestedCollection)cppNestedCollection;
@end @end
...@@ -42,7 +42,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -42,7 +42,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppNestedCollection:(const NestedCollection &)nestedCollection - (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSSet *> _setListTempVector; std::vector<NSSet *> _setListTempVector;
...@@ -62,7 +62,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -62,7 +62,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (NestedCollection)cppNestedCollection - (::NestedCollection)cppNestedCollection
{ {
std::vector<std::unordered_set<std::string>> setList; std::vector<std::unordered_set<std::string>> setList;
setList.reserve([_setList count]); setList.reserve([_setList count]);
...@@ -74,7 +74,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -74,7 +74,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
} }
setList.push_back(std::move(cppValue_0)); setList.push_back(std::move(cppValue_0));
} }
return NestedCollection( return ::NestedCollection(
std::move(setList)); std::move(setList));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBPrimitiveList () @interface DBPrimitiveList ()
- (id)initWithCppPrimitiveList:(const PrimitiveList &)primitiveList; - (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList;
- (PrimitiveList)cppPrimitiveList; - (::PrimitiveList)cppPrimitiveList;
@end @end
...@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppPrimitiveList:(const PrimitiveList &)primitiveList - (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSNumber *> _listTempVector; std::vector<NSNumber *> _listTempVector;
...@@ -49,7 +49,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -49,7 +49,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (PrimitiveList)cppPrimitiveList - (::PrimitiveList)cppPrimitiveList
{ {
std::vector<int64_t> list; std::vector<int64_t> list;
list.reserve([_list count]); list.reserve([_list count]);
...@@ -57,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -57,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp(objcValue_0); int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp(objcValue_0);
list.push_back(std::move(cppValue_0)); list.push_back(std::move(cppValue_0));
} }
return PrimitiveList( return ::PrimitiveList(
std::move(list)); std::move(list));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBRecordWithDerivings () @interface DBRecordWithDerivings ()
- (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings; - (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings;
- (RecordWithDerivings)cppRecordWithDerivings; - (::RecordWithDerivings)cppRecordWithDerivings;
@end @end
...@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings - (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings
{ {
if (self = [super init]) { if (self = [super init]) {
_key1 = ::djinni::I32::fromCpp(recordWithDerivings.key1); _key1 = ::djinni::I32::fromCpp(recordWithDerivings.key1);
...@@ -39,11 +39,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -39,11 +39,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (RecordWithDerivings)cppRecordWithDerivings - (::RecordWithDerivings)cppRecordWithDerivings
{ {
int32_t key1 = ::djinni::I32::toCpp(_key1); int32_t key1 = ::djinni::I32::toCpp(_key1);
std::string key2 = ::djinni::String::toCpp(_key2); std::string key2 = ::djinni::String::toCpp(_key2);
return RecordWithDerivings( return ::RecordWithDerivings(
std::move(key1), std::move(key1),
std::move(key2)); std::move(key2));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBRecordWithNestedDerivings () @interface DBRecordWithNestedDerivings ()
- (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings; - (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings;
- (RecordWithNestedDerivings)cppRecordWithNestedDerivings; - (::RecordWithNestedDerivings)cppRecordWithNestedDerivings;
@end @end
...@@ -31,7 +31,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -31,7 +31,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings - (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings
{ {
if (self = [super init]) { if (self = [super init]) {
_key = ::djinni::I32::fromCpp(recordWithNestedDerivings.key); _key = ::djinni::I32::fromCpp(recordWithNestedDerivings.key);
...@@ -40,11 +40,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -40,11 +40,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (RecordWithNestedDerivings)cppRecordWithNestedDerivings - (::RecordWithNestedDerivings)cppRecordWithNestedDerivings
{ {
int32_t key = ::djinni::I32::toCpp(_key); int32_t key = ::djinni::I32::toCpp(_key);
RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]); ::RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]);
return RecordWithNestedDerivings( return ::RecordWithNestedDerivings(
std::move(key), std::move(key),
std::move(rec)); std::move(rec));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@interface DBSetRecord () @interface DBSetRecord ()
- (id)initWithCppSetRecord:(const SetRecord &)setRecord; - (id)initWithCppSetRecord:(const ::SetRecord &)setRecord;
- (SetRecord)cppSetRecord; - (::SetRecord)cppSetRecord;
@end @end
...@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (id)initWithCppSetRecord:(const SetRecord &)setRecord - (id)initWithCppSetRecord:(const ::SetRecord &)setRecord
{ {
if (self = [super init]) { if (self = [super init]) {
std::vector<NSString *> _setTempVector; std::vector<NSString *> _setTempVector;
...@@ -49,14 +49,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -49,14 +49,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self; return self;
} }
- (SetRecord)cppSetRecord - (::SetRecord)cppSetRecord
{ {
std::unordered_set<std::string> set; std::unordered_set<std::string> set;
for (NSString *objcValue_0 in _set) { for (NSString *objcValue_0 in _set) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0); std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
set.insert(std::move(cppValue_0)); set.insert(std::move(cppValue_0));
} }
return SetRecord( return ::SetRecord(
std::move(set)); std::move(set));
} }
......
...@@ -12,7 +12,7 @@ namespace djinni_generated { ...@@ -12,7 +12,7 @@ namespace djinni_generated {
struct TestHelpers struct TestHelpers
{ {
using CppType = std::shared_ptr<TestHelpers>; using CppType = std::shared_ptr<::TestHelpers>;
using ObjcType = DBTestHelpers*; using ObjcType = DBTestHelpers*;
static CppType toCpp(ObjcType objc); static CppType toCpp(ObjcType objc);
......
...@@ -12,7 +12,7 @@ namespace djinni_generated { ...@@ -12,7 +12,7 @@ namespace djinni_generated {
struct Token struct Token
{ {
using CppType = std::shared_ptr<Token>; using CppType = std::shared_ptr<::Token>;
using ObjcType = DBToken*; using ObjcType = DBToken*;
static CppType toCpp(ObjcType objc); static CppType toCpp(ObjcType objc);
......
...@@ -14,9 +14,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -14,9 +14,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBToken () @interface DBToken ()
@property (nonatomic, readonly) djinni::DbxCppWrapperCache<Token>::Handle cppRef; @property (nonatomic, readonly) djinni::DbxCppWrapperCache<::Token>::Handle cppRef;
- (id)initWithCpp:(const std::shared_ptr<Token>&)cppRef; - (id)initWithCpp:(const std::shared_ptr<::Token>&)cppRef;
@end @end
...@@ -29,7 +29,7 @@ auto Token::toCpp(ObjcType objc) -> CppType ...@@ -29,7 +29,7 @@ auto Token::toCpp(ObjcType objc) -> CppType
auto Token::fromCpp(const CppType& cpp) -> ObjcType auto Token::fromCpp(const CppType& cpp) -> ObjcType
{ {
return !cpp ? nil : djinni::DbxCppWrapperCache<Token>::getInstance()->get(cpp, [] (const auto& p) return !cpp ? nil : djinni::DbxCppWrapperCache<::Token>::getInstance()->get(cpp, [] (const auto& p)
{ {
return [[DBToken alloc] initWithCpp:p]; return [[DBToken alloc] initWithCpp:p];
}); });
...@@ -39,7 +39,7 @@ auto Token::fromCpp(const CppType& cpp) -> ObjcType ...@@ -39,7 +39,7 @@ auto Token::fromCpp(const CppType& cpp) -> ObjcType
@implementation DBToken @implementation DBToken
- (id)initWithCpp:(const std::shared_ptr<Token>&)cppRef - (id)initWithCpp:(const std::shared_ptr<::Token>&)cppRef
{ {
if (self = [super init]) { if (self = [super init]) {
_cppRef.assign(cppRef); _cppRef.assign(cppRef);
......
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