Commit 78646be7 authored by Ronan's avatar Ronan
Browse files

feat(c-wrapper): rename C_STRUCT to C_OBJECT

parent c73614b8
......@@ -169,7 +169,7 @@ static void call_received(SalOp *h) {
LinphoneCall *call = linphone_call_new_incoming(lc, fromAddr, toAddr, h);
linphone_address_unref(fromAddr);
linphone_address_unref(toAddr);
L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->startIncomingNotification();
L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->startIncomingNotification();
}
static void call_rejected(SalOp *h){
......
......@@ -80,7 +80,7 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *
}
static bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *from) {
LinphoneAddress *addr = linphone_address_new(L_GET_CPP_PTR_FROM_C_STRUCT(cr)->getPeerAddress().asString().c_str());
LinphoneAddress *addr = linphone_address_new(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asString().c_str());
bool_t result = linphone_address_weak_equal(addr, from);
linphone_address_unref(addr);
return result;
......@@ -225,7 +225,7 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
LinphoneAddress *addr = linphone_address_new(sal_msg->from);
linphone_address_clean(addr);
LinphoneChatRoom *cr = linphone_core_get_chat_room(lc, addr);
LinphoneReason reason = L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->messageReceived(op, sal_msg);
LinphoneReason reason = L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->messageReceived(op, sal_msg);
linphone_address_unref(addr);
return reason;
}
......@@ -235,8 +235,8 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) {
if (linphone_core_realtime_text_enabled(lc)) {
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr));
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call);
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr)))->realtimeTextReceived(character, call);
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call);
}
}
......@@ -29,5 +29,5 @@
#include "chat/chat-room.h"
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent *initial_content) {
return L_GET_CPP_PTR_FROM_C_STRUCT(cr)->createFileTransferMessage(initial_content);
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createFileTransferMessage(initial_content);
}
......@@ -3205,7 +3205,7 @@ void linphone_core_iterate(LinphoneCore *lc){
/* Get immediately a reference to next one in case the one we are going to examine is destroyed
* and removed during linphone_call_start_invite() */
calls = bctbx_list_next(calls);
L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->iterate(current_real_time, one_second_elapsed);
L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->iterate(current_real_time, one_second_elapsed);
}
if (linphone_core_video_preview_enabled(lc)){
......@@ -3341,7 +3341,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
ret=bctbx_list_append(ret,sal_address_new(local_route));
}
if (srv_route){
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address)->getInternalAddress()));
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_OBJECT(srv_route, Address)->getInternalAddress()));
}
if (ret==NULL){
/*if the proxy address matches the domain part of the destination, then use the same transport
......@@ -3530,9 +3530,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (linphone_call_params_get_local_conference_mode(params) == FALSE)
#endif
lc->current_call=call;
bool defer = L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->initiateOutgoing();
bool defer = L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->initiateOutgoing();
if (!defer) {
if (L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->startInvite(nullptr) != 0) {
if (L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->startInvite(nullptr) != 0) {
/* The call has already gone to error and released state, so do not return it */
call = nullptr;
}
......@@ -6653,7 +6653,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
}
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
L_GET_CPP_PTR_FROM_C_STRUCT(params)->initDefault(lc);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(lc);
}
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
......
......@@ -492,7 +492,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
linphone_configure_op(cfg->lc, cfg->op, cfg->identity_address, cfg->sent_headers, FALSE);
if ((contact=guess_contact_for_register(cfg))) {
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress());
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_OBJECT(contact, Address)->getInternalAddress());
linphone_address_unref(contact);
}
......@@ -503,7 +503,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
proxy_string,
cfg->reg_identity,
cfg->expires,
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address)->getInternalAddress() : NULL
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_OBJECT(cfg->pending_contact, Address)->getInternalAddress() : NULL
)==0) {
if (cfg->pending_contact) {
linphone_address_unref(cfg->pending_contact);
......@@ -1364,7 +1364,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
bool_t destroy_route_addr = FALSE;
if (linphone_proxy_config_get_service_route(cfg)) {
route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress();
route_addr = L_GET_PRIVATE_FROM_C_OBJECT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress();
} else if (linphone_proxy_config_get_route(cfg)) {
addr=linphone_proxy_config_get_route(cfg);
} else if(linphone_proxy_config_get_addr(cfg)) {
......
......@@ -380,7 +380,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
* (port, transport, maddr), then it is sent directly.
* Otherwise it is routed as any LinphoneEvent publish, following proxy config policy.
**/
salAddress = L_GET_PRIVATE_FROM_C_STRUCT(request_uri, Address)->getInternalAddress();
salAddress = L_GET_PRIVATE_FROM_C_OBJECT(request_uri, Address)->getInternalAddress();
if (sal_address_has_uri_param(salAddress, "transport") ||
sal_address_has_uri_param(salAddress, "maddr") ||
linphone_address_get_port(request_uri) != 0) {
......
......@@ -22,8 +22,8 @@
// =============================================================================
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, MediaSessionParams)
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, MediaSessionParams)
L_DECLARE_C_CLONABLE_STRUCT_IMPL(CallParams)
......@@ -485,11 +485,11 @@ void linphone_call_params_set_no_user_consent (LinphoneCallParams *params, bool_
// =============================================================================
void *linphone_call_params_get_user_data (const LinphoneCallParams *cp) {
return L_GET_USER_DATA_FROM_C_STRUCT(cp, MediaSessionParams);
return L_GET_USER_DATA_FROM_C_OBJECT(cp, MediaSessionParams);
}
void linphone_call_params_set_user_data (LinphoneCallParams *cp, void *ud) {
L_SET_USER_DATA_FROM_C_STRUCT(cp, ud, MediaSessionParams);
L_SET_USER_DATA_FROM_C_OBJECT(cp, ud, MediaSessionParams);
}
LinphoneCallParams *linphone_call_params_ref (LinphoneCallParams *cp) {
......@@ -507,7 +507,7 @@ void linphone_call_params_unref (LinphoneCallParams *cp) {
LinphoneCallParams *linphone_call_params_new (LinphoneCore *core) {
LinphoneCallParams *params = _linphone_CallParams_init();
L_SET_CPP_PTR_FROM_C_STRUCT(params, new LinphonePrivate::MediaSessionParams());
L_SET_CPP_PTR_FROM_C_OBJECT(params, new LinphonePrivate::MediaSessionParams());
GET_MEDIA_CPP_PTR(params)->initDefault(core);
return params;
}
......
......@@ -28,15 +28,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, Call)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, Call)
using namespace std;
static void _linphone_call_constructor (LinphoneCall *call);
static void _linphone_call_destructor (LinphoneCall *call);
L_DECLARE_C_STRUCT_IMPL_WITH_XTORS(Call,
L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(Call,
_linphone_call_constructor, _linphone_call_destructor,
bctbx_list_t *callbacks; /* A list of LinphoneCallCbs object */
LinphoneCallCbs *currentCbs; /* The current LinphoneCallCbs object used to call a callback */
......@@ -601,7 +601,7 @@ bool_t linphone_call_asked_to_autoanswer (LinphoneCall *call) {
}
const LinphoneAddress *linphone_call_get_remote_address (const LinphoneCall *call) {
L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteAddressCache, &GET_CPP_PTR(call)->getRemoteAddress());
L_SET_CPP_PTR_FROM_C_OBJECT(call->remoteAddressCache, &GET_CPP_PTR(call)->getRemoteAddress());
return call->remoteAddressCache;
}
......@@ -690,7 +690,7 @@ int linphone_call_get_duration (const LinphoneCall *call) {
}
const LinphoneCallParams *linphone_call_get_current_params(LinphoneCall *call) {
L_SET_CPP_PTR_FROM_C_STRUCT(call->currentParamsCache, GET_CPP_PTR(call)->getCurrentParams());
L_SET_CPP_PTR_FROM_C_OBJECT(call->currentParamsCache, GET_CPP_PTR(call)->getCurrentParams());
return call->currentParamsCache;
}
......@@ -698,7 +698,7 @@ const LinphoneCallParams *linphone_call_get_remote_params(LinphoneCall *call) {
const LinphonePrivate::MediaSessionParams *remoteParams = GET_CPP_PTR(call)->getRemoteParams();
if (!remoteParams)
return nullptr;
L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteParamsCache, remoteParams);
L_SET_CPP_PTR_FROM_C_OBJECT(call->remoteParamsCache, remoteParams);
return call->remoteParamsCache;
}
......@@ -936,7 +936,7 @@ LinphoneStatus linphone_call_accept (LinphoneCall *call) {
}
LinphoneStatus linphone_call_accept_with_params (LinphoneCall *call, const LinphoneCallParams *params) {
return GET_CPP_PTR(call)->accept(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params) : nullptr);
return GET_CPP_PTR(call)->accept(params ? L_GET_CPP_PTR_FROM_C_OBJECT(params) : nullptr);
}
LinphoneStatus linphone_call_accept_early_media (LinphoneCall* call) {
......@@ -944,11 +944,11 @@ LinphoneStatus linphone_call_accept_early_media (LinphoneCall* call) {
}
LinphoneStatus linphone_call_accept_early_media_with_params (LinphoneCall *call, const LinphoneCallParams *params) {
return GET_CPP_PTR(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params) : nullptr);
return GET_CPP_PTR(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_OBJECT(params) : nullptr);
}
LinphoneStatus linphone_call_update (LinphoneCall *call, const LinphoneCallParams *params) {
return GET_CPP_PTR(call)->update(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params) : nullptr);
return GET_CPP_PTR(call)->update(params ? L_GET_CPP_PTR_FROM_C_OBJECT(params) : nullptr);
}
LinphoneStatus linphone_call_defer_update (LinphoneCall *call) {
......@@ -971,7 +971,7 @@ LinphoneStatus linphone_call_defer_update (LinphoneCall *call) {
}
LinphoneStatus linphone_call_accept_update (LinphoneCall *call, const LinphoneCallParams *params) {
return GET_CPP_PTR(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params) : nullptr);
return GET_CPP_PTR(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_OBJECT(params) : nullptr);
}
LinphoneStatus linphone_call_transfer (LinphoneCall *call, const char *refer_to) {
......@@ -1156,7 +1156,7 @@ void linphone_call_set_params (LinphoneCall *call, const LinphoneCallParams *par
}
const LinphoneCallParams *linphone_call_get_params (LinphoneCall *call) {
L_SET_CPP_PTR_FROM_C_STRUCT(call->paramsCache, GET_CPP_PTR(call)->getParams());
L_SET_CPP_PTR_FROM_C_OBJECT(call->paramsCache, GET_CPP_PTR(call)->getParams());
return call->paramsCache;
}
......@@ -1174,11 +1174,11 @@ void linphone_call_unref (LinphoneCall *call) {
}
void *linphone_call_get_user_data (const LinphoneCall *call) {
return L_GET_USER_DATA_FROM_C_STRUCT(call, Call);
return L_GET_USER_DATA_FROM_C_OBJECT(call, Call);
}
void linphone_call_set_user_data (LinphoneCall *call, void *ud) {
L_SET_USER_DATA_FROM_C_STRUCT(call, ud, Call);
L_SET_USER_DATA_FROM_C_OBJECT(call, ud, Call);
}
// =============================================================================
......@@ -1187,9 +1187,9 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) {
LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg) {
LinphoneCall *call = L_INIT(Call);
L_SET_CPP_PTR_FROM_C_STRUCT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing,
*L_GET_CPP_PTR_FROM_C_STRUCT(from), *L_GET_CPP_PTR_FROM_C_STRUCT(to),
cfg, nullptr, L_GET_CPP_PTR_FROM_C_STRUCT(params)));
L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing,
*L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to),
cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params)));
call->currentParamsCache = linphone_call_params_new_for_wrapper();
call->paramsCache = linphone_call_params_new_for_wrapper();
call->remoteParamsCache = linphone_call_params_new_for_wrapper();
......@@ -1199,8 +1199,8 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres
LinphoneCall *linphone_call_new_incoming (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, SalOp *op) {
LinphoneCall *call = L_INIT(Call);
L_SET_CPP_PTR_FROM_C_STRUCT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming,
*L_GET_CPP_PTR_FROM_C_STRUCT(from), *L_GET_CPP_PTR_FROM_C_STRUCT(to),
L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming,
*L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to),
nullptr, op, nullptr));
call->currentParamsCache = linphone_call_params_new_for_wrapper();
call->paramsCache = linphone_call_params_new_for_wrapper();
......
......@@ -30,15 +30,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatMessage, ChatMessage)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, ChatMessage, ChatMessage)
using namespace std;
static void _linphone_chat_message_constructor (LinphoneChatMessage *msg);
static void _linphone_chat_message_destructor (LinphoneChatMessage *msg);
L_DECLARE_C_STRUCT_IMPL_WITH_XTORS(ChatMessage,
L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(ChatMessage,
_linphone_chat_message_constructor, _linphone_chat_message_destructor,
LinphoneChatMessageCbs *cbs;
LinphoneChatRoom* chat_room;
......@@ -92,11 +92,11 @@ void linphone_chat_message_unref (LinphoneChatMessage *msg) {
}
void * linphone_chat_message_get_user_data (const LinphoneChatMessage *msg) {
return L_GET_USER_DATA_FROM_C_STRUCT(msg, ChatMessage);
return L_GET_USER_DATA_FROM_C_OBJECT(msg, ChatMessage);
}
void linphone_chat_message_set_user_data (LinphoneChatMessage *msg, void *ud) {
L_SET_USER_DATA_FROM_C_STRUCT(msg, ud, ChatMessage);
L_SET_USER_DATA_FROM_C_OBJECT(msg, ud, ChatMessage);
}
......@@ -309,7 +309,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
linphone_chat_message_store_state(msg);
if (msg->state == LinphoneChatMessageStateDelivered || msg->state == LinphoneChatMessageStateNotDelivered) {
L_GET_PRIVATE_FROM_C_STRUCT(msg->chat_room, ChatRoom)->moveTransientMessageToWeakMessages(msg);
L_GET_PRIVATE_FROM_C_OBJECT(msg->chat_room, ChatRoom)->moveTransientMessageToWeakMessages(msg);
}
}
......@@ -324,7 +324,7 @@ void _linphone_chat_message_resend(LinphoneChatMessage *msg, bool_t ref_msg) {
cr = linphone_chat_message_get_chat_room(msg);
if (ref_msg) linphone_chat_message_ref(msg);
L_GET_CPP_PTR_FROM_C_STRUCT(cr)->sendMessage(msg);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->sendMessage(msg);
}
void linphone_chat_message_resend(LinphoneChatMessage *msg) {
......@@ -440,7 +440,7 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, Imdn
void linphone_chat_message_send_imdn(LinphoneChatMessage *cm, ImdnType imdn_type, LinphoneReason reason) {
char *content = linphone_chat_message_create_imdn_xml(cm, imdn_type, reason);
if (content) {
L_GET_PRIVATE_FROM_C_STRUCT(linphone_chat_message_get_chat_room(cm), ChatRoom)->sendImdn(content, reason);
L_GET_PRIVATE_FROM_C_OBJECT(linphone_chat_message_get_chat_room(cm), ChatRoom)->sendImdn(content, reason);
ms_free(content);
}
}
......@@ -465,7 +465,7 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) {
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr));
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
LinphoneCall *call = rttcr->getCall();
LinphoneCore *lc = rttcr->getCore();
const uint32_t new_line = 0x2028;
......@@ -936,7 +936,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
linphone_chat_message_ref(msg);
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
_release_http_request(msg);
L_GET_CPP_PTR_FROM_C_STRUCT(msg->chat_room)->sendMessage(msg);
L_GET_CPP_PTR_FROM_C_OBJECT(msg->chat_room)->sendMessage(msg);
file_upload_end_background_task(msg);
linphone_chat_message_unref(msg);
} else {
......
......@@ -29,15 +29,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatRoom)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, ChatRoom)
using namespace std;
static void _linphone_chat_room_constructor (LinphoneChatRoom *cr);
static void _linphone_chat_room_destructor (LinphoneChatRoom *cr);
L_DECLARE_C_STRUCT_IMPL_WITH_XTORS(
L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(
ChatRoom,
_linphone_chat_room_constructor, _linphone_chat_room_destructor,
LinphoneChatRoomCbs *cbs;
......@@ -211,7 +211,7 @@ LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr)
LinphoneParticipant *linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
return L_GET_C_BACK_PTR(GET_CPP_PTR(cr)->addParticipant(
*L_GET_CPP_PTR_FROM_C_STRUCT(addr), nullptr, false),
*L_GET_CPP_PTR_FROM_C_OBJECT(addr), nullptr, false),
Participant);
}
......@@ -237,7 +237,7 @@ bctbx_list_t *linphone_chat_room_get_participants (const LinphoneChatRoom *cr) {
}
void linphone_chat_room_remove_participant (LinphoneChatRoom *cr, LinphoneParticipant *participant) {
GET_CPP_PTR(cr)->removeParticipant(L_GET_CPP_PTR_FROM_C_STRUCT(participant));
GET_CPP_PTR(cr)->removeParticipant(L_GET_CPP_PTR_FROM_C_OBJECT(participant));
}
void linphone_chat_room_remove_participants (LinphoneChatRoom *cr, const bctbx_list_t *participants) {
......@@ -258,11 +258,11 @@ void linphone_chat_room_unref (LinphoneChatRoom *cr) {
}
void *linphone_chat_room_get_user_data (const LinphoneChatRoom *cr) {
return L_GET_USER_DATA_FROM_C_STRUCT(cr, ChatRoom);
return L_GET_USER_DATA_FROM_C_OBJECT(cr, ChatRoom);
}
void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
L_SET_USER_DATA_FROM_C_STRUCT(cr, ud, ChatRoom);
L_SET_USER_DATA_FROM_C_OBJECT(cr, ud, ChatRoom);
}
// =============================================================================
......@@ -272,12 +272,12 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) {
LinphoneChatRoom *cr = _linphone_ChatRoom_init();
if (linphone_core_realtime_text_enabled(core))
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr)));
L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
else
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr)));
L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
linphone_core_notify_chat_room_instantiated(core, cr);
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Created);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Created);
return cr;
}
......@@ -290,16 +290,16 @@ LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const
linphone_address_unref(factoryAddr);
std::string from;
if (proxy)
from = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy))->asString();
from = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_proxy_config_get_identity_address(proxy))->asString();
if (from.empty())
from = linphone_core_get_primary_contact(core);
LinphonePrivate::Address me(from);
std::list<LinphonePrivate::Address> l = L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(addresses, Address, Address);
LinphoneChatRoom *cr = _linphone_ChatRoom_init();
L_SET_CPP_PTR_FROM_C_STRUCT(cr, make_shared<LinphonePrivate::ClientGroupChatRoom>(core, me, l));
L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::ClientGroupChatRoom>(core, me, l));
linphone_core_notify_chat_room_instantiated(core, cr);
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
return cr;
}
......
......@@ -42,7 +42,7 @@ using namespace std;
LinphoneEventLog *linphone_event_log_new () {
LinphoneEventLog *event_log = _linphone_EventLog_init();
L_SET_CPP_PTR_FROM_C_STRUCT(event_log, new LINPHONE_NAMESPACE::EventLog());
L_SET_CPP_PTR_FROM_C_OBJECT(event_log, new LINPHONE_NAMESPACE::EventLog());
return event_log;
}
......@@ -53,7 +53,7 @@ LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) {
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log) {
return static_cast<LinphoneEventLogType>(
L_GET_CPP_PTR_FROM_C_STRUCT(event_log)->getType()
L_GET_CPP_PTR_FROM_C_OBJECT(event_log)->getType()
);
}
......@@ -63,11 +63,11 @@ LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_
LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneCall *call) {
LinphoneCallEvent *call_event = _linphone_CallEvent_init();
L_SET_CPP_PTR_FROM_C_STRUCT(
L_SET_CPP_PTR_FROM_C_OBJECT(
call_event,
new LINPHONE_NAMESPACE::CallEvent(
static_cast<LINPHONE_NAMESPACE::EventLog::Type>(type),
L_GET_CPP_PTR_FROM_C_STRUCT(call)
L_GET_CPP_PTR_FROM_C_OBJECT(call)
)
);
return call_event;
......@@ -75,7 +75,7 @@ LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneC
LinphoneCall *linphone_call_event_get_call (const LinphoneCallEvent *call_event) {
return L_GET_C_BACK_PTR(
L_GET_CPP_PTR_FROM_C_STRUCT(call_event)->getCall(), Call
L_GET_CPP_PTR_FROM_C_OBJECT(call_event)->getCall(), Call
);
}
......@@ -122,10 +122,10 @@ const LinphoneAddress *linphone_conference_participant_event_get_participant_add
LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *chat_message) {
LinphoneChatMessageEvent *chat_message_event = _linphone_ChatMessageEvent_init();
L_SET_CPP_PTR_FROM_C_STRUCT(
L_SET_CPP_PTR_FROM_C_OBJECT(
chat_message_event,
new LINPHONE_NAMESPACE::ChatMessageEvent(
L_GET_CPP_PTR_FROM_C_STRUCT(chat_message)
L_GET_CPP_PTR_FROM_C_OBJECT(chat_message)
)
);
return chat_message_event;
......@@ -133,7 +133,7 @@ LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *
LinphoneChatMessage *linphone_chat_message_event_get_chat_message (const LinphoneChatMessageEvent *chat_message_event) {
return L_GET_C_BACK_PTR(
L_GET_CPP_PTR_FROM_C_STRUCT(chat_message_event)->getChatMessage(),
L_GET_CPP_PTR_FROM_C_OBJECT(chat_message_event)->getChatMessage(),
ChatMessage
);
}
......@@ -25,7 +25,7 @@
using namespace std;
L_DECLARE_C_STRUCT_IMPL(Participant,
L_DECLARE_C_OBJECT_IMPL(Participant,
mutable LinphoneAddress *addressCache;
);
......@@ -39,15 +39,15 @@ void linphone_participant_unref (LinphoneParticipant *participant) {
}
void *linphone_participant_get_user_data(const LinphoneParticipant *participant) {
return L_GET_USER_DATA_FROM_C_STRUCT(participant, Participant);
return L_GET_USER_DATA_FROM_C_OBJECT(participant, Participant);
}
void linphone_participant_set_user_data(LinphoneParticipant *participant, void *ud) {
L_SET_USER_DATA_FROM_C_STRUCT(participant, ud, Participant);
L_SET_USER_DATA_FROM_C_OBJECT(participant, ud, Participant);
}
const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipant *participant) {
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_STRUCT(participant)->getAddress();
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_OBJECT(participant)->getAddress();
if (participant->addressCache)
linphone_address_unref(participant->addressCache);
participant->addressCache = linphone_address_new(addr.asString().c_str());
......@@ -55,9 +55,9 @@ const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipa
}
bool_t linphone_participant_is_admin (const LinphoneParticipant *participant) {
return L_GET_CPP_PTR_FROM_C_STRUCT(participant)->isAdmin();
return L_GET_CPP_PTR_FROM_C_OBJECT(participant)->isAdmin();
}
void linphone_participant_set_admin (LinphoneParticipant *participant, bool_t value) {
L_GET_CPP_PTR_FROM_C_STRUCT(participant)->setAdmin(value);
L_GET_CPP_PTR_FROM_C_OBJECT(participant)->setAdmin(value);
}
......@@ -269,9 +269,9 @@ private:
LINPHONE_END_NAMESPACE
#define L_INTERNAL_C_STRUCT_NO_XTOR(OBJECT)
#define L_INTERNAL_C_OBJECT_NO_XTOR(C_OBJECT)
#define L_INTERNAL_DECLARE_C_STRUCT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR) \
#define L_INTERNAL_DECLARE_C_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR) \
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); \
......@@ -331,22 +331,22 @@ LINPHONE_END_NAMESPACE
// -----------------------------------------------------------------------------
// Declare wrapped C object with constructor/destructor.
#define L_DECLARE_C_STRUCT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR, ...) \
#define L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR, ...) \
struct _Linphone ## C_TYPE { \
belle_sip_object_t base; \
std::shared_ptr<L_CPP_TYPE_OF_C_TYPE(C_TYPE)> cppPtr; \
__VA_ARGS__ \
}; \
L_INTERNAL_DECLARE_C_STRUCT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR)
L_INTERNAL_DECLARE_C_OBJECT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR)
// Declare wrapped C object.
#define L_DECLARE_C_STRUCT_IMPL(C_TYPE, ...) \
#define L_DECLARE_C_OBJECT_IMPL(C_TYPE, ...) \
struct _Linphone ## C_TYPE { \
belle_sip_object_t base; \
std::shared_ptr<L_CPP_TYPE_OF_C_TYPE(C_TYPE)> cppPtr; \
__VA_ARGS__ \
}; \
L_INTERNAL_DECLARE_C_STRUCT_FUNCTIONS(C_TYPE, L_INTERNAL_C_STRUCT_NO_XTOR, L_INTERNAL_C_STRUCT_NO_XTOR)
L_INTERNAL_DECLARE_C_OBJECT_FUNCTIONS(C_TYPE, L_INTERNAL_C_OBJECT_NO_XTOR, L_INTERNAL_C_OBJECT_NO_XTOR)
// Declare clonable wrapped C object.
#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(C_TYPE, ...) \
......@@ -376,7 +376,7 @@ LINPHONE_END_NAMESPACE
FALSE \
);
#define L_DECLARE_C_STRUCT_NEW_DEFAULT(C_TYPE, C_NAME) \
#define L_DECLARE_C_OBJECT_NEW_DEFAULT(C_TYPE, C_NAME) \
Linphone ## C_TYPE * linphone_ ## C_NAME ## _new() { \
Linphone ## C_TYPE * object = _linphone_ ## C_TYPE ## _init(); \
object->cppPtr = std::make_shared<LINPHONE_NAMESPACE::C_TYPE>(); \
......@@ -395,14 +395,14 @@ LINPHONE_END_NAMESPACE
#define L_INIT(C_TYPE) _linphone_ ## C_TYPE ## _init ()
// Get the cpp-ptr of a wrapped C object.
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT) \
#define L_GET_CPP_PTR_FROM_C_OBJECT(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC< \
L_CPP_TYPE_OF_C_OBJECT(OBJECT), \
std::remove_pointer<decltype(OBJECT)>::type \
>(OBJECT)
// Set the cpp-ptr of a wrapped C object.
#define L_SET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_PTR) \
#define L_SET_CPP_PTR_FROM_C_OBJECT(OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
// Get the private data of a shared or simple cpp-ptr.
......@@ -410,9 +410,9 @@ LINPHONE_END_NAMESPACE
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
<