Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
771487a8
Commit
771487a8
authored
May 24, 2018
by
Ronan
Browse files
fix(c-wrapper): add a way to clone custom properties of c objects
parent
2731c470
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/c-wrapper/api/c-content.cpp
View file @
771487a8
...
...
@@ -32,10 +32,12 @@ using namespace std;
static
void
_linphone_content_constructor
(
LinphoneContent
*
content
);
static
void
_linphone_content_destructor
(
LinphoneContent
*
content
);
static
void
_linphone_content_c_clone
(
LinphoneContent
*
dest
,
const
LinphoneContent
*
src
);
L_DECLARE_C_CLONABLE_OBJECT_IMPL_WITH_XTORS
(
Content
,
_linphone_content_constructor
,
_linphone_content_destructor
,
_linphone_content_c_clone
,
void
*
cryptoContext
;
// Used to encrypt file for RCS file transfer.
...
...
@@ -57,6 +59,12 @@ static void _linphone_content_destructor (LinphoneContent *content) {
content
->
cache
.
~
Cache
();
}
static
void
_linphone_content_c_clone
(
LinphoneContent
*
dest
,
const
LinphoneContent
*
src
)
{
new
(
&
dest
->
cache
)
LinphoneContent
::
Cache
();
dest
->
size
=
src
->
size
;
dest
->
cache
=
src
->
cache
;
}
// =============================================================================
// Reference and user data handling functions.
// =============================================================================
...
...
src/c-wrapper/internal/c-tools.h
View file @
771487a8
...
...
@@ -612,6 +612,7 @@ LINPHONE_END_NAMESPACE
#undef L_INTERNAL_WRAPPER_CONSTEXPR
#define L_INTERNAL_C_NO_XTOR(C_OBJECT)
#define L_INTERNAL_C_NO_CLONE_C(C_DEST_OBJECT, C_SRC_OBJECT)
#define L_INTERNAL_DECLARE_C_OBJECT(C_TYPE, ...) \
static_assert(LinphonePrivate::CTypeMetaInfo<Linphone ## C_TYPE>::defined, "Type is not defined."); \
...
...
@@ -669,7 +670,7 @@ LINPHONE_END_NAMESPACE
__VA_ARGS__ \
}; \
#define L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR) \
#define L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR
, CLONE_C
) \
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## C_TYPE); \
Linphone ## C_TYPE *_linphone_ ## C_TYPE ## _init () { \
Linphone ## C_TYPE *object = belle_sip_object_new(Linphone ## C_TYPE); \
...
...
@@ -683,6 +684,7 @@ LINPHONE_END_NAMESPACE
static void _linphone_ ## C_TYPE ## _clone (Linphone ## C_TYPE *dest, const Linphone ## C_TYPE *src) { \
L_ASSERT(src->cppPtr); \
dest->cppPtr = new L_CPP_TYPE_OF_C_TYPE(C_TYPE)(*src->cppPtr); \
CLONE_C(dest, src); \
} \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## C_TYPE); \
BELLE_SIP_INSTANCIATE_VPTR( \
...
...
@@ -760,15 +762,15 @@ LINPHONE_END_NAMESPACE
L_INTERNAL_DECLARE_C_OBJECT(C_TYPE, __VA_ARGS__) \
L_INTERNAL_DECLARE_C_OBJECT_FUNCTIONS(C_TYPE, L_INTERNAL_C_NO_XTOR, L_INTERNAL_C_NO_XTOR)
// Declare clonable wrapped C object with constructor/destructor.
#define L_DECLARE_C_CLONABLE_OBJECT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR, ...) \
// Declare clonable wrapped C object with constructor/destructor
and clone_c
.
#define L_DECLARE_C_CLONABLE_OBJECT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR,
CLONE_C,
...) \
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT(C_TYPE, __VA_ARGS__) \
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR)
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR
, CLONE_C
)
// Declare clonable wrapped C object.
#define L_DECLARE_C_CLONABLE_OBJECT_IMPL(C_TYPE, ...) \
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT(C_TYPE, __VA_ARGS__) \
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, L_INTERNAL_C_NO_XTOR, L_INTERNAL_C_NO_XTOR)
L_INTERNAL_DECLARE_C_CLONABLE_OBJECT_FUNCTIONS(C_TYPE, L_INTERNAL_C_NO_XTOR, L_INTERNAL_C_NO_XTOR
, L_INTERNAL_C_NO_CLONE_C
)
// -----------------------------------------------------------------------------
// Helpers.
...
...
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