mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 10:19:23 +00:00
feat(c-wrapper): remove TYPE parameter of L_GET_C_LIST_FROM_CPP_LIST
This commit is contained in:
parent
a38e222045
commit
dd6db19335
2 changed files with 24 additions and 15 deletions
|
|
@ -166,7 +166,7 @@ void linphone_chat_room_set_call (LinphoneChatRoom *cr, LinphoneCall *call) {
|
|||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_room_get_transient_messages (const LinphoneChatRoom *cr) {
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PRIVATE_PTR(cr)->getTransientMessages(), LinphoneChatMessage);
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PRIVATE_PTR(cr)->getTransientMessages());
|
||||
}
|
||||
|
||||
void linphone_chat_room_mark_as_read (LinphoneChatRoom *cr) {
|
||||
|
|
@ -190,11 +190,11 @@ void linphone_chat_room_delete_history (LinphoneChatRoom *cr) {
|
|||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_room_get_history_range (LinphoneChatRoom *cr, int startm, int endm) {
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistoryRange(startm, endm), LinphoneChatMessage);
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistoryRange(startm, endm));
|
||||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_message) {
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistory(nb_message), LinphoneChatMessage);
|
||||
return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistory(nb_message));
|
||||
}
|
||||
|
||||
LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) {
|
||||
|
|
|
|||
|
|
@ -155,6 +155,10 @@ public:
|
|||
return cppPtr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Get c back ptr helpers.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
template<typename CType, typename CppType>
|
||||
static inline CType *getCBackPtr (const std::shared_ptr<CppType> &object, CType *(*cTypeAllocator)()) {
|
||||
Variant v = object->getProperty("LinphonePrivate::Wrapper::cBackPtr");
|
||||
|
|
@ -177,6 +181,8 @@ public:
|
|||
return reinterpret_cast<CType *>(value);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Get/set user data.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -203,16 +209,26 @@ public:
|
|||
object->setProperty("LinphonePrivate::Wrapper::userData", value);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// List helpers.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
template<typename T>
|
||||
static inline bctbx_list_t *getCListFromCppList (const std::list<T> cppList) {
|
||||
static inline bctbx_list_t *getCListFromCppList (const std::list<T*> &cppList) {
|
||||
bctbx_list_t *result = nullptr;
|
||||
for (const auto &value : cppList)
|
||||
result = bctbx_list_append(result, value);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline std::list<T*> getCppListFromCList (const bctbx_list_t *cList) {
|
||||
std::list<T> result;
|
||||
for (auto it = cList; it; it = bctbx_list_next(it))
|
||||
result.push_back(static_cast<T>(bctbx_list_get_data(it)));
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename CppType, typename CType>
|
||||
static inline bctbx_list_t *getCListOfStructPtrFromCppListOfCppObj (const std::list<std::shared_ptr<CppType>> cppList, CType *(*cTypeAllocator)()) {
|
||||
bctbx_list_t *result = nullptr;
|
||||
|
|
@ -229,14 +245,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline std::list<T> getCppListFromCList (const bctbx_list_t *cList) {
|
||||
std::list<T> result;
|
||||
for (auto it = cList; it; it = bctbx_list_next(it))
|
||||
result.push_back(static_cast<T>(bctbx_list_get_data(it)));
|
||||
return result;
|
||||
}
|
||||
|
||||
template<
|
||||
typename CppType,
|
||||
typename CType,
|
||||
|
|
@ -432,10 +440,11 @@ LINPHONE_END_NAMESPACE
|
|||
VALUE \
|
||||
)
|
||||
|
||||
#define L_GET_C_LIST_FROM_CPP_LIST(LIST, TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCListFromCppList<TYPE *>(LIST)
|
||||
#define L_GET_C_LIST_FROM_CPP_LIST(LIST) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCListFromCppList(LIST)
|
||||
#define L_GET_CPP_LIST_FROM_C_LIST(LIST, TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCppListFromCList<TYPE *>(LIST)
|
||||
LINPHONE_NAMESPACE::Wrapper::getCppListFromCList<TYPE>(LIST)
|
||||
|
||||
#define L_GET_C_LIST_OF_STRUCT_PTR_FROM_CPP_LIST_OF_CPP_OBJ(LIST, CPP_TYPE, C_TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCListOfStructPtrFromCppListOfCppObj<LINPHONE_NAMESPACE::CPP_TYPE, Linphone ## C_TYPE>(LIST, _linphone_ ## C_TYPE ## _init)
|
||||
#define L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(LIST, CPP_TYPE, C_TYPE) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue