Commit c156730d authored by Ronan's avatar Ronan

feat(general): remove class parameter of L_D and L_Q

parent 21ddaf03
......@@ -125,8 +125,8 @@ inline const Object *getPublicHelper (const T *object, const ObjectPrivate *) {
CLASS(const CLASS &) = delete; \
CLASS &operator= (const CLASS &) = delete;
#define L_D(CLASS) CLASS ## Private * const d = getPrivate();
#define L_Q(CLASS) CLASS * const q = getPublic();
#define L_D() decltype(std::declval<decltype(*this)>().getPrivate()) const d = getPrivate();
#define L_Q() decltype(std::declval<decltype(*this)>().getPublic()) const q = getPublic();
#define L_USE_DEFAULT_SHARE_IMPL(CLASS, PARENT_CLASS) \
CLASS::CLASS (const CLASS &src) : PARENT_CLASS(*src.getPrivate()) {} \
......
......@@ -31,7 +31,7 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
Address::Address (const string &address) : ClonableObject(*new AddressPrivate) {
L_D(Address);
L_D();
if (!(d->internalAddress = sal_address_new(L_STRING_TO_C(address)))) {
lWarning() << "Cannot create address, bad uri [" << address << "].";
return;
......@@ -39,20 +39,20 @@ Address::Address (const string &address) : ClonableObject(*new AddressPrivate) {
}
Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
L_D(Address);
L_D();
SalAddress *salAddress = src.getPrivate()->internalAddress;
if (salAddress)
d->internalAddress = sal_address_clone(salAddress);
}
Address::~Address () {
L_D(Address);
L_D();
if (d->internalAddress)
sal_address_destroy(d->internalAddress);
}
Address &Address::operator= (const Address &src) {
L_D(Address);
L_D();
if (this != &src) {
if (d->internalAddress)
sal_address_destroy(d->internalAddress);
......@@ -72,24 +72,24 @@ bool Address::operator< (const Address &address) const {
}
bool Address::isValid () const {
L_D(const Address);
L_D();
return static_cast<bool>(d->internalAddress);
}
const string &Address::getScheme () const {
L_D(const Address);
L_D();
d->cache.scheme = L_C_TO_STRING(sal_address_get_scheme(d->internalAddress));
return d->cache.scheme;
}
const string &Address::getDisplayName () const {
L_D(const Address);
L_D();
d->cache.displayName = L_C_TO_STRING(sal_address_get_display_name(d->internalAddress));
return d->cache.displayName;
}
bool Address::setDisplayName (const string &displayName) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -99,13 +99,13 @@ bool Address::setDisplayName (const string &displayName) {
}
const string &Address::getUsername () const {
L_D(const Address);
L_D();
d->cache.username = L_C_TO_STRING(sal_address_get_username(d->internalAddress));
return d->cache.username;
}
bool Address::setUsername (const string &username) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -115,13 +115,13 @@ bool Address::setUsername (const string &username) {
}
const string &Address::getDomain () const {
L_D(const Address);
L_D();
d->cache.domain = L_C_TO_STRING(sal_address_get_domain(d->internalAddress));
return d->cache.domain;
}
bool Address::setDomain (const string &domain) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -131,12 +131,12 @@ bool Address::setDomain (const string &domain) {
}
int Address::getPort () const {
L_D(const Address);
L_D();
return d->internalAddress ? sal_address_get_port(d->internalAddress) : 0;
}
bool Address::setPort (int port) {
L_D(const Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -146,12 +146,12 @@ bool Address::setPort (int port) {
}
Transport Address::getTransport () const {
L_D(const Address);
L_D();
return d->internalAddress ? static_cast<Transport>(sal_address_get_transport(d->internalAddress)) : Transport::Udp;
}
bool Address::setTransport (Transport transport) {
L_D(const Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -161,12 +161,12 @@ bool Address::setTransport (Transport transport) {
}
bool Address::getSecure () const {
L_D(const Address);
L_D();
return d->internalAddress ? sal_address_is_secure(d->internalAddress) : false;
}
bool Address::setSecure (bool enabled) {
L_D(const Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -176,18 +176,18 @@ bool Address::setSecure (bool enabled) {
}
bool Address::isSip () const {
L_D(const Address);
L_D();
return d->internalAddress ? sal_address_is_sip(d->internalAddress) : false;
}
const string &Address::getMethodParam () const {
L_D(const Address);
L_D();
d->cache.methodParam = L_C_TO_STRING(sal_address_get_method_param(d->internalAddress));
return d->cache.methodParam;
}
bool Address::setMethodParam (const string &methodParam) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -197,13 +197,13 @@ bool Address::setMethodParam (const string &methodParam) {
}
const string &Address::getPassword () const {
L_D(const Address);
L_D();
d->cache.password = L_C_TO_STRING(sal_address_get_password(d->internalAddress));
return d->cache.password;
}
bool Address::setPassword (const string &password) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -213,7 +213,7 @@ bool Address::setPassword (const string &password) {
}
bool Address::clean () {
L_D(const Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -223,7 +223,7 @@ bool Address::clean () {
}
string Address::asString () const {
L_D(const Address);
L_D();
if (!d->internalAddress)
return "";
......@@ -235,7 +235,7 @@ string Address::asString () const {
}
string Address::asStringUriOnly () const {
L_D(const Address);
L_D();
if (!d->internalAddress)
return "";
......@@ -257,7 +257,7 @@ bool Address::weakEqual (const Address &address) const {
}
const string &Address::getHeaderValue (const string &headerName) const {
L_D(const Address);
L_D();
const char *value = sal_address_get_header(d->internalAddress, L_STRING_TO_C(headerName));
if (value) {
......@@ -269,7 +269,7 @@ const string &Address::getHeaderValue (const string &headerName) const {
}
bool Address::setHeader (const string &headerName, const string &headerValue) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -279,12 +279,12 @@ bool Address::setHeader (const string &headerName, const string &headerValue) {
}
bool Address::hasParam (const string &paramName) const {
L_D(const Address);
L_D();
return sal_address_has_param(d->internalAddress, L_STRING_TO_C(paramName));
}
const string &Address::getParamValue (const string &paramName) const {
L_D(const Address);
L_D();
const char *value = sal_address_get_param(d->internalAddress, L_STRING_TO_C(paramName));
if (value) {
......@@ -296,7 +296,7 @@ const string &Address::getParamValue (const string &paramName) const {
}
bool Address::setParam (const string &paramName, const string &paramValue) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -306,7 +306,7 @@ bool Address::setParam (const string &paramName, const string &paramValue) {
}
bool Address::setParams (const string &params) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -316,12 +316,12 @@ bool Address::setParams (const string &params) {
}
bool Address::hasUriParam (const string &uriParamName) const {
L_D(const Address);
L_D();
return sal_address_has_uri_param(d->internalAddress, L_STRING_TO_C(uriParamName));
}
const string &Address::getUriParamValue (const string &uriParamName) const {
L_D(const Address);
L_D();
const char *value = sal_address_get_uri_param(d->internalAddress, L_STRING_TO_C(uriParamName));
if (value) {
......@@ -333,7 +333,7 @@ const string &Address::getUriParamValue (const string &uriParamName) const {
}
bool Address::setUriParam (const string &uriParamName, const string &uriParamValue) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......@@ -343,7 +343,7 @@ bool Address::setUriParam (const string &uriParamName, const string &uriParamVal
}
bool Address::setUriParams (const string &uriParams) {
L_D(Address);
L_D();
if (!d->internalAddress)
return false;
......
......@@ -222,7 +222,7 @@ Call::Call (
SalOp *op,
const MediaSessionParams *msp
) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) {
L_D(Call);
L_D();
const Address *myAddress = (direction == LinphoneCallIncoming) ? &to : &from;
string confType = lp_config_get_string(linphone_core_get_config(core), "misc", "conference_type", "local");
if (confType == "remote") {
......@@ -238,296 +238,296 @@ Call::Call (
// -----------------------------------------------------------------------------
LinphoneStatus Call::accept (const MediaSessionParams *msp) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->accept(msp);
}
LinphoneStatus Call::acceptEarlyMedia (const MediaSessionParams *msp) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->acceptEarlyMedia(msp);
}
LinphoneStatus Call::acceptUpdate (const MediaSessionParams *msp) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->acceptUpdate(msp);
}
LinphoneStatus Call::decline (LinphoneReason reason) {
L_D(Call);
L_D();
return d->getActiveSession()->decline(reason);
}
LinphoneStatus Call::decline (const LinphoneErrorInfo *ei) {
L_D(Call);
L_D();
return d->getActiveSession()->decline(ei);
}
LinphoneStatus Call::pause () {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->pause();
}
LinphoneStatus Call::resume () {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->resume();
}
void Call::sendVfuRequest () {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->sendVfuRequest();
}
void Call::startRecording () {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->startRecording();
}
void Call::stopRecording () {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->stopRecording();
}
LinphoneStatus Call::takePreviewSnapshot (const string &file) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->takePreviewSnapshot(file);
}
LinphoneStatus Call::takeVideoSnapshot (const string &file) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->takeVideoSnapshot(file);
}
LinphoneStatus Call::terminate (const LinphoneErrorInfo *ei) {
L_D(Call);
L_D();
return d->getActiveSession()->terminate(ei);
}
LinphoneStatus Call::update (const MediaSessionParams *msp) {
L_D(Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->update(msp);
}
void Call::zoomVideo (float zoomFactor, float *cx, float *cy) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->zoomVideo(zoomFactor, cx, cy);
}
// -----------------------------------------------------------------------------
bool Call::cameraEnabled () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->cameraEnabled();
}
bool Call::echoCancellationEnabled () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->echoCancellationEnabled();
}
bool Call::echoLimiterEnabled () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->echoLimiterEnabled();
}
void Call::enableCamera (bool value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->enableCamera(value);
}
void Call::enableEchoCancellation (bool value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->enableEchoCancellation(value);
}
void Call::enableEchoLimiter (bool value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->enableEchoLimiter(value);
}
bool Call::getAllMuted () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getAllMuted();
}
LinphoneCallStats *Call::getAudioStats () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getAudioStats();
}
string Call::getAuthenticationToken () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getAuthenticationToken();
}
bool Call::getAuthenticationTokenVerified () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getAuthenticationTokenVerified();
}
float Call::getAverageQuality () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getAverageQuality();
}
LinphoneCore *Call::getCore () const {
L_D(const Call);
L_D();
return d->core;
}
const MediaSessionParams *Call::getCurrentParams () const {
L_D(const Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->getCurrentParams();
}
float Call::getCurrentQuality () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getCurrentQuality();
}
LinphoneCallDir Call::getDirection () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getDirection();
}
int Call::getDuration () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getDuration();
}
const LinphoneErrorInfo *Call::getErrorInfo () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getErrorInfo();
}
LinphoneCallLog *Call::getLog () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getLog();
}
RtpTransport *Call::getMetaRtcpTransport (int streamIndex) const {
L_D(const Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->getMetaRtcpTransport(streamIndex);
}
RtpTransport *Call::getMetaRtpTransport (int streamIndex) const {
L_D(const Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->getMetaRtpTransport(streamIndex);
}
float Call::getMicrophoneVolumeGain () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getMicrophoneVolumeGain();
}
void *Call::getNativeVideoWindowId () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getNativeVideoWindowId();
}
const MediaSessionParams *Call::getParams () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getMediaParams();
}
float Call::getPlayVolume () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getPlayVolume();
}
LinphoneReason Call::getReason () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getReason();
}
float Call::getRecordVolume () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getRecordVolume();
}
const Address &Call::getRemoteAddress () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getRemoteAddress();
}
string Call::getRemoteAddressAsString () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getRemoteAddressAsString();
}
string Call::getRemoteContact () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getRemoteContact();
}
const MediaSessionParams *Call::getRemoteParams () const {
L_D(const Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->getRemoteParams();
}
float Call::getSpeakerVolumeGain () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getSpeakerVolumeGain();
}
LinphoneCallState Call::getState () const {
L_D(const Call);
L_D();
return d->getActiveSession()->getState();
}
LinphoneCallStats *Call::getStats (LinphoneStreamType type) const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getStats(type);
}
int Call::getStreamCount () const {
L_D(const Call);
L_D();
return static_cast<MediaSession *>(d->getActiveSession().get())->getStreamCount();
}
MSFormatType Call::getStreamType (int streamIndex) const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getStreamType(streamIndex);
}
LinphoneCallStats *Call::getTextStats () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getTextStats();
}
LinphoneCallStats *Call::getVideoStats () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->getVideoStats();
}
bool Call::mediaInProgress () const {
L_D(const Call);
L_D();
return static_cast<const MediaSession *>(d->getActiveSession().get())->mediaInProgress();
}
void Call::setAuthenticationTokenVerified (bool value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->setAuthenticationTokenVerified(value);
}
void Call::setMicrophoneVolumeGain (float value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->setMicrophoneVolumeGain(value);
}
void Call::setNativeVideoWindowId (void *id) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->setNativeVideoWindowId(id);
}
void Call::setNextVideoFrameDecodedCallback (LinphoneCallCbFunc cb, void *user_data) {
L_D(Call);
L_D();
d->nextVideoFrameDecoded._func = cb;
d->nextVideoFrameDecoded._user_data = user_data;
d->onResetFirstVideoFrameDecoded();
}
void Call::setSpeakerVolumeGain (float value) {
L_D(Call);
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->setSpeakerVolumeGain(value);
}
......
......@@ -58,7 +58,7 @@ int BasicChatRoom::getNbParticipants () const {
}
list<shared_ptr<Participant>> BasicChatRoom::getParticipants () const {
L_D(const BasicChatRoom);
L_D();
list<shared_ptr<Participant>> l;
l.push_back(make_shared<Participant>(d->peerAddress));
return l;
......
......@@ -61,73 +61,73 @@ LinphoneChatMessage * ChatMessage::getBackPtr() {
}
shared_ptr<ChatRoom> ChatMessage::getChatRoom () const {
L_D(const ChatMessage);
L_D();
return d->chatRoom;
}
void ChatMessage::setChatRoom (shared_ptr<ChatRoom> chatRoom) {
L_D(ChatMessage);
L_D();
d->chatRoom = chatRoom;
}
// -----------------------------------------------------------------------------
string ChatMessage::getExternalBodyUrl() const {
L_D(const ChatMessage);
L_D();
return d->externalBodyUrl;
}
void ChatMessage::setExternalBodyUrl(const string &url) {
L_D(ChatMessage);
L_D();
d->externalBodyUrl = url;
}
time_t ChatMessage::getTime () const {
L_D(const ChatMessage);
L_D();
return d->time;
}
void ChatMessage::setTime(time_t time) {
L_D(ChatMessage);
L_D();
d->time = time;
}
bool ChatMessage::isSecured () const {
L_D(const ChatMessage);
L_D();
return d->isSecured;
}
void ChatMessage::setIsSecured(bool isSecured) {
L_D(ChatMessage);
L_D();
d->isSecured = isSecured;
}
ChatMessage::Direction ChatMessage::getDirection () const {
L_D(const ChatMessage);
L_D();
return d->direction;
}
void ChatMessage::setDirection (ChatMessage::Direction dir) {
L_D(ChatMessage);
L_D();
d->direction = dir;
}
bool ChatMessage::isOutgoing () const {
L_D(const ChatMessage);
L_D();