Commit 1ff50ec1 authored by Ronan's avatar Ronan

feat(Events): finish impl

parent a87e810a
......@@ -47,18 +47,22 @@ public:
template<typename T>
static inline std::shared_ptr<T> getCppPtrFromC (void *object) {
if (!object)
return std::shared_ptr<T>();
L_ASSERT(object);
return static_cast<WrappedObject<T> *>(object)->cppPtr;
}
template<typename T>
static inline std::shared_ptr<const T> getCppPtrFromC (const void *object) {
if (!object)
return std::shared_ptr<const T>();
L_ASSERT(object);
return static_cast<const WrappedObject<const T> *>(object)->cppPtr;
}
template<typename T>
static inline void setCppPtrFromC (void *object, std::shared_ptr<T> &cppPtr) {
L_ASSERT(object);
static_cast<WrappedObject<T> *>(object)->cppPtr = cppPtr;
}
private:
Wrapper ();
......@@ -108,6 +112,9 @@ LINPHONE_END_NAMESPACE
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC<LINPHONE_NAMESPACE::TYPE>(OBJECT)
#define L_SET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
#define L_GET_PRIVATE(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
......
......@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "address/address.h"
#include "conference-event-p.h"
#include "conference-event.h"
......@@ -31,8 +32,7 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &ad
L_D(ConferenceEvent);
L_ASSERT(type == TypeConferenceCreated || type == TypeConferenceDestroyed);
L_ASSERT(address);
// TODO: Duplicate address.
d->address = address;
d->address = make_shared<Address>(*address);
}
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
......@@ -41,24 +41,22 @@ ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const sh
EventLog(p, type) {
L_D(ConferenceEvent);
L_ASSERT(address);
// TODO: Duplicate address.
d->address = address;
d->address = make_shared<Address>(*address);
}
ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
L_D(ConferenceEvent);
if (this != &src) {
EventLog::operator=(src);
// TODO: Duplicate address.
d->address = src.getPrivate()->address;
d->address = make_shared<Address>(*src.getPrivate()->address);
}
return *this;
}
shared_ptr<const Address> ConferenceEvent::getAddress () const {
// TODO.
return nullptr;
L_D(const ConferenceEvent);
return d->address;
}
LINPHONE_END_NAMESPACE
......@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "address/address.h"
#include "conference-event-p.h"
#include "conference-participant-event.h"
......@@ -46,8 +47,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
type == TypeConferenceParticipantUnsetAdmin
);
L_ASSERT(participantAddress);
// TODO: Duplicate address.
d->participantAddress = participantAddress;
d->participantAddress = make_shared<Address>(*participantAddress);
}
ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) :
......@@ -57,16 +57,15 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere
L_D(ConferenceParticipantEvent);
if (this != &src) {
ConferenceEvent::operator=(src);
// TODO: Duplicate address.
d->participantAddress = src.getPrivate()->participantAddress;
d->participantAddress = make_shared<Address>(*src.getPrivate()->participantAddress);
}
return *this;
}
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
// TODO.
return nullptr;
L_D(const ConferenceParticipantEvent);
return d->participantAddress;
}
LINPHONE_END_NAMESPACE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment