Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
963b3555
Commit
963b3555
authored
Dec 23, 2015
by
Daniel Seither
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for multiple +o interfaces implemented by one class
parent
69402ad2
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
774 additions
and
0 deletions
+774
-0
test-suite/djinni/common.djinni
test-suite/djinni/common.djinni
+1
-0
test-suite/djinni/listeners.djinni
test-suite/djinni/listeners.djinni
+13
-0
test-suite/generated-src/cpp/first_listener.hpp
test-suite/generated-src/cpp/first_listener.hpp
+15
-0
test-suite/generated-src/cpp/listener_caller.hpp
test-suite/generated-src/cpp/listener_caller.hpp
+24
-0
test-suite/generated-src/cpp/second_listener.hpp
test-suite/generated-src/cpp/second_listener.hpp
+15
-0
test-suite/generated-src/inFileList.txt
test-suite/generated-src/inFileList.txt
+1
-0
test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java
...rated-src/java/com/dropbox/djinni/test/FirstListener.java
+11
-0
test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java
...ated-src/java/com/dropbox/djinni/test/ListenerCaller.java
+57
-0
test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java
...ated-src/java/com/dropbox/djinni/test/SecondListener.java
+11
-0
test-suite/generated-src/jni/NativeFirstListener.cpp
test-suite/generated-src/jni/NativeFirstListener.cpp
+13
-0
test-suite/generated-src/jni/NativeFirstListener.hpp
test-suite/generated-src/jni/NativeFirstListener.hpp
+32
-0
test-suite/generated-src/jni/NativeListenerCaller.cpp
test-suite/generated-src/jni/NativeListenerCaller.cpp
+52
-0
test-suite/generated-src/jni/NativeListenerCaller.hpp
test-suite/generated-src/jni/NativeListenerCaller.hpp
+32
-0
test-suite/generated-src/jni/NativeSecondListener.cpp
test-suite/generated-src/jni/NativeSecondListener.cpp
+13
-0
test-suite/generated-src/jni/NativeSecondListener.hpp
test-suite/generated-src/jni/NativeSecondListener.hpp
+32
-0
test-suite/generated-src/objc/DBFirstListener+Private.h
test-suite/generated-src/objc/DBFirstListener+Private.h
+31
-0
test-suite/generated-src/objc/DBFirstListener+Private.mm
test-suite/generated-src/objc/DBFirstListener+Private.mm
+46
-0
test-suite/generated-src/objc/DBFirstListener.h
test-suite/generated-src/objc/DBFirstListener.h
+11
-0
test-suite/generated-src/objc/DBListenerCaller+Private.h
test-suite/generated-src/objc/DBListenerCaller+Private.h
+31
-0
test-suite/generated-src/objc/DBListenerCaller+Private.mm
test-suite/generated-src/objc/DBListenerCaller+Private.mm
+75
-0
test-suite/generated-src/objc/DBListenerCaller.h
test-suite/generated-src/objc/DBListenerCaller.h
+19
-0
test-suite/generated-src/objc/DBSecondListener+Private.h
test-suite/generated-src/objc/DBSecondListener+Private.h
+31
-0
test-suite/generated-src/objc/DBSecondListener+Private.mm
test-suite/generated-src/objc/DBSecondListener+Private.mm
+46
-0
test-suite/generated-src/objc/DBSecondListener.h
test-suite/generated-src/objc/DBSecondListener.h
+11
-0
test-suite/generated-src/outFileList.txt
test-suite/generated-src/outFileList.txt
+21
-0
test-suite/handwritten-src/cpp/ListenerCaller.cpp
test-suite/handwritten-src/cpp/ListenerCaller.cpp
+34
-0
test-suite/handwritten-src/objc/tests/DBListenerCallerTest.m
test-suite/handwritten-src/objc/tests/DBListenerCallerTest.m
+58
-0
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
+38
-0
No files found.
test-suite/djinni/common.djinni
View file @
963b3555
...
@@ -10,3 +10,4 @@
...
@@ -10,3 +10,4 @@
@import "test.djinni"
@import "test.djinni"
@import "primtypes.djinni"
@import "primtypes.djinni"
@import "constants.djinni"
@import "constants.djinni"
@import "listeners.djinni"
test-suite/djinni/listeners.djinni
0 → 100644
View file @
963b3555
first_listener = interface +o {
first();
}
second_listener = interface +o {
second();
}
listener_caller = interface +c {
static init(first_l: first_listener, second_l: second_listener): listener_caller;
callFirst();
callSecond();
}
test-suite/generated-src/cpp/first_listener.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
namespace
testsuite
{
class
FirstListener
{
public:
virtual
~
FirstListener
()
{}
virtual
void
first
()
=
0
;
};
}
// namespace testsuite
test-suite/generated-src/cpp/listener_caller.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
#include <memory>
namespace
testsuite
{
class
FirstListener
;
class
SecondListener
;
class
ListenerCaller
{
public:
virtual
~
ListenerCaller
()
{}
static
std
::
shared_ptr
<
ListenerCaller
>
init
(
const
std
::
shared_ptr
<
FirstListener
>
&
first_l
,
const
std
::
shared_ptr
<
SecondListener
>
&
second_l
);
virtual
void
callFirst
()
=
0
;
virtual
void
callSecond
()
=
0
;
};
}
// namespace testsuite
test-suite/generated-src/cpp/second_listener.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
namespace
testsuite
{
class
SecondListener
{
public:
virtual
~
SecondListener
()
{}
virtual
void
second
()
=
0
;
};
}
// namespace testsuite
test-suite/generated-src/inFileList.txt
View file @
963b3555
...
@@ -12,6 +12,7 @@ djinni/user_token.djinni
...
@@ -12,6 +12,7 @@ djinni/user_token.djinni
djinni/test.djinni
djinni/test.djinni
djinni/primtypes.djinni
djinni/primtypes.djinni
djinni/constants.djinni
djinni/constants.djinni
djinni/listeners.djinni
djinni/date.djinni
djinni/date.djinni
djinni/date.yaml
djinni/date.yaml
djinni/duration.djinni
djinni/duration.djinni
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
package
com.dropbox.djinni.test
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnull
;
public
abstract
class
FirstListener
{
public
abstract
void
first
();
}
test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
package
com.dropbox.djinni.test
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnull
;
public
abstract
class
ListenerCaller
{
public
abstract
void
callFirst
();
public
abstract
void
callSecond
();
@CheckForNull
public
static
native
ListenerCaller
init
(
@CheckForNull
FirstListener
firstL
,
@CheckForNull
SecondListener
secondL
);
private
static
final
class
CppProxy
extends
ListenerCaller
{
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
void
callFirst
()
{
assert
!
this
.
destroyed
.
get
()
:
"trying to use a destroyed object"
;
native_callFirst
(
this
.
nativeRef
);
}
private
native
void
native_callFirst
(
long
_nativeRef
);
@Override
public
void
callSecond
()
{
assert
!
this
.
destroyed
.
get
()
:
"trying to use a destroyed object"
;
native_callSecond
(
this
.
nativeRef
);
}
private
native
void
native_callSecond
(
long
_nativeRef
);
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
package
com.dropbox.djinni.test
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnull
;
public
abstract
class
SecondListener
{
public
abstract
void
second
();
}
test-suite/generated-src/jni/NativeFirstListener.cpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "NativeFirstListener.hpp" // my header
namespace
djinni_generated
{
NativeFirstListener
::
NativeFirstListener
()
:
::
djinni
::
JniInterface
<::
testsuite
::
FirstListener
,
NativeFirstListener
>
()
{}
NativeFirstListener
::~
NativeFirstListener
()
=
default
;
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeFirstListener.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
#include "djinni_support.hpp"
#include "first_listener.hpp"
namespace
djinni_generated
{
class
NativeFirstListener
final
:
::
djinni
::
JniInterface
<::
testsuite
::
FirstListener
,
NativeFirstListener
>
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
FirstListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
FirstListener
>
;
using
JniType
=
jobject
;
using
Boxed
=
NativeFirstListener
;
~
NativeFirstListener
();
static
CppType
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
{
return
::
djinni
::
JniClass
<
NativeFirstListener
>::
get
().
_fromJava
(
jniEnv
,
j
);
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCppOpt
(
JNIEnv
*
jniEnv
,
const
CppOptType
&
c
)
{
return
{
jniEnv
,
::
djinni
::
JniClass
<
NativeFirstListener
>::
get
().
_toJava
(
jniEnv
,
c
)};
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCpp
(
JNIEnv
*
jniEnv
,
const
CppType
&
c
)
{
return
fromCppOpt
(
jniEnv
,
c
);
}
private:
NativeFirstListener
();
friend
::
djinni
::
JniClass
<
NativeFirstListener
>
;
friend
::
djinni
::
JniInterface
<::
testsuite
::
FirstListener
,
NativeFirstListener
>
;
};
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeListenerCaller.cpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "NativeListenerCaller.hpp" // my header
#include "NativeFirstListener.hpp"
#include "NativeListenerCaller.hpp"
#include "NativeSecondListener.hpp"
namespace
djinni_generated
{
NativeListenerCaller
::
NativeListenerCaller
()
:
::
djinni
::
JniInterface
<::
testsuite
::
ListenerCaller
,
NativeListenerCaller
>
(
"com/dropbox/djinni/test/ListenerCaller$CppProxy"
)
{}
NativeListenerCaller
::~
NativeListenerCaller
()
=
default
;
CJNIEXPORT
void
JNICALL
Java_com_dropbox_djinni_test_ListenerCaller_00024CppProxy_nativeDestroy
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jlong
nativeRef
)
{
try
{
DJINNI_FUNCTION_PROLOGUE1
(
jniEnv
,
nativeRef
);
delete
reinterpret_cast
<
djinni
::
CppProxyHandle
<::
testsuite
::
ListenerCaller
>*>
(
nativeRef
);
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
jobject
JNICALL
Java_com_dropbox_djinni_test_ListenerCaller_init
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jobject
j_firstL
,
jobject
j_secondL
)
{
try
{
DJINNI_FUNCTION_PROLOGUE0
(
jniEnv
);
auto
r
=
::
testsuite
::
ListenerCaller
::
init
(
::
djinni_generated
::
NativeFirstListener
::
toCpp
(
jniEnv
,
j_firstL
),
::
djinni_generated
::
NativeSecondListener
::
toCpp
(
jniEnv
,
j_secondL
));
return
::
djinni
::
release
(
::
djinni_generated
::
NativeListenerCaller
::
fromCpp
(
jniEnv
,
r
));
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
0
/* value doesn't matter */
)
}
CJNIEXPORT
void
JNICALL
Java_com_dropbox_djinni_test_ListenerCaller_00024CppProxy_native_1callFirst
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jlong
nativeRef
)
{
try
{
DJINNI_FUNCTION_PROLOGUE1
(
jniEnv
,
nativeRef
);
const
auto
&
ref
=
::
djinni
::
objectFromHandleAddress
<::
testsuite
::
ListenerCaller
>
(
nativeRef
);
ref
->
callFirst
();
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
void
JNICALL
Java_com_dropbox_djinni_test_ListenerCaller_00024CppProxy_native_1callSecond
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jlong
nativeRef
)
{
try
{
DJINNI_FUNCTION_PROLOGUE1
(
jniEnv
,
nativeRef
);
const
auto
&
ref
=
::
djinni
::
objectFromHandleAddress
<::
testsuite
::
ListenerCaller
>
(
nativeRef
);
ref
->
callSecond
();
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeListenerCaller.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
#include "djinni_support.hpp"
#include "listener_caller.hpp"
namespace
djinni_generated
{
class
NativeListenerCaller
final
:
::
djinni
::
JniInterface
<::
testsuite
::
ListenerCaller
,
NativeListenerCaller
>
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>
;
using
JniType
=
jobject
;
using
Boxed
=
NativeListenerCaller
;
~
NativeListenerCaller
();
static
CppType
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
{
return
::
djinni
::
JniClass
<
NativeListenerCaller
>::
get
().
_fromJava
(
jniEnv
,
j
);
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCppOpt
(
JNIEnv
*
jniEnv
,
const
CppOptType
&
c
)
{
return
{
jniEnv
,
::
djinni
::
JniClass
<
NativeListenerCaller
>::
get
().
_toJava
(
jniEnv
,
c
)};
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCpp
(
JNIEnv
*
jniEnv
,
const
CppType
&
c
)
{
return
fromCppOpt
(
jniEnv
,
c
);
}
private:
NativeListenerCaller
();
friend
::
djinni
::
JniClass
<
NativeListenerCaller
>
;
friend
::
djinni
::
JniInterface
<::
testsuite
::
ListenerCaller
,
NativeListenerCaller
>
;
};
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeSecondListener.cpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "NativeSecondListener.hpp" // my header
namespace
djinni_generated
{
NativeSecondListener
::
NativeSecondListener
()
:
::
djinni
::
JniInterface
<::
testsuite
::
SecondListener
,
NativeSecondListener
>
()
{}
NativeSecondListener
::~
NativeSecondListener
()
=
default
;
}
// namespace djinni_generated
test-suite/generated-src/jni/NativeSecondListener.hpp
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#pragma once
#include "djinni_support.hpp"
#include "second_listener.hpp"
namespace
djinni_generated
{
class
NativeSecondListener
final
:
::
djinni
::
JniInterface
<::
testsuite
::
SecondListener
,
NativeSecondListener
>
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
SecondListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
SecondListener
>
;
using
JniType
=
jobject
;
using
Boxed
=
NativeSecondListener
;
~
NativeSecondListener
();
static
CppType
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
{
return
::
djinni
::
JniClass
<
NativeSecondListener
>::
get
().
_fromJava
(
jniEnv
,
j
);
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCppOpt
(
JNIEnv
*
jniEnv
,
const
CppOptType
&
c
)
{
return
{
jniEnv
,
::
djinni
::
JniClass
<
NativeSecondListener
>::
get
().
_toJava
(
jniEnv
,
c
)};
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCpp
(
JNIEnv
*
jniEnv
,
const
CppType
&
c
)
{
return
fromCppOpt
(
jniEnv
,
c
);
}
private:
NativeSecondListener
();
friend
::
djinni
::
JniClass
<
NativeSecondListener
>
;
friend
::
djinni
::
JniInterface
<::
testsuite
::
SecondListener
,
NativeSecondListener
>
;
};
}
// namespace djinni_generated
test-suite/generated-src/objc/DBFirstListener+Private.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "first_listener.hpp"
#include <memory>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
@protocol
DBFirstListener
;
namespace
djinni_generated
{
class
FirstListener
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
FirstListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
FirstListener
>
;
using
ObjcType
=
id
<
DBFirstListener
>
;
using
Boxed
=
FirstListener
;
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
test-suite/generated-src/objc/DBFirstListener+Private.mm
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import "DBFirstListener+Private.h"
#import "DBFirstListener.h"
#import "DJIObjcWrapperCache+Private.h"
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
namespace
djinni_generated
{
class
FirstListener
::
ObjcProxy
final
:
public
::
testsuite
::
FirstListener
,
public
::
djinni
::
ObjcProxyCache
::
Handle
<
ObjcType
>
{
public:
using
Handle
::
Handle
;
void
first
()
override
{
@autoreleasepool
{
[
Handle
:
:
get
()
first
];
}
}
};
}
// namespace djinni_generated
namespace
djinni_generated
{
auto
FirstListener
::
toCpp
(
ObjcType
objc
)
->
CppType
{
if
(
!
objc
)
{
return
nullptr
;
}
return
::
djinni
::
get_objc_proxy
<
ObjcProxy
>
(
objc
);
}
auto
FirstListener
::
fromCppOpt
(
const
CppOptType
&
cpp
)
->
ObjcType
{
if
(
!
cpp
)
{
return
nil
;
}
return
dynamic_cast
<
ObjcProxy
&>
(
*
cpp
).
Handle
::
get
();
}
}
// namespace djinni_generated
test-suite/generated-src/objc/DBFirstListener.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import <Foundation/Foundation.h>
@protocol
DBFirstListener
-
(
void
)
first
;
@end
test-suite/generated-src/objc/DBListenerCaller+Private.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "listener_caller.hpp"
#include <memory>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
@
class
DBListenerCaller
;
namespace
djinni_generated
{
class
ListenerCaller
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>
;
using
ObjcType
=
DBListenerCaller
*
;
using
Boxed
=
ListenerCaller
;
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
test-suite/generated-src/objc/DBListenerCaller+Private.mm
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import "DBListenerCaller+Private.h"
#import "DBListenerCaller.h"
#import "DBFirstListener+Private.h"
#import "DBListenerCaller+Private.h"
#import "DBSecondListener+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#include <exception>
#include <utility>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
@interface
DBListenerCaller
()
-
(
id
)
initWithCpp
:(
const
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>&
)
cppRef
;
@end
@implementation
DBListenerCaller
{
::
djinni
::
CppProxyCache
::
Handle
<
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>>
_cppRefHandle
;
}
-
(
id
)
initWithCpp
:(
const
std
::
shared_ptr
<::
testsuite
::
ListenerCaller
>&
)
cppRef
{
if
(
self
=
[
super
init
])
{
_cppRefHandle
.
assign
(
cppRef
);
}
return
self
;
}
+
(
nullable
DBListenerCaller
*
)
init
:(
nullable
id
<
DBFirstListener
>
)
firstL
secondL
:(
nullable
id
<
DBSecondListener
>
)
secondL
{
try
{
auto
r
=
::
testsuite
::
ListenerCaller
::
init
(
::
djinni_generated
::
FirstListener
::
toCpp
(
firstL
),
::
djinni_generated
::
SecondListener
::
toCpp
(
secondL
));
return
::
djinni_generated
::
ListenerCaller
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
-
(
void
)
callFirst
{
try
{
_cppRefHandle
.
get
()
->
callFirst
();
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
-
(
void
)
callSecond
{
try
{
_cppRefHandle
.
get
()
->
callSecond
();
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
namespace
djinni_generated
{
auto
ListenerCaller
::
toCpp
(
ObjcType
objc
)
->
CppType
{
if
(
!
objc
)
{
return
nullptr
;
}
return
objc
->
_cppRefHandle
.
get
();
}
auto
ListenerCaller
::
fromCppOpt
(
const
CppOptType
&
cpp
)
->
ObjcType
{
if
(
!
cpp
)
{
return
nil
;
}
return
::
djinni
::
get_cpp_proxy
<
DBListenerCaller
>
(
cpp
);
}
}
// namespace djinni_generated
@end
test-suite/generated-src/objc/DBListenerCaller.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import <Foundation/Foundation.h>
@class
DBListenerCaller
;
@protocol
DBFirstListener
;
@protocol
DBSecondListener
;
@interface
DBListenerCaller
:
NSObject
+
(
nullable
DBListenerCaller
*
)
init
:(
nullable
id
<
DBFirstListener
>
)
firstL
secondL
:(
nullable
id
<
DBSecondListener
>
)
secondL
;
-
(
void
)
callFirst
;
-
(
void
)
callSecond
;
@end
test-suite/generated-src/objc/DBSecondListener+Private.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#include "second_listener.hpp"
#include <memory>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
@protocol
DBSecondListener
;
namespace
djinni_generated
{
class
SecondListener
{
public:
using
CppType
=
std
::
shared_ptr
<::
testsuite
::
SecondListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
testsuite
::
SecondListener
>
;
using
ObjcType
=
id
<
DBSecondListener
>
;
using
Boxed
=
SecondListener
;
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
test-suite/generated-src/objc/DBSecondListener+Private.mm
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import "DBSecondListener+Private.h"
#import "DBSecondListener.h"
#import "DJIObjcWrapperCache+Private.h"
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
namespace
djinni_generated
{
class
SecondListener
::
ObjcProxy
final
:
public
::
testsuite
::
SecondListener
,
public
::
djinni
::
ObjcProxyCache
::
Handle
<
ObjcType
>
{
public:
using
Handle
::
Handle
;
void
second
()
override
{
@autoreleasepool
{
[
Handle
:
:
get
()
second
];
}
}
};
}
// namespace djinni_generated
namespace
djinni_generated
{
auto
SecondListener
::
toCpp
(
ObjcType
objc
)
->
CppType
{
if
(
!
objc
)
{
return
nullptr
;
}
return
::
djinni
::
get_objc_proxy
<
ObjcProxy
>
(
objc
);
}
auto
SecondListener
::
fromCppOpt
(
const
CppOptType
&
cpp
)
->
ObjcType
{
if
(
!
cpp
)
{
return
nil
;
}
return
dynamic_cast
<
ObjcProxy
&>
(
*
cpp
).
Handle
::
get
();
}
}
// namespace djinni_generated
test-suite/generated-src/objc/DBSecondListener.h
0 → 100644
View file @
963b3555
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
#import <Foundation/Foundation.h>
@protocol
DBSecondListener
-
(
void
)
second
;
@end
test-suite/generated-src/outFileList.txt
View file @
963b3555
...
@@ -4,6 +4,9 @@ djinni-output-temp/cpp/record_with_duration_and_derivings.cpp
...
@@ -4,6 +4,9 @@ djinni-output-temp/cpp/record_with_duration_and_derivings.cpp
djinni-output-temp/cpp/date_record.hpp
djinni-output-temp/cpp/date_record.hpp
djinni-output-temp/cpp/date_record.cpp
djinni-output-temp/cpp/date_record.cpp
djinni-output-temp/cpp/map_date_record.hpp
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/constant_record.hpp
djinni-output-temp/cpp/constant_record.hpp
djinni-output-temp/cpp/constants.hpp
djinni-output-temp/cpp/constants.hpp
djinni-output-temp/cpp/constants.cpp
djinni-output-temp/cpp/constants.cpp
...
@@ -33,6 +36,9 @@ djinni-output-temp/java/TestDuration.java
...
@@ -33,6 +36,9 @@ djinni-output-temp/java/TestDuration.java
djinni-output-temp/java/RecordWithDurationAndDerivings.java
djinni-output-temp/java/RecordWithDurationAndDerivings.java
djinni-output-temp/java/DateRecord.java
djinni-output-temp/java/DateRecord.java
djinni-output-temp/java/MapDateRecord.java
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/ConstantRecord.java
djinni-output-temp/java/ConstantRecord.java
djinni-output-temp/java/Constants.java
djinni-output-temp/java/Constants.java
djinni-output-temp/java/ConstantsInterface.java
djinni-output-temp/java/ConstantsInterface.java
...
@@ -61,6 +67,12 @@ djinni-output-temp/jni/NativeDateRecord.hpp
...
@@ -61,6 +67,12 @@ djinni-output-temp/jni/NativeDateRecord.hpp
djinni-output-temp/jni/NativeDateRecord.cpp
djinni-output-temp/jni/NativeDateRecord.cpp
djinni-output-temp/jni/NativeMapDateRecord.hpp
djinni-output-temp/jni/NativeMapDateRecord.hpp
djinni-output-temp/jni/NativeMapDateRecord.cpp
djinni-output-temp/jni/NativeMapDateRecord.cpp
djinni-output-temp/jni/NativeFirstListener.hpp
djinni-output-temp/jni/NativeFirstListener.cpp
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/NativeConstantRecord.hpp
djinni-output-temp/jni/NativeConstantRecord.hpp
djinni-output-temp/jni/NativeConstantRecord.cpp
djinni-output-temp/jni/NativeConstantRecord.cpp
djinni-output-temp/jni/NativeConstants.hpp
djinni-output-temp/jni/NativeConstants.hpp
...
@@ -107,6 +119,9 @@ djinni-output-temp/objc/DBDateRecord.h
...
@@ -107,6 +119,9 @@ djinni-output-temp/objc/DBDateRecord.h
djinni-output-temp/objc/DBDateRecord.mm
djinni-output-temp/objc/DBDateRecord.mm
djinni-output-temp/objc/DBMapDateRecord.h
djinni-output-temp/objc/DBMapDateRecord.h
djinni-output-temp/objc/DBMapDateRecord.mm
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/DBConstantRecord.h
djinni-output-temp/objc/DBConstantRecord.h
djinni-output-temp/objc/DBConstantRecord.mm
djinni-output-temp/objc/DBConstantRecord.mm
djinni-output-temp/objc/DBConstants.h
djinni-output-temp/objc/DBConstants.h
...
@@ -149,6 +164,12 @@ djinni-output-temp/objc/DBDateRecord+Private.h
...
@@ -149,6 +164,12 @@ djinni-output-temp/objc/DBDateRecord+Private.h
djinni-output-temp/objc/DBDateRecord+Private.mm
djinni-output-temp/objc/DBDateRecord+Private.mm
djinni-output-temp/objc/DBMapDateRecord+Private.h
djinni-output-temp/objc/DBMapDateRecord+Private.h
djinni-output-temp/objc/DBMapDateRecord+Private.mm
djinni-output-temp/objc/DBMapDateRecord+Private.mm
djinni-output-temp/objc/DBFirstListener+Private.h
djinni-output-temp/objc/DBFirstListener+Private.mm
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/DBConstantRecord+Private.h
djinni-output-temp/objc/DBConstantRecord+Private.h
djinni-output-temp/objc/DBConstantRecord+Private.mm
djinni-output-temp/objc/DBConstantRecord+Private.mm
djinni-output-temp/objc/DBConstants+Private.h
djinni-output-temp/objc/DBConstants+Private.h
...
...
test-suite/handwritten-src/cpp/ListenerCaller.cpp
0 → 100644
View file @
963b3555
#include "listener_caller.hpp"
#include "first_listener.hpp"
#include "second_listener.hpp"
namespace
testsuite
{
class
ListenerCallerImpl
:
public
ListenerCaller
{
public:
ListenerCallerImpl
(
const
std
::
shared_ptr
<
FirstListener
>
&
firstListener
,
const
std
::
shared_ptr
<
SecondListener
>
&
secondListener
)
:
firstListener
(
firstListener
),
secondListener
(
secondListener
)
{}
void
callFirst
()
override
{
firstListener
->
first
();
}
void
callSecond
()
override
{
secondListener
->
second
();
}
private:
std
::
shared_ptr
<
FirstListener
>
firstListener
;
std
::
shared_ptr
<
SecondListener
>
secondListener
;
};
std
::
shared_ptr
<
ListenerCaller
>
ListenerCaller
::
init
(
const
std
::
shared_ptr
<
FirstListener
>
&
firstListener
,
const
std
::
shared_ptr
<
SecondListener
>
&
secondListener
)
{
return
std
::
make_shared
<
ListenerCallerImpl
>
(
firstListener
,
secondListener
);
}
}
// namespace testsuite
test-suite/handwritten-src/objc/tests/DBListenerCallerTest.m
0 → 100644
View file @
963b3555
#import <XCTest/XCTest.h>
#include "DBFirstListener.h"
#include "DBSecondListener.h"
#include "DBListenerCaller.h"
@interface
Listener
:
NSObject
<
DBFirstListener
,
DBSecondListener
>
@property
bool
firstCalled
;
@property
bool
secondCalled
;
@end
@implementation
Listener
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
!=
nil
)
{
self
.
firstCalled
=
FALSE
;
self
.
secondCalled
=
FALSE
;
}
return
self
;
}
-
(
void
)
first
{
self
.
firstCalled
=
TRUE
;
}
-
(
void
)
second
{
self
.
secondCalled
=
TRUE
;
}
@end
@interface
DBListenerCallerTest
:
XCTestCase
@end
@implementation
DBListenerCallerTest
{
Listener
*
listener
;
DBListenerCaller
*
caller
;
}
-
(
void
)
setUp
{
[
super
setUp
];
listener
=
[
Listener
new
];
caller
=
[
DBListenerCaller
init
:
listener
secondL
:
listener
];
}
-
(
void
)
testCallFirst
{
[
caller
callFirst
];
XCTAssert
(
listener
.
firstCalled
);
}
-
(
void
)
testCallSecond
{
[
caller
callSecond
];
XCTAssert
(
listener
.
secondCalled
);
}
@end
test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj
View file @
963b3555
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment