Commit be210d55 authored by Andrew Twyman's avatar Andrew Twyman

Merge pull request #187 from tiwoc/typetag-cpp-test

Extend multiple inheritance tests by C++ tests
parents 49018487 ae9af63c
......@@ -10,4 +10,4 @@
@import "test.djinni"
@import "primtypes.djinni"
@import "constants.djinni"
@import "listeners.djinni"
@import "multiple_inheritance.djinni"
# Used for ObjC multiple inheritance tests
first_listener = interface +o {
first();
}
# Used for ObjC multiple inheritance tests
second_listener = interface +o {
second();
}
......@@ -15,3 +17,16 @@ listener_caller = interface +c {
callFirst();
callSecond();
}
# Used for C++ multiple inheritance tests
return_one = interface +c {
static get_instance(): return_one;
return_one(): i8;
}
# Used for C++ multiple inheritance tests
return_two = interface +c {
static get_instance(): return_two;
return_two(): i8;
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
namespace testsuite {
/** Used for ObjC multiple inheritance tests */
class FirstListener {
public:
virtual ~FirstListener() {}
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include <cstdint>
#include <memory>
namespace testsuite {
/** Used for C++ multiple inheritance tests */
class ReturnOne {
public:
virtual ~ReturnOne() {}
static std::shared_ptr<ReturnOne> get_instance();
virtual int8_t return_one() = 0;
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include <cstdint>
#include <memory>
namespace testsuite {
/** Used for C++ multiple inheritance tests */
class ReturnTwo {
public:
virtual ~ReturnTwo() {}
static std::shared_ptr<ReturnTwo> get_instance();
virtual int8_t return_two() = 0;
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
namespace testsuite {
/** Used for ObjC multiple inheritance tests */
class SecondListener {
public:
virtual ~SecondListener() {}
......
......@@ -12,7 +12,7 @@ djinni/user_token.djinni
djinni/test.djinni
djinni/primtypes.djinni
djinni/constants.djinni
djinni/listeners.djinni
djinni/multiple_inheritance.djinni
djinni/date.djinni
djinni/date.yaml
djinni/duration.djinni
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for ObjC multiple inheritance tests */
public abstract class FirstListener {
public abstract void first();
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for C++ multiple inheritance tests */
public abstract class ReturnOne {
public abstract byte returnOne();
@CheckForNull
public static native ReturnOne getInstance();
private static final class CppProxy extends ReturnOne
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public byte returnOne()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_returnOne(this.nativeRef);
}
private native byte native_returnOne(long _nativeRef);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for C++ multiple inheritance tests */
public abstract class ReturnTwo {
public abstract byte returnTwo();
@CheckForNull
public static native ReturnTwo getInstance();
private static final class CppProxy extends ReturnTwo
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public byte returnTwo()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_returnTwo(this.nativeRef);
}
private native byte native_returnTwo(long _nativeRef);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for ObjC multiple inheritance tests */
public abstract class SecondListener {
public abstract void second();
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeFirstListener.hpp" // my header
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeListenerCaller.hpp" // my header
#include "NativeFirstListener.hpp"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeReturnOne.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnOne.hpp"
namespace djinni_generated {
NativeReturnOne::NativeReturnOne() : ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne>("com/dropbox/djinni/test/ReturnOne$CppProxy") {}
NativeReturnOne::~NativeReturnOne() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::ReturnOne>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnOne_getInstance(JNIEnv* jniEnv, jobject /*this*/)
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::testsuite::ReturnOne::get_instance();
return ::djinni::release(::djinni_generated::NativeReturnOne::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT jbyte JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_native_1returnOne(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ReturnOne>(nativeRef);
auto r = ref->return_one();
return ::djinni::release(::djinni::I8::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include "djinni_support.hpp"
#include "return_one.hpp"
namespace djinni_generated {
class NativeReturnOne final : ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne> {
public:
using CppType = std::shared_ptr<::testsuite::ReturnOne>;
using CppOptType = std::shared_ptr<::testsuite::ReturnOne>;
using JniType = jobject;
using Boxed = NativeReturnOne;
~NativeReturnOne();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeReturnOne>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeReturnOne>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeReturnOne();
friend ::djinni::JniClass<NativeReturnOne>;
friend ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeReturnTwo.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnTwo.hpp"
namespace djinni_generated {
NativeReturnTwo::NativeReturnTwo() : ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo>("com/dropbox/djinni/test/ReturnTwo$CppProxy") {}
NativeReturnTwo::~NativeReturnTwo() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::ReturnTwo>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnTwo_getInstance(JNIEnv* jniEnv, jobject /*this*/)
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::testsuite::ReturnTwo::get_instance();
return ::djinni::release(::djinni_generated::NativeReturnTwo::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT jbyte JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_native_1returnTwo(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ReturnTwo>(nativeRef);
auto r = ref->return_two();
return ::djinni::release(::djinni::I8::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include "djinni_support.hpp"
#include "return_two.hpp"
namespace djinni_generated {
class NativeReturnTwo final : ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo> {
public:
using CppType = std::shared_ptr<::testsuite::ReturnTwo>;
using CppOptType = std::shared_ptr<::testsuite::ReturnTwo>;
using JniType = jobject;
using Boxed = NativeReturnTwo;
~NativeReturnTwo();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeReturnTwo>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeReturnTwo>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeReturnTwo();
friend ::djinni::JniClass<NativeReturnTwo>;
friend ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeSecondListener.hpp" // my header
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "first_listener.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBFirstListener+Private.h"
#import "DBFirstListener.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
/** Used for ObjC multiple inheritance tests */
@protocol DBFirstListener
- (void)first;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "listener_caller.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBListenerCaller+Private.h"
#import "DBListenerCaller.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBListenerCaller;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "return_one.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBReturnOne;
namespace djinni_generated {
class ReturnOne
{
public:
using CppType = std::shared_ptr<::testsuite::ReturnOne>;
using CppOptType = std::shared_ptr<::testsuite::ReturnOne>;
using ObjcType = DBReturnOne*;
using Boxed = ReturnOne;
static CppType toCpp(ObjcType objc);
static ObjcType fromCppOpt(const CppOptType& cpp);
static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBReturnOne+Private.h"
#import "DBReturnOne.h"
#import "DBReturnOne+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBReturnOne ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnOne>&)cppRef;
@end
@implementation DBReturnOne {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::ReturnOne>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnOne>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
+ (nullable DBReturnOne *)getInstance {
try {
auto r = ::testsuite::ReturnOne::get_instance();
return ::djinni_generated::ReturnOne::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
- (int8_t)returnOne {
try {
auto r = _cppRefHandle.get()->return_one();
return ::djinni::I8::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
namespace djinni_generated {
auto ReturnOne::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto ReturnOne::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBReturnOne>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBReturnOne;
/** Used for C++ multiple inheritance tests */
@interface DBReturnOne : NSObject
+ (nullable DBReturnOne *)getInstance;
- (int8_t)returnOne;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "return_two.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBReturnTwo;
namespace djinni_generated {
class ReturnTwo
{
public:
using CppType = std::shared_ptr<::testsuite::ReturnTwo>;
using CppOptType = std::shared_ptr<::testsuite::ReturnTwo>;
using ObjcType = DBReturnTwo*;
using Boxed = ReturnTwo;
static CppType toCpp(ObjcType objc);
static ObjcType fromCppOpt(const CppOptType& cpp);
static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBReturnTwo+Private.h"
#import "DBReturnTwo.h"
#import "DBReturnTwo+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBReturnTwo ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnTwo>&)cppRef;
@end
@implementation DBReturnTwo {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::ReturnTwo>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnTwo>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
+ (nullable DBReturnTwo *)getInstance {
try {
auto r = ::testsuite::ReturnTwo::get_instance();
return ::djinni_generated::ReturnTwo::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
- (int8_t)returnTwo {
try {
auto r = _cppRefHandle.get()->return_two();
return ::djinni::I8::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
namespace djinni_generated {
auto ReturnTwo::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto ReturnTwo::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBReturnTwo>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBReturnTwo;
/** Used for C++ multiple inheritance tests */
@interface DBReturnTwo : NSObject
+ (nullable DBReturnTwo *)getInstance;
- (int8_t)returnTwo;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "second_listener.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBSecondListener+Private.h"
#import "DBSecondListener.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
/** Used for ObjC multiple inheritance tests */
@protocol DBSecondListener
- (void)second;
......
......@@ -7,6 +7,8 @@ djinni-output-temp/cpp/map_date_record.hpp
djinni-output-temp/cpp/first_listener.hpp
djinni-output-temp/cpp/second_listener.hpp
djinni-output-temp/cpp/listener_caller.hpp
djinni-output-temp/cpp/return_one.hpp
djinni-output-temp/cpp/return_two.hpp
djinni-output-temp/cpp/constant_record.hpp
djinni-output-temp/cpp/constants.hpp
djinni-output-temp/cpp/constants.cpp
......@@ -39,6 +41,8 @@ djinni-output-temp/java/MapDateRecord.java
djinni-output-temp/java/FirstListener.java
djinni-output-temp/java/SecondListener.java
djinni-output-temp/java/ListenerCaller.java
djinni-output-temp/java/ReturnOne.java
djinni-output-temp/java/ReturnTwo.java
djinni-output-temp/java/ConstantRecord.java
djinni-output-temp/java/Constants.java
djinni-output-temp/java/ConstantsInterface.java
......@@ -73,6 +77,10 @@ djinni-output-temp/jni/NativeSecondListener.hpp
djinni-output-temp/jni/NativeSecondListener.cpp
djinni-output-temp/jni/NativeListenerCaller.hpp
djinni-output-temp/jni/NativeListenerCaller.cpp
djinni-output-temp/jni/NativeReturnOne.hpp
djinni-output-temp/jni/NativeReturnOne.cpp
djinni-output-temp/jni/NativeReturnTwo.hpp
djinni-output-temp/jni/NativeReturnTwo.cpp
djinni-output-temp/jni/NativeConstantRecord.hpp
djinni-output-temp/jni/NativeConstantRecord.cpp
djinni-output-temp/jni/NativeConstants.hpp
......@@ -122,6 +130,8 @@ djinni-output-temp/objc/DBMapDateRecord.mm
djinni-output-temp/objc/DBFirstListener.h
djinni-output-temp/objc/DBSecondListener.h
djinni-output-temp/objc/DBListenerCaller.h
djinni-output-temp/objc/DBReturnOne.h
djinni-output-temp/objc/DBReturnTwo.h
djinni-output-temp/objc/DBConstantRecord.h
djinni-output-temp/objc/DBConstantRecord.mm
djinni-output-temp/objc/DBConstants.h
......@@ -170,6 +180,10 @@ djinni-output-temp/objc/DBSecondListener+Private.h
djinni-output-temp/objc/DBSecondListener+Private.mm
djinni-output-temp/objc/DBListenerCaller+Private.h
djinni-output-temp/objc/DBListenerCaller+Private.mm
djinni-output-temp/objc/DBReturnOne+Private.h
djinni-output-temp/objc/DBReturnOne+Private.mm
djinni-output-temp/objc/DBReturnTwo+Private.h
djinni-output-temp/objc/DBReturnTwo+Private.mm
djinni-output-temp/objc/DBConstantRecord+Private.h
djinni-output-temp/objc/DBConstantRecord+Private.mm
djinni-output-temp/objc/DBConstants+Private.h
......
#include "return_one.hpp"
#include "return_two.hpp"
namespace testsuite {
class ReturnOneTwo : public ReturnOne, public ReturnTwo {
public:
static std::shared_ptr<ReturnOneTwo> shared_instance() {
static auto instance = std::make_shared<ReturnOneTwo>();
return instance;
}
int8_t return_one() override { return 1; }
int8_t return_two() override { return 2; }
};
std::shared_ptr<ReturnOne> ReturnOne::get_instance() {
return ReturnOneTwo::shared_instance();
}
std::shared_ptr<ReturnTwo> ReturnTwo::get_instance() {
return ReturnOneTwo::shared_instance();
}
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "DBFirstListener.h"
#include "DBSecondListener.h"
#include "DBListenerCaller.h"
#include "DBReturnOne.h"
#include "DBReturnTwo.h"
@interface Listener : NSObject <DBFirstListener, DBSecondListener>
@property bool firstCalled;
......@@ -30,11 +32,11 @@
@end
@interface DBListenerCallerTest : XCTestCase
// test instance of ObjC class implementing two +o interfaces, passed to C++
@interface DBObjcMultipleInheritanceTest : XCTestCase
@end
@implementation DBListenerCallerTest {
@implementation DBObjcMultipleInheritanceTest {
Listener *listener;
DBListenerCaller *caller;
}
......@@ -56,3 +58,21 @@
}
@end
// test instance of C++ class implementing two +c interfaces, used in ObjC
@interface DBCppMultipleInheritanceTest : XCTestCase
@end
@implementation DBCppMultipleInheritanceTest
- (void)testReturnOne {
DBReturnOne *returnOne = [DBReturnOne getInstance];
XCTAssertEqual([returnOne returnOne], 1);
}
- (void)testReturnTwo {
DBReturnTwo *returnTwo = [DBReturnTwo getInstance];
XCTAssertEqual([returnTwo returnTwo], 2);
}
@end
\ No newline at end of file
......@@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
650CA05A1C2AB48E007ADDDB /* DBListenerCaller+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = 650CA0571C2AB48E007ADDDB /* DBListenerCaller+Private.mm */; };
650CA05E1C2AB5AB007ADDDB /* ListenerCaller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 650CA05D1C2AB5AB007ADDDB /* ListenerCaller.cpp */; };
650CA0601C2AB6DB007ADDDB /* DBListenerCallerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 650CA05B1C2AB524007ADDDB /* DBListenerCallerTest.m */; };
650CA0601C2AB6DB007ADDDB /* DBMultipleInheritanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 650CA05B1C2AB524007ADDDB /* DBMultipleInheritanceTests.m */; };
6536CD7419A6C96C00DD7715 /* DBClientInterfaceImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6536CD7219A6C96C00DD7715 /* DBClientInterfaceImpl.mm */; };
6536CD7819A6C98800DD7715 /* cpp_exception_impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6536CD7619A6C98800DD7715 /* cpp_exception_impl.cpp */; };
6536CD8D19A6C9A800DD7715 /* DBClientInterfaceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6536CD7A19A6C99800DD7715 /* DBClientInterfaceTests.mm */; };
......@@ -22,6 +22,9 @@
6536CD9419A6C9A800DD7715 /* DBSetRecordTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6536CD8119A6C99800DD7715 /* DBSetRecordTests.mm */; };
655168421C404B81003682A4 /* DBFirstListener+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6551683E1C404B81003682A4 /* DBFirstListener+Private.mm */; };
655168431C404B81003682A4 /* DBSecondListener+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = 655168411C404B81003682A4 /* DBSecondListener+Private.mm */; };
6551684C1C4050A4003682A4 /* DBReturnOne+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = 655168481C4050A4003682A4 /* DBReturnOne+Private.mm */; };
6551684D1C4050A4003682A4 /* DBReturnTwo+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6551684B1C4050A4003682A4 /* DBReturnTwo+Private.mm */; };
6551684F1C40511C003682A4 /* return_one_two.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6551684E1C40511C003682A4 /* return_one_two.cpp */; };
65868B4E1989FE4200D60EEE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B4D1989FE4200D60EEE /* Foundation.framework */; };
65868B5C1989FE4200D60EEE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B5B1989FE4200D60EEE /* XCTest.framework */; };
65868B5D1989FE4200D60EEE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B4D1989FE4200D60EEE /* Foundation.framework */; };
......@@ -136,7 +139,7 @@
650CA0551C2AB48E007ADDDB /* DBListenerCaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBListenerCaller.h; sourceTree = "<group>"; };
650CA0561C2AB48E007ADDDB /* DBListenerCaller+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBListenerCaller+Private.h"; sourceTree = "<group>"; };
650CA0571C2AB48E007ADDDB /* DBListenerCaller+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBListenerCaller+Private.mm"; sourceTree = "<group>"; };
650CA05B1C2AB524007ADDDB /* DBListenerCallerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBListenerCallerTest.m; sourceTree = "<group>"; };
650CA05B1C2AB524007ADDDB /* DBMultipleInheritanceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBMultipleInheritanceTests.m; sourceTree = "<group>"; };
650CA05D1C2AB5AB007ADDDB /* ListenerCaller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListenerCaller.cpp; sourceTree = "<group>"; };
6536CD6A19A6C82200DD7715 /* DJIError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJIError.h; sourceTree = "<group>"; };
6536CD6C19A6C82200DD7715 /* DJIProxyCaches.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DJIProxyCaches.mm; sourceTree = "<group>"; };
......@@ -164,6 +167,15 @@
6551683F1C404B81003682A4 /* DBSecondListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBSecondListener.h; sourceTree = "<group>"; };
655168401C404B81003682A4 /* DBSecondListener+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBSecondListener+Private.h"; sourceTree = "<group>"; };
655168411C404B81003682A4 /* DBSecondListener+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBSecondListener+Private.mm"; sourceTree = "<group>"; };
655168441C40508A003682A4 /* return_one.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = return_one.hpp; sourceTree = "<group>"; };
655168451C40508A003682A4 /* return_two.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = return_two.hpp; sourceTree = "<group>"; };
655168461C4050A4003682A4 /* DBReturnOne.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBReturnOne.h; sourceTree = "<group>"; };
655168471C4050A4003682A4 /* DBReturnOne+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBReturnOne+Private.h"; sourceTree = "<group>"; };
655168481C4050A4003682A4 /* DBReturnOne+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBReturnOne+Private.mm"; sourceTree = "<group>"; };
655168491C4050A4003682A4 /* DBReturnTwo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBReturnTwo.h; sourceTree = "<group>"; };
6551684A1C4050A4003682A4 /* DBReturnTwo+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBReturnTwo+Private.h"; sourceTree = "<group>"; };
6551684B1C4050A4003682A4 /* DBReturnTwo+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBReturnTwo+Private.mm"; sourceTree = "<group>"; };
6551684E1C40511C003682A4 /* return_one_two.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = return_one_two.cpp; sourceTree = "<group>"; };
65868B4A1989FE4200D60EEE /* libDjinniObjcTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDjinniObjcTest.a; sourceTree = BUILT_PRODUCTS_DIR; };
65868B4D1989FE4200D60EEE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
65868B5A1989FE4200D60EEE /* DjinniObjcTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DjinniObjcTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -375,6 +387,7 @@
650CA05D1C2AB5AB007ADDDB /* ListenerCaller.cpp */,
A278D45219BA3601006FD937 /* test_helpers.cpp */,
CFC5D9FB1B152E4300BF2DF8 /* TranslateDuration.cpp */,
6551684E1C40511C003682A4 /* return_one_two.cpp */,
);
name = "handwritten-cpp";
path = "../handwritten-src/cpp";
......@@ -388,8 +401,8 @@
6536CD7B19A6C99800DD7715 /* DBCppExceptionTests.mm */,
CFEFA65B1B25CFEA008EE2D0 /* DBDateRecordTests.mm */,
CFC5D9F11B15276900BF2DF8 /* DBDurationTests.m */,
650CA05B1C2AB524007ADDDB /* DBListenerCallerTest.m */,
6536CD7C19A6C99800DD7715 /* DBMapRecordTests.mm */,
650CA05B1C2AB524007ADDDB /* DBMultipleInheritanceTests.m */,
6536CD7D19A6C99800DD7715 /* DBNestedCollectionTests.mm */,
6536CD7E19A6C99800DD7715 /* DBPrimitiveListTests.mm */,
B52DA56F1B104025005CE75F /* DBPrimitivesTests.m */,
......@@ -530,6 +543,12 @@
A24850241AF96EBC00AFE907 /* DBRecordWithNestedDerivings.mm */,
A24249401AF192E0003BF8F0 /* DBRecordWithNestedDerivings+Private.h */,
A238CA881AF84B7100CDDCE5 /* DBRecordWithNestedDerivings+Private.mm */,
655168461C4050A4003682A4 /* DBReturnOne.h */,
655168471C4050A4003682A4 /* DBReturnOne+Private.h */,
655168481C4050A4003682A4 /* DBReturnOne+Private.mm */,
655168491C4050A4003682A4 /* DBReturnTwo.h */,
6551684A1C4050A4003682A4 /* DBReturnTwo+Private.h */,
6551684B1C4050A4003682A4 /* DBReturnTwo+Private.mm */,
6551683F1C404B81003682A4 /* DBSecondListener.h */,
655168401C404B81003682A4 /* DBSecondListener+Private.h */,
655168411C404B81003682A4 /* DBSecondListener+Private.mm */,
......@@ -587,6 +606,8 @@
CFC5DA0D1B15330000BF2DF8 /* record_with_duration_and_derivings.hpp */,
A242496E1AF192FC003BF8F0 /* record_with_nested_derivings.cpp */,
A242496F1AF192FC003BF8F0 /* record_with_nested_derivings.hpp */,
655168441C40508A003682A4 /* return_one.hpp */,
655168451C40508A003682A4 /* return_two.hpp */,
6551683B1C404B58003682A4 /* second_listener.hpp */,
A24249701AF192FC003BF8F0 /* set_record.hpp */,
CFC5DA031B15319600BF2DF8 /* test_duration.hpp */,
......@@ -691,6 +712,7 @@
CFFD588F1B019E79001E10B6 /* DBTestHelpers+Private.mm in Sources */,
A24850291AF96EBC00AFE907 /* DBDateRecord.mm in Sources */,
A278D45319BA3601006FD937 /* test_helpers.cpp in Sources */,
6551684C1C4050A4003682A4 /* DBReturnOne+Private.mm in Sources */,
CFFD588D1B019E79001E10B6 /* DBCppException+Private.mm in Sources */,
A238CA921AF84B7100CDDCE5 /* DBDateRecord+Private.mm in Sources */,
A248502B1AF96EBC00AFE907 /* DBMapListRecord.mm in Sources */,
......@@ -727,6 +749,7 @@
A238CAA21AF84B7100CDDCE5 /* DBSetRecord+Private.mm in Sources */,
A2AE38491BB3074800B7A0C9 /* DJIProxyCaches.mm in Sources */,
A238CA9E1AF84B7100CDDCE5 /* DBRecordWithDerivings+Private.mm in Sources */,
6551684F1C40511C003682A4 /* return_one_two.cpp in Sources */,
A24249751AF192FC003BF8F0 /* record_with_derivings.cpp in Sources */,
CFC5D9D01B15105100BF2DF8 /* extern_record_with_derivings.cpp in Sources */,
A238CA901AF84B7100CDDCE5 /* DBConstants+Private.mm in Sources */,
......@@ -735,6 +758,7 @@
650CA05E1C2AB5AB007ADDDB /* ListenerCaller.cpp in Sources */,
A248502A1AF96EBC00AFE907 /* DBMapDateRecord.mm in Sources */,
A238CA8E1AF84B7100CDDCE5 /* DBClientReturnedRecord+Private.mm in Sources */,
6551684D1C4050A4003682A4 /* DBReturnTwo+Private.mm in Sources */,
B52DA56B1B103F75005CE75F /* DBAssortedPrimitives+Private.mm in Sources */,
A248502E1AF96EBC00AFE907 /* DBPrimitiveList.mm in Sources */,
A209B57A1BBA2A0A0070C310 /* DBOptColorRecord+Private.mm in Sources */,
......@@ -764,7 +788,7 @@
CFC5DA021B15318B00BF2DF8 /* DBTestDuration+Private.mm in Sources */,
CFFD58B41B041BD9001E10B6 /* DBConstantsInterface+Private.mm in Sources */,
CFFD58901B019E79001E10B6 /* DBTestHelpers+Private.mm in Sources */,
650CA0601C2AB6DB007ADDDB /* DBListenerCallerTest.m in Sources */,
650CA0601C2AB6DB007ADDDB /* DBMultipleInheritanceTests.m in Sources */,
CFFD58921B019E79001E10B6 /* DBUserToken+Private.mm in Sources */,
CFFD58B21B041BD9001E10B6 /* DBConstantsInterface.mm in Sources */,
6536CD9319A6C9A800DD7715 /* DBRecordWithDerivingsObjcTests.mm in Sources */,
......
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