mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 16:09:20 +00:00
feat(core): add c-wrapper tools
This commit is contained in:
parent
1cc45284cf
commit
ce37899b26
18 changed files with 200 additions and 94 deletions
|
|
@ -1890,7 +1890,8 @@ BELLE_SIP_TYPE_ID(LinphoneTransports),
|
|||
BELLE_SIP_TYPE_ID(LinphoneVideoActivationPolicy),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallStats),
|
||||
BELLE_SIP_TYPE_ID(LinphonePlayer),
|
||||
BELLE_SIP_TYPE_ID(LinphonePlayerCbs)
|
||||
BELLE_SIP_TYPE_ID(LinphonePlayerCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEventLog)
|
||||
BELLE_SIP_DECLARE_TYPES_END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
############################################################################
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
||||
c-wrapper/c-types.h
|
||||
content/content.h
|
||||
core/core.h
|
||||
cpim/cpim.h
|
||||
|
|
@ -38,12 +39,13 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
db/provider/db-session-provider.h
|
||||
db/provider/db-session.h
|
||||
enums.h
|
||||
event/call-event.h
|
||||
event/conference-event-p.h
|
||||
event/conference-event.h
|
||||
event/conference-participant-event.h
|
||||
event/event.h
|
||||
event/message-event.h
|
||||
event-log/call-event.h
|
||||
event-log/conference-event-p.h
|
||||
event-log/conference-event.h
|
||||
event-log/conference-participant-event.h
|
||||
event-log/event-log-p.h
|
||||
event-log/event-log.h
|
||||
event-log/message-event.h
|
||||
logger/logger.h
|
||||
message/message.h
|
||||
object/clonable-object-p.h
|
||||
|
|
@ -56,6 +58,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
)
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
||||
c-wrapper/c-types.cpp
|
||||
content/content.cpp
|
||||
core/core.cpp
|
||||
cpim/header/cpim-core-headers.cpp
|
||||
|
|
@ -68,11 +71,11 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
db/events-db.cpp
|
||||
db/provider/db-session-provider.cpp
|
||||
db/provider/db-session.cpp
|
||||
event/call-event.cpp
|
||||
event/conference-event.cpp
|
||||
event/conference-participant-event.cpp
|
||||
event/event.cpp
|
||||
event/message-event.cpp
|
||||
event-log/call-event.cpp
|
||||
event-log/conference-event.cpp
|
||||
event-log/conference-participant-event.cpp
|
||||
event-log/event-log.cpp
|
||||
event-log/message-event.cpp
|
||||
logger/logger.cpp
|
||||
message/message.cpp
|
||||
object/clonable-object.cpp
|
||||
|
|
|
|||
63
src/c-wrapper/c-types.cpp
Normal file
63
src/c-wrapper/c-types.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* types.cpp
|
||||
* Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <belle-sip/belle-sip.h>
|
||||
#include <memory>
|
||||
|
||||
// From coreapi.
|
||||
#include "private.h"
|
||||
|
||||
#include "event-log/event-log.h"
|
||||
|
||||
#include "c-types.h"
|
||||
|
||||
// ================================================================²=============
|
||||
|
||||
using namespace std;
|
||||
|
||||
void toto () {
|
||||
LinphonePrivate::EventLog titi;
|
||||
LinphonePrivate::EventLog machin(titi);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#define L_DECLARE_C_STRUCT_IMPL(STRUCT) \
|
||||
struct _Linphone ## STRUCT { \
|
||||
belle_sip_object_t base; \
|
||||
shared_ptr<LINPHONE_NAMESPACE::STRUCT> cppPtr; \
|
||||
}; \
|
||||
static void _linphone_ ## STRUCT ## _uninit(Linphone ## STRUCT * object) { \
|
||||
object->cppPtr.reset(); \
|
||||
object->cppPtr->~STRUCT (); \
|
||||
} \
|
||||
static void _linphone_ ## STRUCT ## _clone(Linphone ## STRUCT * dest, const Linphone ## STRUCT * src) { \
|
||||
new(&dest->cppPtr) shared_ptr<LINPHONE_NAMESPACE::STRUCT>(); \
|
||||
dest->cppPtr = make_shared<LINPHONE_NAMESPACE::STRUCT>(*src->cppPtr.get()); \
|
||||
} \
|
||||
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## STRUCT); \
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## STRUCT); \
|
||||
BELLE_SIP_INSTANCIATE_VPTR(Linphone ## STRUCT, belle_sip_object_t, \
|
||||
_linphone_ ## STRUCT ## _uninit, \
|
||||
_linphone_ ## STRUCT ## _clone, \
|
||||
NULL, \
|
||||
FALSE \
|
||||
);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
L_DECLARE_C_STRUCT_IMPL(EventLog);
|
||||
}
|
||||
38
src/c-wrapper/c-types.h
Normal file
38
src/c-wrapper/c-types.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* c-types.h
|
||||
* Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
// =============================================================================
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define L_DECLARE_C_STRUCT(STRUCT) typedef struct _Linphone ## STRUCT Linphone ## STRUCT;
|
||||
|
||||
L_DECLARE_C_STRUCT(EventLog)
|
||||
|
||||
#undef L_DECLARE_C_STRUCT
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ifndef _C_TYPES_H_
|
||||
|
|
@ -23,9 +23,8 @@
|
|||
#endif // ifdef SOCI_ENABLED
|
||||
|
||||
#include "abstract/abstract-db-p.h"
|
||||
#include "event/call-event.h"
|
||||
#include "event/event.h"
|
||||
#include "event/message-event.h"
|
||||
#include "event-log/call-event.h"
|
||||
#include "event-log/message-event.h"
|
||||
#include "logger/logger.h"
|
||||
#include "message/message.h"
|
||||
|
||||
|
|
@ -250,29 +249,29 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
}
|
||||
|
||||
bool EventsDb::addEvent (const Event &event) {
|
||||
bool EventsDb::addEvent (const EventLog &eventLog) {
|
||||
// TODO.
|
||||
switch (event.getType()) {
|
||||
case Event::None:
|
||||
switch (eventLog.getType()) {
|
||||
case EventLog::None:
|
||||
return false;
|
||||
case Event::MessageEvent:
|
||||
case Event::CallStartEvent:
|
||||
case Event::CallEndEvent:
|
||||
case Event::ConferenceCreatedEvent:
|
||||
case Event::ConferenceDestroyedEvent:
|
||||
case Event::ConferenceParticipantAddedEvent:
|
||||
case Event::ConferenceParticipantRemovedEvent:
|
||||
case Event::ConferenceParticipantSetAdminEvent:
|
||||
case Event::ConferenceParticipantUnsetAdminEvent:
|
||||
case EventLog::MessageEvent:
|
||||
case EventLog::CallStartEvent:
|
||||
case EventLog::CallEndEvent:
|
||||
case EventLog::ConferenceCreatedEvent:
|
||||
case EventLog::ConferenceDestroyedEvent:
|
||||
case EventLog::ConferenceParticipantAddedEvent:
|
||||
case EventLog::ConferenceParticipantRemovedEvent:
|
||||
case EventLog::ConferenceParticipantSetAdminEvent:
|
||||
case EventLog::ConferenceParticipantUnsetAdminEvent:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventsDb::deleteEvent (const Event &event) {
|
||||
bool EventsDb::deleteEvent (const EventLog &eventLog) {
|
||||
// TODO.
|
||||
(void)event;
|
||||
(void)eventLog;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -344,21 +343,21 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
return count;
|
||||
}
|
||||
|
||||
list<Event> EventsDb::getHistory (const string &remoteAddress, int nLast, FilterMask mask) const {
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &remoteAddress, int nLast, FilterMask mask) const {
|
||||
// TODO.
|
||||
(void)remoteAddress;
|
||||
(void)nLast;
|
||||
(void)mask;
|
||||
return list<Event>();
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
list<Event> EventsDb::getHistory (const string &remoteAddress, int begin, int end, FilterMask mask) const {
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &remoteAddress, int begin, int end, FilterMask mask) const {
|
||||
// TODO.
|
||||
(void)remoteAddress;
|
||||
(void)begin;
|
||||
(void)end;
|
||||
(void)mask;
|
||||
return list<Event>();
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
void EventsDb::cleanHistory (const string &remoteAddress) {
|
||||
|
|
@ -374,11 +373,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
|
||||
void EventsDb::init () {}
|
||||
|
||||
bool EventsDb::addEvent (const Event &) {
|
||||
bool EventsDb::addEvent (const EventLog &) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EventsDb::deleteEvent (const Event &) {
|
||||
bool EventsDb::deleteEvent (const EventLog &) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -396,12 +395,12 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
return 0;
|
||||
}
|
||||
|
||||
list<Event> EventsDb::getHistory (const string &, int, FilterMask) const {
|
||||
return list<Event>();
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &, int, FilterMask) const {
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
list<Event> EventsDb::getHistory (const string &, int, int, FilterMask) const {
|
||||
return list<Event>();
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &, int, int, FilterMask) const {
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
void EventsDb::cleanHistory (const string &) {}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define _EVENTS_DB_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "abstract/abstract-db.h"
|
||||
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class Event;
|
||||
class EventLog;
|
||||
class EventsDbPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC EventsDb : public AbstractDb {
|
||||
|
|
@ -44,16 +45,16 @@ public:
|
|||
EventsDb ();
|
||||
|
||||
// Generic.
|
||||
bool addEvent (const Event &event);
|
||||
bool deleteEvent (const Event &event);
|
||||
bool addEvent (const EventLog &eventLog);
|
||||
bool deleteEvent (const EventLog &eventLog);
|
||||
void cleanEvents (FilterMask mask = NoFilter);
|
||||
int getEventsCount (FilterMask mask = NoFilter) const;
|
||||
|
||||
// Messages, calls and conferences.
|
||||
int getMessagesCount (const std::string &remoteAddress = "") const;
|
||||
int getUnreadMessagesCount (const std::string &remoteAddress = "") const;
|
||||
std::list<Event> getHistory (const std::string &remoteAddress, int nLast, FilterMask mask = NoFilter) const;
|
||||
std::list<Event> getHistory (const std::string &remoteAddress, int begin, int end, FilterMask mask = NoFilter) const;
|
||||
std::list<std::shared_ptr<EventLog> > getHistory (const std::string &remoteAddress, int nLast, FilterMask mask = NoFilter) const;
|
||||
std::list<std::shared_ptr<EventLog> > getHistory (const std::string &remoteAddress, int begin, int end, FilterMask mask = NoFilter) const;
|
||||
void cleanHistory (const std::string &remoteAddress = "");
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "event-p.h"
|
||||
#include "event-log-p.h"
|
||||
|
||||
#include "call-event.h"
|
||||
|
||||
|
|
@ -26,14 +26,14 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class CallEventPrivate : public EventPrivate {
|
||||
class CallEventPrivate : public EventLogPrivate {
|
||||
public:
|
||||
shared_ptr<Call> call;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
CallEvent::CallEvent (Type type, const shared_ptr<Call> &call) : Event(*new CallEventPrivate, type) {
|
||||
CallEvent::CallEvent (Type type, const shared_ptr<Call> &call) : EventLog(*new CallEventPrivate, type) {
|
||||
L_D(CallEvent);
|
||||
L_ASSERT(call);
|
||||
L_ASSERT(type == CallStartEvent || type == CallEndEvent);
|
||||
|
|
@ -45,7 +45,7 @@ CallEvent::CallEvent (const CallEvent &src) : CallEvent(src.getType(), src.getCa
|
|||
CallEvent &CallEvent::operator= (const CallEvent &src) {
|
||||
L_D(CallEvent);
|
||||
if (this != &src) {
|
||||
Event::operator=(src);
|
||||
EventLog::operator=(src);
|
||||
d->call = src.getPrivate()->call;
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "event.h"
|
||||
#include "event-log.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
class Call;
|
||||
class CallEventPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC CallEvent : public Event {
|
||||
class LINPHONE_PUBLIC CallEvent : public EventLog {
|
||||
public:
|
||||
CallEvent (Type type, const std::shared_ptr<Call> &message);
|
||||
CallEvent (const CallEvent &src);
|
||||
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "conference-event.h"
|
||||
|
||||
#include "event-p.h"
|
||||
#include "event-log-p.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class ConferenceEventPrivate : public EventPrivate {
|
||||
class ConferenceEventPrivate : public EventLogPrivate {
|
||||
private:
|
||||
std::shared_ptr<Address> address;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ using namespace std;
|
|||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<Address> &address) :
|
||||
Event(*new ConferenceEventPrivate, type) {
|
||||
EventLog(*new ConferenceEventPrivate, type) {
|
||||
L_D(ConferenceEvent);
|
||||
L_ASSERT(type == ConferenceCreatedEvent || type == ConferenceDestroyedEvent);
|
||||
L_ASSERT(address);
|
||||
|
|
@ -37,7 +37,7 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<Address> &address)
|
|||
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
|
||||
|
||||
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr<Address> &address) :
|
||||
Event(p, type) {
|
||||
EventLog(p, type) {
|
||||
L_D(ConferenceEvent);
|
||||
L_ASSERT(address);
|
||||
d->address = address;
|
||||
|
|
@ -46,7 +46,7 @@ ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const sh
|
|||
ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
|
||||
L_D(ConferenceEvent);
|
||||
if (this != &src) {
|
||||
Event::operator=(src);
|
||||
EventLog::operator=(src);
|
||||
d->address = src.getPrivate()->address;
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "event.h"
|
||||
#include "event-log.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
class Address;
|
||||
class ConferenceEventPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC ConferenceEvent : public Event {
|
||||
class LINPHONE_PUBLIC ConferenceEvent : public EventLog {
|
||||
public:
|
||||
ConferenceEvent (Type type, const std::shared_ptr<Address> &address);
|
||||
ConferenceEvent (const ConferenceEvent &src);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* event-p.h
|
||||
* event-log-p.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,23 +16,23 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EVENT_P_H_
|
||||
#define _EVENT_P_H_
|
||||
#ifndef _EVENT_LOG_P_H_
|
||||
#define _EVENT_LOG_P_H_
|
||||
|
||||
#include "event.h"
|
||||
#include "event-log.h"
|
||||
#include "object/clonable-object-p.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class EventPrivate : public ClonableObjectPrivate {
|
||||
class EventLogPrivate : public ClonableObjectPrivate {
|
||||
private:
|
||||
Event::Type type = Event::None;
|
||||
EventLog::Type type = EventLog::None;
|
||||
|
||||
L_DECLARE_PUBLIC(Event);
|
||||
L_DECLARE_PUBLIC(EventLog);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _EVENT_P_H_
|
||||
#endif // ifndef _EVENT_LOG_P_H_
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* event.cpp
|
||||
* event-log.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "event-p.h"
|
||||
#include "event-log-p.h"
|
||||
|
||||
#include "event.h"
|
||||
#include "event-log.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -26,24 +26,24 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Event::Event () : ClonableObject(*new EventPrivate) {}
|
||||
EventLog::EventLog () : ClonableObject(*new EventLogPrivate) {}
|
||||
|
||||
Event::Event (const Event &) : ClonableObject(*new EventPrivate) {}
|
||||
EventLog::EventLog (const EventLog &) : ClonableObject(*new EventLogPrivate) {}
|
||||
|
||||
Event::Event (EventPrivate &p, Type type) : ClonableObject(*new EventPrivate) {
|
||||
L_D(Event);
|
||||
EventLog::EventLog (EventLogPrivate &p, Type type) : ClonableObject(*new EventLogPrivate) {
|
||||
L_D(EventLog);
|
||||
d->type = type;
|
||||
}
|
||||
|
||||
Event &Event::operator= (const Event &src) {
|
||||
L_D(Event);
|
||||
EventLog &EventLog::operator= (const EventLog &src) {
|
||||
L_D(EventLog);
|
||||
if (this != &src)
|
||||
d->type = src.getPrivate()->type;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Event::Type Event::getType () const {
|
||||
L_D(const Event);
|
||||
EventLog::Type EventLog::getType () const {
|
||||
L_D(const EventLog);
|
||||
return d->type;
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* event.h
|
||||
* event-log.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _EVENT_H_
|
||||
#define _EVENT_H_
|
||||
#ifndef _EVENT_LOG_H_
|
||||
#define _EVENT_LOG_H_
|
||||
|
||||
#include "object/clonable-object.h"
|
||||
|
||||
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class EventPrivate;
|
||||
class EventLogPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC Event : public ClonableObject {
|
||||
class LINPHONE_PUBLIC EventLog : public ClonableObject {
|
||||
public:
|
||||
enum Type {
|
||||
None,
|
||||
|
|
@ -46,21 +46,21 @@ public:
|
|||
ConferenceParticipantUnsetAdminEvent
|
||||
};
|
||||
|
||||
Event ();
|
||||
Event (const Event &src);
|
||||
virtual ~Event () = default;
|
||||
EventLog ();
|
||||
EventLog (const EventLog &src);
|
||||
virtual ~EventLog () = default;
|
||||
|
||||
Event &operator= (const Event &src);
|
||||
EventLog &operator= (const EventLog &src);
|
||||
|
||||
Type getType () const;
|
||||
|
||||
protected:
|
||||
Event (EventPrivate &p, Type type);
|
||||
EventLog (EventLogPrivate &p, Type type);
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(Event);
|
||||
L_DECLARE_PRIVATE(EventLog);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _EVENT_H_
|
||||
#endif // ifndef _EVENT_LOG_H_
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "event-p.h"
|
||||
#include "event-log-p.h"
|
||||
|
||||
#include "message-event.h"
|
||||
|
||||
|
|
@ -26,14 +26,15 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class MessageEventPrivate : public EventPrivate {
|
||||
class MessageEventPrivate : public EventLogPrivate {
|
||||
public:
|
||||
shared_ptr<Message> message;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
MessageEvent::MessageEvent (const shared_ptr<Message> &message) : Event(*new MessageEventPrivate, Event::MessageEvent) {
|
||||
MessageEvent::MessageEvent (const shared_ptr<Message> &message) :
|
||||
EventLog(*new MessageEventPrivate, EventLog::MessageEvent) {
|
||||
L_D(MessageEvent);
|
||||
L_ASSERT(message);
|
||||
d->message = message;
|
||||
|
|
@ -44,7 +45,7 @@ MessageEvent::MessageEvent (const MessageEvent &src) : MessageEvent(src.getMessa
|
|||
MessageEvent &MessageEvent::operator= (const MessageEvent &src) {
|
||||
L_D(MessageEvent);
|
||||
if (this != &src) {
|
||||
Event::operator=(src);
|
||||
EventLog::operator=(src);
|
||||
d->message = src.getPrivate()->message;
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "event.h"
|
||||
#include "event-log.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
class Message;
|
||||
class MessageEventPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC MessageEvent : public Event {
|
||||
class LINPHONE_PUBLIC MessageEvent : public EventLog {
|
||||
public:
|
||||
MessageEvent (const std::shared_ptr<Message> &message);
|
||||
MessageEvent (const MessageEvent &src);
|
||||
Loading…
Add table
Reference in a new issue