mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +00:00
feat(c-tools): set the cpp ptr type on belle sip object name
This commit is contained in:
parent
d410c7e6c7
commit
42035bb700
4 changed files with 63 additions and 0 deletions
|
|
@ -39,6 +39,9 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
#define L_EXPAND(X) X
|
||||
|
||||
// Useful in depth context.
|
||||
#define L_STRINGIFY(X) #X
|
||||
|
||||
#define L_GET_N_ARGS(...) L_EXPAND(L_ARG_N( \
|
||||
__VA_ARGS__, \
|
||||
21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
c-wrapper/api/c-event-log.cpp
|
||||
c-wrapper/api/c-participant.cpp
|
||||
c-wrapper/internal/c-sal.cpp
|
||||
c-wrapper/internal/c-tools.cpp
|
||||
call/call.cpp
|
||||
call/local-conference-call.cpp
|
||||
call/remote-conference-call.cpp
|
||||
|
|
|
|||
42
src/c-wrapper/internal/c-tools.cpp
Normal file
42
src/c-wrapper/internal/c-tools.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* c-tools.cpp
|
||||
* Copyright (C) 2010-2018 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <typeinfo>
|
||||
#endif
|
||||
|
||||
#include "c-tools.h"
|
||||
#include "object/base-object.h"
|
||||
#include "object/clonable-object.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef DEBUG
|
||||
void Wrapper::setName (belle_sip_object_t *cObject, const BaseObject *cppObject) {
|
||||
belle_sip_object_set_name(cObject, typeid(*cppObject).name());
|
||||
}
|
||||
|
||||
void Wrapper::setName (belle_sip_object_t *cObject, const ClonableObject *cppObject) {
|
||||
belle_sip_object_set_name(cObject, typeid(*cppObject).name());
|
||||
}
|
||||
#endif
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
@ -142,6 +142,15 @@ private:
|
|||
CppType *cppPtr;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Debug tools.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef DEBUG
|
||||
static void setName (belle_sip_object_t *cObject, const BaseObject *cppObject);
|
||||
static void setName (belle_sip_object_t *cObject, const ClonableObject *cppObject);
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Runtime checker.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -393,6 +402,10 @@ public:
|
|||
if (oldCppObject)
|
||||
oldCppObject->setCBackPtr(nullptr);
|
||||
cppObject->setCBackPtr(cObject);
|
||||
|
||||
#ifdef DEBUG
|
||||
setName(reinterpret_cast<belle_sip_object_t *>(cObject), cppObject.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
template<
|
||||
|
|
@ -408,6 +421,10 @@ public:
|
|||
|
||||
*cppObjectAddr = cppObject;
|
||||
(*cppObjectAddr)->setCBackPtr(cObject);
|
||||
|
||||
#ifdef DEBUG
|
||||
setName(reinterpret_cast<belle_sip_object_t *>(cObject), cppObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue