Commit 1ff50ec1 authored by Ronan's avatar Ronan
Browse files

feat(Events): finish impl

parent a87e810a
...@@ -47,18 +47,22 @@ public: ...@@ -47,18 +47,22 @@ public:
template<typename T> template<typename T>
static inline std::shared_ptr<T> getCppPtrFromC (void *object) { static inline std::shared_ptr<T> getCppPtrFromC (void *object) {
if (!object) L_ASSERT(object);
return std::shared_ptr<T>();
return static_cast<WrappedObject<T> *>(object)->cppPtr; return static_cast<WrappedObject<T> *>(object)->cppPtr;
} }
template<typename T> template<typename T>
static inline std::shared_ptr<const T> getCppPtrFromC (const void *object) { static inline std::shared_ptr<const T> getCppPtrFromC (const void *object) {
if (!object) L_ASSERT(object);
return std::shared_ptr<const T>();
return static_cast<const WrappedObject<const T> *>(object)->cppPtr; 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: private:
Wrapper (); Wrapper ();
...@@ -108,6 +112,9 @@ LINPHONE_END_NAMESPACE ...@@ -108,6 +112,9 @@ LINPHONE_END_NAMESPACE
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \ #define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC<LINPHONE_NAMESPACE::TYPE>(OBJECT) 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) \ #define L_GET_PRIVATE(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT) LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "address/address.h"
#include "conference-event-p.h" #include "conference-event-p.h"
#include "conference-event.h" #include "conference-event.h"
...@@ -31,8 +32,7 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &ad ...@@ -31,8 +32,7 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &ad
L_D(ConferenceEvent); L_D(ConferenceEvent);
L_ASSERT(type == TypeConferenceCreated || type == TypeConferenceDestroyed); L_ASSERT(type == TypeConferenceCreated || type == TypeConferenceDestroyed);
L_ASSERT(address); L_ASSERT(address);
// TODO: Duplicate address. d->address = make_shared<Address>(*address);
d->address = address;
} }
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {} ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
...@@ -41,24 +41,22 @@ ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const sh ...@@ -41,24 +41,22 @@ ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const sh
EventLog(p, type) { EventLog(p, type) {
L_D(ConferenceEvent); L_D(ConferenceEvent);
L_ASSERT(address); L_ASSERT(address);
// TODO: Duplicate address. d->address = make_shared<Address>(*address);
d->address = address;
} }
ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) { ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
L_D(ConferenceEvent); L_D(ConferenceEvent);
if (this != &src) { if (this != &src) {
EventLog::operator=(src); EventLog::operator=(src);
// TODO: Duplicate address. d->address = make_shared<Address>(*src.getPrivate()->address);
d->address = src.getPrivate()->address;
} }
return *this; return *this;
} }
shared_ptr<const Address> ConferenceEvent::getAddress () const { shared_ptr<const Address> ConferenceEvent::getAddress () const {
// TODO. L_D(const ConferenceEvent);
return nullptr; return d->address;
} }
LINPHONE_END_NAMESPACE LINPHONE_END_NAMESPACE
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "address/address.h"
#include "conference-event-p.h" #include "conference-event-p.h"
#include "conference-participant-event.h" #include "conference-participant-event.h"
...@@ -46,8 +47,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent ( ...@@ -46,8 +47,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
type == TypeConferenceParticipantUnsetAdmin type == TypeConferenceParticipantUnsetAdmin
); );
L_ASSERT(participantAddress); L_ASSERT(participantAddress);
// TODO: Duplicate address. d->participantAddress = make_shared<Address>(*participantAddress);
d->participantAddress = participantAddress;
} }
ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) : ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) :
...@@ -57,16 +57,15 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere ...@@ -57,16 +57,15 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere
L_D(ConferenceParticipantEvent); L_D(ConferenceParticipantEvent);
if (this != &src) { if (this != &src) {
ConferenceEvent::operator=(src); ConferenceEvent::operator=(src);
// TODO: Duplicate address. d->participantAddress = make_shared<Address>(*src.getPrivate()->participantAddress);
d->participantAddress = src.getPrivate()->participantAddress;
} }
return *this; return *this;
} }
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const { shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
// TODO. L_D(const ConferenceParticipantEvent);
return nullptr; return d->participantAddress;
} }
LINPHONE_END_NAMESPACE 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