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) {
if (spec.cppEnumHashWorkaround) {
val fqSelf = marshal.fqTypename(ident, e)
w.wl
wrapNamespace(w, Some("std"),
wrapNamespace(w, "std",
(w: IndentWriter) => {
w.wl("template <>")
w.w(s"struct hash<$fqSelf>").bracedSemi {
......
......@@ -13,18 +13,18 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
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 {
case e: Enum => withNs(spec.cppNamespace, idCpp.enumType(name))
case i: Interface => withNs(spec.cppNamespace, idCpp.ty(name))
case r: Record => withNs(spec.cppNamespace, idCpp.ty(name))
case e: Enum => withNs(Some(spec.cppNamespace), idCpp.enumType(name))
case i: Interface => withNs(Some(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 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 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 fqFieldType(tm: MExpr): String = fqTypename(tm)
......
......@@ -31,9 +31,9 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
val jniBaseLibClassIdentStyle = IdentStyle.prefix("H", IdentStyle.camelUpper)
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 => {})) =
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) {
var jniHpp = mutable.TreeSet[String]()
......
......@@ -25,7 +25,7 @@ object Main {
def main(args: Array[String]) {
var idlFile: File = null
var cppOutFolder: Option[File] = None
var cppNamespace: Option[String] = None
var cppNamespace: String = ""
var cppIncludePrefix: String = ""
var cppFileIdentStyle: IdentConverter = IdentStyle.underLower
var cppOptionalTemplate: String = "std::optional"
......@@ -94,7 +94,7 @@ object Main {
.text("The output folder for C++ header files (default: the same as --cpp-out).")
opt[String]("cpp-include-prefix").valueName("<prefix>").foreach(cppIncludePrefix = _)
.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.")
opt[String]("cpp-ext").valueName("<ext>").foreach(cppExt = _)
.text("The filename extension for C++ files (default: \"cpp\").")
......
......@@ -35,5 +35,9 @@ abstract class Marshal(spec: Spec) {
protected val idJava = spec.javaIdentStyle
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) {
w.wl
w.wl((if(i.ext.objc) "@protocol " else "@class ") + self + ";")
w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => {
wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"struct $helperClass")
w.bracedSemi {
w.wl(s"using CppType = std::shared_ptr<$cppSelf>;")
......@@ -200,7 +200,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
w.wl
w.wl("@end")
w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => {
wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType")
w.braced {
w.wl(s"return objc ? objc.cppRef.get() : nullptr;")
......@@ -272,7 +272,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
}
})
w.wl
wrapNamespace(w, Some(spec.objcppNamespace), w => {
wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType")
w.braced {
w.wl(s"return objc ? djinni::DbxObjcWrapperCache<$objcExtSelf>::getInstance()->get(objc) : nullptr;")
......
......@@ -36,7 +36,7 @@ package object generatorTools {
cppOutFolder: Option[File],
cppHeaderOutFolder: Option[File],
cppIncludePrefix: String,
cppNamespace: Option[String],
cppNamespace: String,
cppIdentStyle: CppIdentStyle,
cppFileIdentStyle: IdentConverter,
cppOptionalTemplate: String,
......@@ -213,10 +213,10 @@ abstract class Generator(spec: Spec)
val idJava = spec.javaIdentStyle
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 {
case None => f(w)
case Some(s) =>
case "" => f(w)
case s =>
val parts = s.split("::")
w.wl(parts.map("namespace "+_+" {").mkString(" ")).wl
f(w)
......@@ -233,7 +233,7 @@ abstract class Generator(spec: Spec)
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) => {
w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!")
w.wl("// This file generated by Djinni from " + origin)
......@@ -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) => {
w.wl("// AUTOGENERATED FILE - DO NOT MODIFY!")
w.wl("// This file generated by Djinni from " + origin)
......@@ -289,7 +289,11 @@ abstract class Generator(spec: Spec)
// --------------------------------------------------------------------------
// 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 {
namespace std {
template <>
struct hash<color> {
size_t operator()(color type) const {
struct hash<::color> {
size_t operator()(::color type) const {
return std::hash<int>()(static_cast<int>(type));
}
};
......
......@@ -10,7 +10,7 @@
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);
jshort j_sixteen = ::djinni::HI16::Unboxed::toJava(jniEnv, c.sixteen);
jint j_thirtytwo = ::djinni::HI32::Unboxed::toJava(jniEnv, c.thirtytwo);
......@@ -25,10 +25,10 @@ jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, AssortedIntegers c) {
return r;
}
AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) {
::AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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::HI16::Unboxed::fromJava(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)),
::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)),
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeAssortedIntegers final {
public:
using CppType = AssortedIntegers;
using CppType = ::AssortedIntegers;
using JniType = jobject;
static jobject toJava(JNIEnv*, AssortedIntegers);
static AssortedIntegers fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::AssortedIntegers);
static ::AssortedIntegers fromJava(JNIEnv*, jobject);
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") };
......
......@@ -8,11 +8,11 @@
namespace djinni_generated {
NativeClientInterface::NativeClientInterface() : djinni::JniInterface<ClientInterface, NativeClientInterface>() {}
NativeClientInterface::NativeClientInterface() : djinni::JniInterface<::ClientInterface, NativeClientInterface>() {}
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();
djinni::JniLocalScope jscope(jniEnv, 10);
jlong j_record_id = ::djinni::HI64::Unboxed::toJava(jniEnv, c_record_id);
......
......@@ -8,25 +8,25 @@
namespace djinni_generated {
class NativeClientInterface final : djinni::JniInterface<ClientInterface, NativeClientInterface> {
class NativeClientInterface final : djinni::JniInterface<::ClientInterface, NativeClientInterface> {
public:
using CppType = std::shared_ptr<ClientInterface>;
using CppType = std::shared_ptr<::ClientInterface>;
using JniType = jobject;
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 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); }
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;") };
class JavaProxy final : djinni::JavaProxyCacheEntry, public ClientInterface {
class JavaProxy final : djinni::JavaProxyCacheEntry, public ::ClientInterface {
public:
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:
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>;
};
......
......@@ -7,7 +7,7 @@
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);
djinni::LocalRef<jstring> j_content(jniEnv, ::djinni::HString::toJava(jniEnv, c.content));
const auto & data = djinni::JniClass<::djinni_generated::NativeClientReturnedRecord>::get();
......@@ -16,10 +16,10 @@ jobject NativeClientReturnedRecord::toJava(JNIEnv* jniEnv, ClientReturnedRecord
return r;
}
ClientReturnedRecord NativeClientReturnedRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::ClientReturnedRecord NativeClientReturnedRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mContent))).get()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeClientReturnedRecord final {
public:
using CppType = ClientReturnedRecord;
using CppType = ::ClientReturnedRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, ClientReturnedRecord);
static ClientReturnedRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::ClientReturnedRecord);
static ::ClientReturnedRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/ClientReturnedRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(JLjava/lang/String;)V") };
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeColor final : djinni::JniEnum {
public:
using CppType = color;
using CppType = ::color;
using JniType = jobject;
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 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)); }
private:
NativeColor() : JniEnum("com/dropbox/djinni/test/Color") {}
......
......@@ -7,7 +7,7 @@
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);
djinni::LocalRef<jstring> j_some_string(jniEnv, ::djinni::HString::toJava(jniEnv, c.some_string));
const auto & data = djinni::JniClass<::djinni_generated::NativeConstants>::get();
......@@ -16,10 +16,10 @@ jobject NativeConstants::toJava(JNIEnv* jniEnv, Constants c) {
return r;
}
Constants NativeConstants::fromJava(JNIEnv* jniEnv, jobject j) {
::Constants NativeConstants::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mSomeString))).get()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeConstants final {
public:
using CppType = Constants;
using CppType = ::Constants;
using JniType = jobject;
static jobject toJava(JNIEnv*, Constants);
static Constants fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::Constants);
static ::Constants fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/Constants") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
......
......@@ -7,7 +7,7 @@
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;
......@@ -15,7 +15,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<CppException>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::CppException>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -23,7 +23,7 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{
try {
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();
......@@ -36,7 +36,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv*
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<CppException> cr = CppException::get();
std::shared_ptr<::CppException> cr = ::CppException::get();
return NativeCppException::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......
......@@ -8,13 +8,13 @@
namespace djinni_generated {
class NativeCppException final : djinni::JniInterface<CppException, NativeCppException> {
class NativeCppException final : djinni::JniInterface<::CppException, NativeCppException> {
public:
using CppType = std::shared_ptr<CppException>;
using CppType = std::shared_ptr<::CppException>;
using JniType = jobject;
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 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); }
private:
......
......@@ -6,7 +6,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeDateRecord>::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) {
return r;
}
DateRecord NativeDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::DateRecord NativeDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeDateRecord final {
public:
using CppType = DateRecord;
using CppType = ::DateRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, DateRecord);
static DateRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::DateRecord);
static ::DateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/DateRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/Date;)V") };
......
......@@ -8,7 +8,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapDateRecord>::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) {
return r;
}
MapDateRecord NativeMapDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::MapDateRecord NativeMapDateRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapDateRecord final {
public:
using CppType = MapDateRecord;
using CppType = ::MapDateRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, MapDateRecord);
static MapDateRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::MapDateRecord);
static ::MapDateRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapDateRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
......
......@@ -9,7 +9,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapListRecord>::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) {
return r;
}
MapListRecord NativeMapListRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::MapListRecord NativeMapListRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapListRecord final {
public:
using CppType = MapListRecord;
using CppType = ::MapListRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, MapListRecord);
static MapListRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::MapListRecord);
static ::MapListRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapListRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
......@@ -8,7 +8,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeMapRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_map.get());
......@@ -16,10 +16,10 @@ jobject NativeMapRecord::toJava(JNIEnv* jniEnv, MapRecord c) {
return r;
}
MapRecord NativeMapRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::MapRecord NativeMapRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeMapRecord final {
public:
using CppType = MapRecord;
using CppType = ::MapRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, MapRecord);
static MapRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::MapRecord);
static ::MapRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/MapRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashMap;)V") };
......
......@@ -8,7 +8,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeNestedCollection>::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) {
return r;
}
NestedCollection NativeNestedCollection::fromJava(JNIEnv* jniEnv, jobject j) {
::NestedCollection NativeNestedCollection::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeNestedCollection final {
public:
using CppType = NestedCollection;
using CppType = ::NestedCollection;
using JniType = jobject;
static jobject toJava(JNIEnv*, NestedCollection);
static NestedCollection fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::NestedCollection);
static ::NestedCollection fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/NestedCollection") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
......@@ -7,7 +7,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativePrimitiveList>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_list.get());
......@@ -15,10 +15,10 @@ jobject NativePrimitiveList::toJava(JNIEnv* jniEnv, PrimitiveList c) {
return r;
}
PrimitiveList NativePrimitiveList::fromJava(JNIEnv* jniEnv, jobject j) {
::PrimitiveList NativePrimitiveList::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativePrimitiveList final {
public:
using CppType = PrimitiveList;
using CppType = ::PrimitiveList;
using JniType = jobject;
static jobject toJava(JNIEnv*, PrimitiveList);
static PrimitiveList fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::PrimitiveList);
static ::PrimitiveList fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/PrimitiveList") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/ArrayList;)V") };
......
......@@ -7,7 +7,7 @@
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);
djinni::LocalRef<jstring> j_key2(jniEnv, ::djinni::HString::toJava(jniEnv, c.key2));
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithDerivings>::get();
......@@ -16,10 +16,10 @@ jobject NativeRecordWithDerivings::toJava(JNIEnv* jniEnv, RecordWithDerivings c)
return r;
}
RecordWithDerivings NativeRecordWithDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
::RecordWithDerivings NativeRecordWithDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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::HString::fromJava(jniEnv, djinni::LocalRef<jstring>(jniEnv, static_cast<jstring>(jniEnv->GetObjectField(j, data.field_mKey2))).get()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeRecordWithDerivings final {
public:
using CppType = RecordWithDerivings;
using CppType = ::RecordWithDerivings;
using JniType = jobject;
static jobject toJava(JNIEnv*, RecordWithDerivings);
static RecordWithDerivings fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::RecordWithDerivings);
static ::RecordWithDerivings fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/RecordWithDerivings") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V") };
......
......@@ -7,7 +7,7 @@
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);
djinni::LocalRef<jobject> j_rec(jniEnv, NativeRecordWithDerivings::toJava(jniEnv, c.rec));
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get();
......@@ -16,10 +16,10 @@ jobject NativeRecordWithNestedDerivings::toJava(JNIEnv* jniEnv, RecordWithNested
return r;
}
RecordWithNestedDerivings NativeRecordWithNestedDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
::RecordWithNestedDerivings NativeRecordWithNestedDerivings::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
const auto & data = djinni::JniClass<::djinni_generated::NativeRecordWithNestedDerivings>::get();
return RecordWithNestedDerivings(
return ::RecordWithNestedDerivings(
::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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeRecordWithNestedDerivings final {
public:
using CppType = RecordWithNestedDerivings;
using CppType = ::RecordWithNestedDerivings;
using JniType = jobject;
static jobject toJava(JNIEnv*, RecordWithNestedDerivings);
static RecordWithNestedDerivings fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::RecordWithNestedDerivings);
static ::RecordWithNestedDerivings fromJava(JNIEnv*, jobject);
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") };
......
......@@ -7,7 +7,7 @@
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));
const auto & data = djinni::JniClass<::djinni_generated::NativeSetRecord>::get();
jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_set.get());
......@@ -15,10 +15,10 @@ jobject NativeSetRecord::toJava(JNIEnv* jniEnv, SetRecord c) {
return r;
}
SetRecord NativeSetRecord::fromJava(JNIEnv* jniEnv, jobject j) {
::SetRecord NativeSetRecord::fromJava(JNIEnv* jniEnv, jobject j) {
assert(j != nullptr);
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()));
}
......
......@@ -10,11 +10,11 @@ namespace djinni_generated {
class NativeSetRecord final {
public:
using CppType = SetRecord;
using CppType = ::SetRecord;
using JniType = jobject;
static jobject toJava(JNIEnv*, SetRecord);
static SetRecord fromJava(JNIEnv*, jobject);
static jobject toJava(JNIEnv*, ::SetRecord);
static ::SetRecord fromJava(JNIEnv*, jobject);
const djinni::GlobalRef<jclass> clazz { djinni::jniFindClass("com/dropbox/djinni/test/SetRecord") };
const jmethodID jconstructor { djinni::jniGetMethodID(clazz.get(), "<init>", "(Ljava/util/HashSet;)V") };
......
......@@ -19,7 +19,7 @@
namespace djinni_generated {
NativeTestHelpers::NativeTestHelpers() : djinni::JniInterface<TestHelpers, NativeTestHelpers>("com/dropbox/djinni/test/TestHelpers$CppProxy") {}
NativeTestHelpers::NativeTestHelpers() : djinni::JniInterface<::TestHelpers, NativeTestHelpers>("com/dropbox/djinni/test/TestHelpers$CppProxy") {}
using namespace ::djinni_generated;
......@@ -27,7 +27,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_n
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<TestHelpers>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::TestHelpers>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -36,7 +36,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getSetRecord
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
SetRecord cr = TestHelpers::get_set_record();
::SetRecord cr = ::TestHelpers::get_set_record();
return NativeSetRecord::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -46,9 +46,9 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkSetRec
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
SetRecord c_rec = NativeSetRecord::fromJava(jniEnv, j_rec);
::SetRecord c_rec = NativeSetRecord::fromJava(jniEnv, j_rec);
bool cr = TestHelpers::check_set_record(c_rec);
bool cr = ::TestHelpers::check_set_record(c_rec);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -59,7 +59,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getPrimitive
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
PrimitiveList cr = TestHelpers::get_primitive_list();
::PrimitiveList cr = ::TestHelpers::get_primitive_list();
return NativePrimitiveList::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -69,9 +69,9 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkPrimit
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
PrimitiveList c_pl = NativePrimitiveList::fromJava(jniEnv, j_pl);
::PrimitiveList c_pl = NativePrimitiveList::fromJava(jniEnv, j_pl);
bool cr = TestHelpers::check_primitive_list(c_pl);
bool cr = ::TestHelpers::check_primitive_list(c_pl);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -82,7 +82,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getNestedCol
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
NestedCollection cr = TestHelpers::get_nested_collection();
::NestedCollection cr = ::TestHelpers::get_nested_collection();
return NativeNestedCollection::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -92,9 +92,9 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkNested
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
NestedCollection c_nc = NativeNestedCollection::fromJava(jniEnv, j_nc);
::NestedCollection c_nc = NativeNestedCollection::fromJava(jniEnv, j_nc);
bool cr = TestHelpers::check_nested_collection(c_nc);
bool cr = ::TestHelpers::check_nested_collection(c_nc);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -105,7 +105,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMap(JNIEn
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::unordered_map<std::string, int64_t> cr = TestHelpers::get_map();
std::unordered_map<std::string, int64_t> cr = ::TestHelpers::get_map();
return ::djinni::HMap<::djinni::HString, ::djinni::HI64>::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -117,7 +117,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMap(JN
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::unordered_map<std::string, int64_t> c_m = ::djinni::HMap<::djinni::HString, ::djinni::HI64>::fromJava(jniEnv, j_m);
bool cr = TestHelpers::check_map(c_m);
bool cr = ::TestHelpers::check_map(c_m);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -128,7 +128,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getEmptyMap(
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::unordered_map<std::string, int64_t> cr = TestHelpers::get_empty_map();
std::unordered_map<std::string, int64_t> cr = ::TestHelpers::get_empty_map();
return ::djinni::HMap<::djinni::HString, ::djinni::HI64>::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -140,7 +140,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEmptyM
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::unordered_map<std::string, int64_t> c_m = ::djinni::HMap<::djinni::HString, ::djinni::HI64>::fromJava(jniEnv, j_m);
bool cr = TestHelpers::check_empty_map(c_m);
bool cr = ::TestHelpers::check_empty_map(c_m);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -151,7 +151,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMapListRe
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
MapListRecord cr = TestHelpers::get_map_list_record();
::MapListRecord cr = ::TestHelpers::get_map_list_record();
return NativeMapListRecord::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -161,9 +161,9 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMapLis
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
MapListRecord c_m = NativeMapListRecord::fromJava(jniEnv, j_m);
::MapListRecord c_m = NativeMapListRecord::fromJava(jniEnv, j_m);
bool cr = TestHelpers::check_map_list_record(c_m);
bool cr = ::TestHelpers::check_map_list_record(c_m);
return ::djinni::HBool::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -173,9 +173,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInte
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<ClientInterface> c_i = NativeClientInterface::fromJava(jniEnv, j_i);
std::shared_ptr<::ClientInterface> c_i = NativeClientInterface::fromJava(jniEnv, j_i);
TestHelpers::check_client_interface_ascii(c_i);
::TestHelpers::check_client_interface_ascii(c_i);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -183,9 +183,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInte
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<ClientInterface> c_i = NativeClientInterface::fromJava(jniEnv, j_i);
std::shared_ptr<::ClientInterface> c_i = NativeClientInterface::fromJava(jniEnv, j_i);
TestHelpers::check_client_interface_nonascii(c_i);
::TestHelpers::check_client_interface_nonascii(c_i);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -193,9 +193,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnumMap(JN
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::unordered_map<color, std::string> c_m = ::djinni::HMap<NativeColor, ::djinni::HString>::fromJava(jniEnv, j_m);
std::unordered_map<::color, std::string> c_m = ::djinni::HMap<NativeColor, ::djinni::HString>::fromJava(jniEnv, j_m);
TestHelpers::check_enum_map(c_m);
::TestHelpers::check_enum_map(c_m);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -203,9 +203,9 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_tokenId(JNIE
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<Token> c_t = NativeToken::fromJava(jniEnv, j_t);
std::shared_ptr<::Token> c_t = NativeToken::fromJava(jniEnv, j_t);
std::shared_ptr<Token> cr = TestHelpers::token_id(c_t);
std::shared_ptr<::Token> cr = ::TestHelpers::token_id(c_t);
return NativeToken::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -216,7 +216,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_createCppTok
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<Token> cr = TestHelpers::create_cpp_token();
std::shared_ptr<::Token> cr = ::TestHelpers::create_cpp_token();
return NativeToken::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -226,9 +226,9 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkCppToken(J
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<Token> c_t = NativeToken::fromJava(jniEnv, j_t);
std::shared_ptr<::Token> c_t = NativeToken::fromJava(jniEnv, j_t);
TestHelpers::check_cpp_token(c_t);
::TestHelpers::check_cpp_token(c_t);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -236,9 +236,9 @@ CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestHelpers_cppTokenId(JNI
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::shared_ptr<Token> c_t = NativeToken::fromJava(jniEnv, j_t);
std::shared_ptr<::Token> c_t = NativeToken::fromJava(jniEnv, j_t);
int64_t cr = TestHelpers::cpp_token_id(c_t);
int64_t cr = ::TestHelpers::cpp_token_id(c_t);
return ::djinni::HI64::Unboxed::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -249,7 +249,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_returnNone(J
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
std::experimental::optional<int32_t> cr = TestHelpers::return_none();
std::experimental::optional<int32_t> cr = ::TestHelpers::return_none();
return ::djinni::HOptional<std::experimental::optional, ::djinni::HI32>::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -259,9 +259,9 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_assortedInte
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
AssortedIntegers c_i = NativeAssortedIntegers::fromJava(jniEnv, j_i);
::AssortedIntegers c_i = NativeAssortedIntegers::fromJava(jniEnv, j_i);
AssortedIntegers cr = TestHelpers::assorted_integers_id(c_i);
::AssortedIntegers cr = ::TestHelpers::assorted_integers_id(c_i);
return NativeAssortedIntegers::toJava(jniEnv, cr);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......
......@@ -8,13 +8,13 @@
namespace djinni_generated {
class NativeTestHelpers final : djinni::JniInterface<TestHelpers, NativeTestHelpers> {
class NativeTestHelpers final : djinni::JniInterface<::TestHelpers, NativeTestHelpers> {
public:
using CppType = std::shared_ptr<TestHelpers>;
using CppType = std::shared_ptr<::TestHelpers>;
using JniType = jobject;
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 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); }
private:
......
......@@ -5,7 +5,7 @@
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) {}
using namespace ::djinni_generated;
......@@ -14,7 +14,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_Token_00024CppProxy_nativeD
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<Token>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::Token>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......
......@@ -8,23 +8,23 @@
namespace djinni_generated {
class NativeToken final : djinni::JniInterface<Token, NativeToken> {
class NativeToken final : djinni::JniInterface<::Token, NativeToken> {
public:
using CppType = std::shared_ptr<Token>;
using CppType = std::shared_ptr<::Token>;
using JniType = jobject;
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 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); }
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:
JavaProxy(jobject obj);
private:
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>;
};
......
......@@ -7,7 +7,7 @@
@interface DBAssortedIntegers ()
- (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers;
- (AssortedIntegers)cppAssortedIntegers;
- (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers;
- (::AssortedIntegers)cppAssortedIntegers;
@end
......@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers
- (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers
{
if (self = [super init]) {
_eight = ::djinni::I8::fromCpp(assortedIntegers.eight);
......@@ -89,7 +89,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (AssortedIntegers)cppAssortedIntegers
- (::AssortedIntegers)cppAssortedIntegers
{
int8_t eight = ::djinni::I8::toCpp(_eight);
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
int64_t optValue = ::djinni::I64::Boxed::toCpp(_oSixtyfour);
oSixtyfour = optValue;
}
return AssortedIntegers(
return ::AssortedIntegers(
std::move(eight),
std::move(sixteen),
std::move(thirtytwo),
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct ClientInterface
{
using CppType = std::shared_ptr<ClientInterface>;
using CppType = std::shared_ptr<::ClientInterface>;
using ObjcType = id<DBClientInterface>;
static CppType toCpp(ObjcType objc);
......
......@@ -13,12 +13,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
namespace { // anonymous namespace
class ObjcProxy final
: public ClientInterface
: public ::ClientInterface
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
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
......@@ -38,13 +38,13 @@ auto ClientInterface::fromCpp(const CppType& cpp) -> ObjcType
} // 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 {
int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id);
NSString *cpp_utf8string = ::djinni::String::fromCpp(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;
}
}
......@@ -7,7 +7,7 @@
@interface DBClientReturnedRecord ()
- (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord;
- (ClientReturnedRecord)cppClientReturnedRecord;
- (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord;
- (::ClientReturnedRecord)cppClientReturnedRecord;
@end
......@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord
- (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord
{
if (self = [super init]) {
_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
return self;
}
- (ClientReturnedRecord)cppClientReturnedRecord
- (::ClientReturnedRecord)cppClientReturnedRecord
{
int64_t recordId = ::djinni::I64::toCpp(_recordId);
std::string content = ::djinni::String::toCpp(_content);
return ClientReturnedRecord(
return ::ClientReturnedRecord(
std::move(recordId),
std::move(content));
}
......
......@@ -7,7 +7,7 @@
@interface DBConstants ()
- (id)initWithCppConstants:(const Constants &)constants;
- (Constants)cppConstants;
- (id)initWithCppConstants:(const ::Constants &)constants;
- (::Constants)cppConstants;
@end
......@@ -54,7 +54,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppConstants:(const Constants &)constants
- (id)initWithCppConstants:(const ::Constants &)constants
{
if (self = [super init]) {
_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
return self;
}
- (Constants)cppConstants
- (::Constants)cppConstants
{
int32_t someInteger = ::djinni::I32::toCpp(_someInteger);
std::string someString = ::djinni::String::toCpp(_someString);
return Constants(
return ::Constants(
std::move(someInteger),
std::move(someString));
}
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct CppException
{
using CppType = std::shared_ptr<CppException>;
using CppType = std::shared_ptr<::CppException>;
using ObjcType = DBCppException*;
static CppType toCpp(ObjcType objc);
......
......@@ -16,9 +16,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@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
......@@ -31,7 +31,7 @@ auto CppException::toCpp(ObjcType objc) -> CppType
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];
});
......@@ -41,7 +41,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
@implementation DBCppException
- (id)initWithCpp:(const std::shared_ptr<CppException>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::CppException>&)cppRef
{
if (self = [super init]) {
_cppRef.assign(cppRef);
......@@ -59,7 +59,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
+ (DBCppException *)get {
try {
std::shared_ptr<CppException> cppRet = CppException::get();
std::shared_ptr<::CppException> cppRet = ::CppException::get();
DBCppException* objcRet = ::djinni_generated::CppException::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......
......@@ -7,7 +7,7 @@
@interface DBDateRecord ()
- (id)initWithCppDateRecord:(const DateRecord &)dateRecord;
- (DateRecord)cppDateRecord;
- (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord;
- (::DateRecord)cppDateRecord;
@end
......@@ -28,7 +28,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppDateRecord:(const DateRecord &)dateRecord
- (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord
{
if (self = [super init]) {
_createdAt = [NSDate dateWithTimeIntervalSince1970:
......@@ -37,10 +37,10 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (DateRecord)cppDateRecord
- (::DateRecord)cppDateRecord
{
std::chrono::system_clock::time_point createdAt = ::djinni::convert_date([_createdAt timeIntervalSince1970]);
return DateRecord(
return ::DateRecord(
std::move(createdAt));
}
......
......@@ -7,7 +7,7 @@
@interface DBMapDateRecord ()
- (id)initWithCppMapDateRecord:(const MapDateRecord &)mapDateRecord;
- (MapDateRecord)cppMapDateRecord;
- (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord;
- (::MapDateRecord)cppMapDateRecord;
@end
......@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapDateRecord:(const MapDateRecord &)mapDateRecord
- (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord
{
if (self = [super init]) {
std::vector<NSString *> _datesByIdTempKeyVector;
......@@ -58,7 +58,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (MapDateRecord)cppMapDateRecord
- (::MapDateRecord)cppMapDateRecord
{
std::unordered_map<std::string, std::chrono::system_clock::time_point> 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
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));
}
return MapDateRecord(
return ::MapDateRecord(
std::move(datesById));
}
......
......@@ -7,7 +7,7 @@
@interface DBMapListRecord ()
- (id)initWithCppMapListRecord:(const MapListRecord &)mapListRecord;
- (MapListRecord)cppMapListRecord;
- (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord;
- (::MapListRecord)cppMapListRecord;
@end
......@@ -46,7 +46,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapListRecord:(const MapListRecord &)mapListRecord
- (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord
{
if (self = [super init]) {
std::vector<NSDictionary *> _mapListTempVector;
......@@ -70,7 +70,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (MapListRecord)cppMapListRecord
- (::MapListRecord)cppMapListRecord
{
std::vector<std::unordered_map<std::string, int64_t>> mapList;
mapList.reserve([_mapList count]);
......@@ -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));
}
return MapListRecord(
return ::MapListRecord(
std::move(mapList));
}
......
......@@ -7,7 +7,7 @@
@interface DBMapRecord ()
- (id)initWithCppMapRecord:(const MapRecord &)mapRecord;
- (MapRecord)cppMapRecord;
- (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord;
- (::MapRecord)cppMapRecord;
@end
......@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapRecord:(const MapRecord &)mapRecord
- (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord
{
if (self = [super init]) {
std::vector<NSString *> _mapTempKeyVector;
......@@ -57,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (MapRecord)cppMapRecord
- (::MapRecord)cppMapRecord
{
std::unordered_map<std::string, int64_t> 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
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([_map objectForKey:objcKey_0]);
map.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
return MapRecord(
return ::MapRecord(
std::move(map));
}
......
......@@ -7,7 +7,7 @@
@interface DBNestedCollection ()
- (id)initWithCppNestedCollection:(const NestedCollection &)nestedCollection;
- (NestedCollection)cppNestedCollection;
- (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection;
- (::NestedCollection)cppNestedCollection;
@end
......@@ -42,7 +42,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppNestedCollection:(const NestedCollection &)nestedCollection
- (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection
{
if (self = [super init]) {
std::vector<NSSet *> _setListTempVector;
......@@ -62,7 +62,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (NestedCollection)cppNestedCollection
- (::NestedCollection)cppNestedCollection
{
std::vector<std::unordered_set<std::string>> setList;
setList.reserve([_setList count]);
......@@ -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));
}
return NestedCollection(
return ::NestedCollection(
std::move(setList));
}
......
......@@ -7,7 +7,7 @@
@interface DBPrimitiveList ()
- (id)initWithCppPrimitiveList:(const PrimitiveList &)primitiveList;
- (PrimitiveList)cppPrimitiveList;
- (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList;
- (::PrimitiveList)cppPrimitiveList;
@end
......@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppPrimitiveList:(const PrimitiveList &)primitiveList
- (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList
{
if (self = [super init]) {
std::vector<NSNumber *> _listTempVector;
......@@ -49,7 +49,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (PrimitiveList)cppPrimitiveList
- (::PrimitiveList)cppPrimitiveList
{
std::vector<int64_t> list;
list.reserve([_list count]);
......@@ -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);
list.push_back(std::move(cppValue_0));
}
return PrimitiveList(
return ::PrimitiveList(
std::move(list));
}
......
......@@ -7,7 +7,7 @@
@interface DBRecordWithDerivings ()
- (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings;
- (RecordWithDerivings)cppRecordWithDerivings;
- (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings;
- (::RecordWithDerivings)cppRecordWithDerivings;
@end
......@@ -30,7 +30,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings
- (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings
{
if (self = [super init]) {
_key1 = ::djinni::I32::fromCpp(recordWithDerivings.key1);
......@@ -39,11 +39,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (RecordWithDerivings)cppRecordWithDerivings
- (::RecordWithDerivings)cppRecordWithDerivings
{
int32_t key1 = ::djinni::I32::toCpp(_key1);
std::string key2 = ::djinni::String::toCpp(_key2);
return RecordWithDerivings(
return ::RecordWithDerivings(
std::move(key1),
std::move(key2));
}
......
......@@ -7,7 +7,7 @@
@interface DBRecordWithNestedDerivings ()
- (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings;
- (RecordWithNestedDerivings)cppRecordWithNestedDerivings;
- (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings;
- (::RecordWithNestedDerivings)cppRecordWithNestedDerivings;
@end
......@@ -31,7 +31,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings
- (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings
{
if (self = [super init]) {
_key = ::djinni::I32::fromCpp(recordWithNestedDerivings.key);
......@@ -40,11 +40,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (RecordWithNestedDerivings)cppRecordWithNestedDerivings
- (::RecordWithNestedDerivings)cppRecordWithNestedDerivings
{
int32_t key = ::djinni::I32::toCpp(_key);
RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]);
return RecordWithNestedDerivings(
::RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]);
return ::RecordWithNestedDerivings(
std::move(key),
std::move(rec));
}
......
......@@ -7,7 +7,7 @@
@interface DBSetRecord ()
- (id)initWithCppSetRecord:(const SetRecord &)setRecord;
- (SetRecord)cppSetRecord;
- (id)initWithCppSetRecord:(const ::SetRecord &)setRecord;
- (::SetRecord)cppSetRecord;
@end
......@@ -35,7 +35,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppSetRecord:(const SetRecord &)setRecord
- (id)initWithCppSetRecord:(const ::SetRecord &)setRecord
{
if (self = [super init]) {
std::vector<NSString *> _setTempVector;
......@@ -49,14 +49,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (SetRecord)cppSetRecord
- (::SetRecord)cppSetRecord
{
std::unordered_set<std::string> set;
for (NSString *objcValue_0 in _set) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
set.insert(std::move(cppValue_0));
}
return SetRecord(
return ::SetRecord(
std::move(set));
}
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct TestHelpers
{
using CppType = std::shared_ptr<TestHelpers>;
using CppType = std::shared_ptr<::TestHelpers>;
using ObjcType = DBTestHelpers*;
static CppType toCpp(ObjcType objc);
......
......@@ -22,9 +22,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBTestHelpers ()
@property (nonatomic, readonly) djinni::DbxCppWrapperCache<TestHelpers>::Handle cppRef;
@property (nonatomic, readonly) djinni::DbxCppWrapperCache<::TestHelpers>::Handle cppRef;
- (id)initWithCpp:(const std::shared_ptr<TestHelpers>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::TestHelpers>&)cppRef;
@end
......@@ -37,7 +37,7 @@ auto TestHelpers::toCpp(ObjcType objc) -> CppType
auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
{
return !cpp ? nil : djinni::DbxCppWrapperCache<TestHelpers>::getInstance()->get(cpp, [] (const auto& p)
return !cpp ? nil : djinni::DbxCppWrapperCache<::TestHelpers>::getInstance()->get(cpp, [] (const auto& p)
{
return [[DBTestHelpers alloc] initWithCpp:p];
});
......@@ -47,7 +47,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
@implementation DBTestHelpers
- (id)initWithCpp:(const std::shared_ptr<TestHelpers>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::TestHelpers>&)cppRef
{
if (self = [super init]) {
_cppRef.assign(cppRef);
......@@ -57,7 +57,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBSetRecord *)getSetRecord {
try {
SetRecord cppRet = TestHelpers::get_set_record();
::SetRecord cppRet = ::TestHelpers::get_set_record();
DBSetRecord *objcRet = [[DBSetRecord alloc] initWithCppSetRecord:cppRet];
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -65,8 +65,8 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (BOOL)checkSetRecord:(DBSetRecord *)rec {
try {
SetRecord cppRec = std::move([rec cppSetRecord]);
bool cppRet = TestHelpers::check_set_record(std::move(cppRec));
::SetRecord cppRec = std::move([rec cppSetRecord]);
bool cppRet = ::TestHelpers::check_set_record(std::move(cppRec));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -74,7 +74,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBPrimitiveList *)getPrimitiveList {
try {
PrimitiveList cppRet = TestHelpers::get_primitive_list();
::PrimitiveList cppRet = ::TestHelpers::get_primitive_list();
DBPrimitiveList *objcRet = [[DBPrimitiveList alloc] initWithCppPrimitiveList:cppRet];
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -82,8 +82,8 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (BOOL)checkPrimitiveList:(DBPrimitiveList *)pl {
try {
PrimitiveList cppPl = std::move([pl cppPrimitiveList]);
bool cppRet = TestHelpers::check_primitive_list(std::move(cppPl));
::PrimitiveList cppPl = std::move([pl cppPrimitiveList]);
bool cppRet = ::TestHelpers::check_primitive_list(std::move(cppPl));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -91,7 +91,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBNestedCollection *)getNestedCollection {
try {
NestedCollection cppRet = TestHelpers::get_nested_collection();
::NestedCollection cppRet = ::TestHelpers::get_nested_collection();
DBNestedCollection *objcRet = [[DBNestedCollection alloc] initWithCppNestedCollection:cppRet];
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -99,8 +99,8 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (BOOL)checkNestedCollection:(DBNestedCollection *)nc {
try {
NestedCollection cppNc = std::move([nc cppNestedCollection]);
bool cppRet = TestHelpers::check_nested_collection(std::move(cppNc));
::NestedCollection cppNc = std::move([nc cppNestedCollection]);
bool cppRet = ::TestHelpers::check_nested_collection(std::move(cppNc));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -108,7 +108,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (NSDictionary *)getMap {
try {
std::unordered_map<std::string, int64_t> cppRet = TestHelpers::get_map();
std::unordered_map<std::string, int64_t> cppRet = ::TestHelpers::get_map();
std::vector<NSString *> objcRetTempKeyVector;
objcRetTempKeyVector.reserve(cppRet.size());
std::vector<NSNumber *> objcRetTempValueVector;
......@@ -132,7 +132,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([m objectForKey:objcKey_0]);
cppM.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
bool cppRet = TestHelpers::check_map(std::move(cppM));
bool cppRet = ::TestHelpers::check_map(std::move(cppM));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -140,7 +140,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (NSDictionary *)getEmptyMap {
try {
std::unordered_map<std::string, int64_t> cppRet = TestHelpers::get_empty_map();
std::unordered_map<std::string, int64_t> cppRet = ::TestHelpers::get_empty_map();
std::vector<NSString *> objcRetTempKeyVector;
objcRetTempKeyVector.reserve(cppRet.size());
std::vector<NSNumber *> objcRetTempValueVector;
......@@ -164,7 +164,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([m objectForKey:objcKey_0]);
cppM.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
bool cppRet = TestHelpers::check_empty_map(std::move(cppM));
bool cppRet = ::TestHelpers::check_empty_map(std::move(cppM));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -172,7 +172,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBMapListRecord *)getMapListRecord {
try {
MapListRecord cppRet = TestHelpers::get_map_list_record();
::MapListRecord cppRet = ::TestHelpers::get_map_list_record();
DBMapListRecord *objcRet = [[DBMapListRecord alloc] initWithCppMapListRecord:cppRet];
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -180,8 +180,8 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (BOOL)checkMapListRecord:(DBMapListRecord *)m {
try {
MapListRecord cppM = std::move([m cppMapListRecord]);
bool cppRet = TestHelpers::check_map_list_record(std::move(cppM));
::MapListRecord cppM = std::move([m cppMapListRecord]);
bool cppRet = ::TestHelpers::check_map_list_record(std::move(cppM));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -189,34 +189,34 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (void)checkClientInterfaceAscii:(id<DBClientInterface>)i {
try {
std::shared_ptr<ClientInterface> cppI = ::djinni_generated::ClientInterface::toCpp(i);
TestHelpers::check_client_interface_ascii(std::move(cppI));
std::shared_ptr<::ClientInterface> cppI = ::djinni_generated::ClientInterface::toCpp(i);
::TestHelpers::check_client_interface_ascii(std::move(cppI));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkClientInterfaceNonascii:(id<DBClientInterface>)i {
try {
std::shared_ptr<ClientInterface> cppI = ::djinni_generated::ClientInterface::toCpp(i);
TestHelpers::check_client_interface_nonascii(std::move(cppI));
std::shared_ptr<::ClientInterface> cppI = ::djinni_generated::ClientInterface::toCpp(i);
::TestHelpers::check_client_interface_nonascii(std::move(cppI));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkEnumMap:(NSDictionary *)m {
try {
std::unordered_map<color, std::string> cppM;
std::unordered_map<::color, std::string> cppM;
for (id objcKey_0 in m) {
color cppKey_0 = ::djinni::Enum<color, DBColor>::Boxed::toCpp(objcKey_0);
::color cppKey_0 = ::djinni::Enum<::color, DBColor>::Boxed::toCpp(objcKey_0);
std::string cppValue_0 = ::djinni::String::toCpp([m objectForKey:objcKey_0]);
cppM.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
TestHelpers::check_enum_map(std::move(cppM));
::TestHelpers::check_enum_map(std::move(cppM));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (DBToken *)tokenId:(DBToken *)t {
try {
std::shared_ptr<Token> cppT = ::djinni_generated::Token::toCpp(t);
std::shared_ptr<Token> cppRet = TestHelpers::token_id(std::move(cppT));
std::shared_ptr<::Token> cppT = ::djinni_generated::Token::toCpp(t);
std::shared_ptr<::Token> cppRet = ::TestHelpers::token_id(std::move(cppT));
DBToken* objcRet = ::djinni_generated::Token::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -224,7 +224,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBToken *)createCppToken {
try {
std::shared_ptr<Token> cppRet = TestHelpers::create_cpp_token();
std::shared_ptr<::Token> cppRet = ::TestHelpers::create_cpp_token();
DBToken* objcRet = ::djinni_generated::Token::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -232,15 +232,15 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (void)checkCppToken:(DBToken *)t {
try {
std::shared_ptr<Token> cppT = ::djinni_generated::Token::toCpp(t);
TestHelpers::check_cpp_token(std::move(cppT));
std::shared_ptr<::Token> cppT = ::djinni_generated::Token::toCpp(t);
::TestHelpers::check_cpp_token(std::move(cppT));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (int64_t)cppTokenId:(DBToken *)t {
try {
std::shared_ptr<Token> cppT = ::djinni_generated::Token::toCpp(t);
int64_t cppRet = TestHelpers::cpp_token_id(std::move(cppT));
std::shared_ptr<::Token> cppT = ::djinni_generated::Token::toCpp(t);
int64_t cppRet = ::TestHelpers::cpp_token_id(std::move(cppT));
int64_t objcRet = ::djinni::I64::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......@@ -248,7 +248,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (NSNumber *)returnNone {
try {
std::experimental::optional<int32_t> cppRet = TestHelpers::return_none();
std::experimental::optional<int32_t> cppRet = ::TestHelpers::return_none();
NSNumber *objcRet;
if (cppRet) {
objcRet = ::djinni::I32::Boxed::fromCpp((*(cppRet)));
......@@ -261,8 +261,8 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBAssortedIntegers *)assortedIntegersId:(DBAssortedIntegers *)i {
try {
AssortedIntegers cppI = std::move([i cppAssortedIntegers]);
AssortedIntegers cppRet = TestHelpers::assorted_integers_id(std::move(cppI));
::AssortedIntegers cppI = std::move([i cppAssortedIntegers]);
::AssortedIntegers cppRet = ::TestHelpers::assorted_integers_id(std::move(cppI));
DBAssortedIntegers *objcRet = [[DBAssortedIntegers alloc] initWithCppAssortedIntegers:cppRet];
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct Token
{
using CppType = std::shared_ptr<Token>;
using CppType = std::shared_ptr<::Token>;
using ObjcType = DBToken*;
static CppType toCpp(ObjcType objc);
......
......@@ -14,9 +14,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@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
......@@ -29,7 +29,7 @@ auto Token::toCpp(ObjcType objc) -> CppType
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];
});
......@@ -39,7 +39,7 @@ auto Token::fromCpp(const CppType& cpp) -> ObjcType
@implementation DBToken
- (id)initWithCpp:(const std::shared_ptr<Token>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::Token>&)cppRef
{
if (self = [super init]) {
_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