Commit 709dceac authored by Ronan's avatar Ronan

feat(core): use `other` instead of `src`/obj name on operators and copy...

feat(core): use `other` instead of `src`/obj name on operators and copy constructors (uniform syntax)
parent cb45d54d
......@@ -68,9 +68,9 @@ Address::Address (const IdentityAddress &identityAddress) : ClonableObject(*new
d->internalAddress = sal_address_new(L_STRING_TO_C(uri));
}
Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
Address::Address (const Address &other) : ClonableObject(*new AddressPrivate) {
L_D();
SalAddress *salAddress = src.getPrivate()->internalAddress;
SalAddress *salAddress = other.getPrivate()->internalAddress;
if (salAddress)
d->internalAddress = sal_address_clone(salAddress);
}
......@@ -81,28 +81,28 @@ Address::~Address () {
sal_address_destroy(d->internalAddress);
}
Address &Address::operator= (const Address &src) {
Address &Address::operator= (const Address &other) {
L_D();
if (this != &src) {
if (this != &other) {
if (d->internalAddress)
sal_address_destroy(d->internalAddress);
SalAddress *salAddress = src.getPrivate()->internalAddress;
SalAddress *salAddress = other.getPrivate()->internalAddress;
d->internalAddress = salAddress ? sal_address_clone(salAddress) : nullptr;
}
return *this;
}
bool Address::operator== (const Address &address) const {
return asString() == address.asString();
bool Address::operator== (const Address &other) const {
return asString() == other.asString();
}
bool Address::operator!= (const Address &address) const {
return !(*this == address);
bool Address::operator!= (const Address &other) const {
return !(*this == other);
}
bool Address::operator< (const Address &address) const {
return asString() < address.asString();
bool Address::operator< (const Address &other) const {
return asString() < other.asString();
}
bool Address::isValid () const {
......
......@@ -42,15 +42,15 @@ class LINPHONE_PUBLIC Address : public ClonableObject {
public:
explicit Address (const std::string &address = "");
Address (const IdentityAddress &identityAddress);
Address (const Address &src);
Address (const Address &other);
~Address ();
Address &operator= (const Address &src);
Address &operator= (const Address &other);
bool operator== (const Address &address) const;
bool operator!= (const Address &address) const;
bool operator== (const Address &other) const;
bool operator!= (const Address &other) const;
bool operator< (const Address &address) const;
bool operator< (const Address &other) const;
bool isValid () const;
......
......@@ -53,35 +53,35 @@ IdentityAddress::IdentityAddress (const Address &address) : ClonableObject(*new
d->gruu = address.getUriParamValue("gr");
}
IdentityAddress::IdentityAddress (const IdentityAddress &src) : ClonableObject(*new IdentityAddressPrivate) {
IdentityAddress::IdentityAddress (const IdentityAddress &other) : ClonableObject(*new IdentityAddressPrivate) {
L_D();
d->scheme = src.getScheme();
d->username = src.getUsername();
d->domain = src.getDomain();
d->gruu = src.getGruu();
d->scheme = other.getScheme();
d->username = other.getUsername();
d->domain = other.getDomain();
d->gruu = other.getGruu();
}
IdentityAddress &IdentityAddress::operator= (const IdentityAddress &src) {
IdentityAddress &IdentityAddress::operator= (const IdentityAddress &other) {
L_D();
if (this != &src) {
d->scheme = src.getScheme();
d->username = src.getUsername();
d->domain = src.getDomain();
d->gruu = src.getGruu();
if (this != &other) {
d->scheme = other.getScheme();
d->username = other.getUsername();
d->domain = other.getDomain();
d->gruu = other.getGruu();
}
return *this;
}
bool IdentityAddress::operator== (const IdentityAddress &address) const {
return asString() == address.asString();
bool IdentityAddress::operator== (const IdentityAddress &other) const {
return asString() == other.asString();
}
bool IdentityAddress::operator!= (const IdentityAddress &address) const {
return !(*this == address);
bool IdentityAddress::operator!= (const IdentityAddress &other) const {
return !(*this == other);
}
bool IdentityAddress::operator< (const IdentityAddress &address) const {
return asString() < address.asString();
bool IdentityAddress::operator< (const IdentityAddress &other) const {
return asString() < other.asString();
}
bool IdentityAddress::isValid () const {
......
......@@ -33,15 +33,15 @@ class LINPHONE_PUBLIC IdentityAddress : public ClonableObject {
public:
explicit IdentityAddress (const std::string &address = "");
IdentityAddress (const Address &address);
IdentityAddress (const IdentityAddress &src);
IdentityAddress (const IdentityAddress &other);
~IdentityAddress () = default;
IdentityAddress &operator= (const IdentityAddress &src);
IdentityAddress &operator= (const IdentityAddress &other);
bool operator== (const IdentityAddress &address) const;
bool operator!= (const IdentityAddress &address) const;
bool operator== (const IdentityAddress &other) const;
bool operator!= (const IdentityAddress &other) const;
bool operator< (const IdentityAddress &address) const;
bool operator< (const IdentityAddress &other) const;
bool isValid () const;
......
......@@ -48,19 +48,19 @@ ChatRoomId::ChatRoomId (
L_USE_DEFAULT_CLONABLE_OBJECT_SHARED_IMPL(ChatRoomId);
bool ChatRoomId::operator== (const ChatRoomId &chatRoomId) const {
bool ChatRoomId::operator== (const ChatRoomId &other) const {
L_D();
const ChatRoomIdPrivate *dChatRoomId = chatRoomId.getPrivate();
const ChatRoomIdPrivate *dChatRoomId = other.getPrivate();
return d->peerAddress == dChatRoomId->peerAddress && d->localAddress == dChatRoomId->localAddress;
}
bool ChatRoomId::operator!= (const ChatRoomId &chatRoomId) const {
return !(*this == chatRoomId);
bool ChatRoomId::operator!= (const ChatRoomId &other) const {
return !(*this == other);
}
bool ChatRoomId::operator< (const ChatRoomId &chatRoomId) const {
bool ChatRoomId::operator< (const ChatRoomId &other) const {
L_D();
const ChatRoomIdPrivate *dChatRoomId = chatRoomId.getPrivate();
const ChatRoomIdPrivate *dChatRoomId = other.getPrivate();
return d->peerAddress < dChatRoomId->peerAddress
|| (d->peerAddress == dChatRoomId->peerAddress && d->localAddress < dChatRoomId->localAddress);
}
......
......@@ -32,14 +32,14 @@ class LINPHONE_PUBLIC ChatRoomId : public ClonableObject {
public:
ChatRoomId ();
ChatRoomId (const IdentityAddress &peerAddress, const IdentityAddress &localAddress);
ChatRoomId (const ChatRoomId &src);
ChatRoomId (const ChatRoomId &other);
ChatRoomId &operator= (const ChatRoomId &src);
ChatRoomId &operator= (const ChatRoomId &other);
bool operator== (const ChatRoomId &chatRoomId) const;
bool operator!= (const ChatRoomId &chatRoomId) const;
bool operator== (const ChatRoomId &other) const;
bool operator!= (const ChatRoomId &other) const;
bool operator< (const ChatRoomId &chatRoomId) const;
bool operator< (const ChatRoomId &other) const;
const IdentityAddress &getPeerAddress () const;
const IdentityAddress &getLocalAddress () const;
......
......@@ -65,10 +65,10 @@ CallSessionParams::CallSessionParams () : ClonableObject(*new CallSessionParamsP
CallSessionParams::CallSessionParams (CallSessionParamsPrivate &p) : ClonableObject(p) {}
CallSessionParams::CallSessionParams (const CallSessionParams &src)
CallSessionParams::CallSessionParams (const CallSessionParams &other)
: ClonableObject(*new CallSessionParamsPrivate) {
L_D();
d->clone(src.getPrivate());
d->clone(other.getPrivate());
}
CallSessionParams::~CallSessionParams () {
......@@ -77,10 +77,10 @@ CallSessionParams::~CallSessionParams () {
sal_custom_header_free(d->customHeaders);
}
CallSessionParams &CallSessionParams::operator= (const CallSessionParams &src) {
CallSessionParams &CallSessionParams::operator= (const CallSessionParams &other) {
L_D();
if (this != &src)
d->clone(src.getPrivate());
if (this != &other)
d->clone(other.getPrivate());
return *this;
}
......
......@@ -40,10 +40,10 @@ class CallSessionParams : public ClonableObject {
public:
CallSessionParams ();
CallSessionParams (const CallSessionParams &src);
CallSessionParams (const CallSessionParams &other);
virtual ~CallSessionParams ();
CallSessionParams &operator= (const CallSessionParams &src);
CallSessionParams &operator= (const CallSessionParams &other);
virtual void initDefault (const std::shared_ptr<Core> &core);
......
......@@ -203,11 +203,11 @@ MediaSessionParams::MediaSessionParams () : CallSessionParams(*new MediaSessionP
memset(d->customSdpMediaAttributes, 0, sizeof(d->customSdpMediaAttributes));
}
MediaSessionParams::MediaSessionParams (const MediaSessionParams &src)
MediaSessionParams::MediaSessionParams (const MediaSessionParams &other)
: CallSessionParams(*new MediaSessionParamsPrivate) {
L_D();
memset(d->customSdpMediaAttributes, 0, sizeof(d->customSdpMediaAttributes));
d->clone(src.getPrivate());
d->clone(other.getPrivate());
}
MediaSessionParams::~MediaSessionParams () {
......@@ -215,10 +215,10 @@ MediaSessionParams::~MediaSessionParams () {
d->clean();
}
MediaSessionParams &MediaSessionParams::operator= (const MediaSessionParams &src) {
MediaSessionParams &MediaSessionParams::operator= (const MediaSessionParams &other) {
L_D();
if (this != &src)
d->clone(src.getPrivate());
if (this != &other)
d->clone(other.getPrivate());
return *this;
}
......
......@@ -38,10 +38,10 @@ class MediaSessionParams : public CallSessionParams {
public:
MediaSessionParams ();
MediaSessionParams (const MediaSessionParams &src);
MediaSessionParams (const MediaSessionParams &other);
virtual ~MediaSessionParams ();
MediaSessionParams &operator= (const MediaSessionParams &src);
MediaSessionParams &operator= (const MediaSessionParams &other);
void initDefault (const std::shared_ptr<Core> &core) override;
......
......@@ -91,26 +91,26 @@ ContentType::ContentType (
setParameter(parameter);
}
ContentType::ContentType (const ContentType &src) : ContentType(src.getType(), src.getSubType(), src.getParameter()) {}
ContentType::ContentType (const ContentType &other) : ContentType(other.getType(), other.getSubType(), other.getParameter()) {}
ContentType &ContentType::operator= (const ContentType &src) {
if (this != &src) {
setType(src.getType());
setSubType(src.getSubType());
setParameter(src.getParameter());
ContentType &ContentType::operator= (const ContentType &other) {
if (this != &other) {
setType(other.getType());
setSubType(other.getSubType());
setParameter(other.getParameter());
}
return *this;
}
bool ContentType::operator== (const ContentType &contentType) const {
return getType() == contentType.getType() &&
getSubType() == contentType.getSubType() &&
getParameter() == contentType.getParameter();
bool ContentType::operator== (const ContentType &other) const {
return getType() == other.getType() &&
getSubType() == other.getSubType() &&
getParameter() == other.getParameter();
}
bool ContentType::operator!= (const ContentType &contentType) const {
return !(*this == contentType);
bool ContentType::operator!= (const ContentType &other) const {
return !(*this == other);
}
const string &ContentType::getType () const {
......
......@@ -33,17 +33,17 @@ public:
explicit ContentType (const std::string &contentType = "");
ContentType (const std::string &type, const std::string &subType);
ContentType (const std::string &type, const std::string &subType, const std::string &parameter);
ContentType (const ContentType &src);
ContentType (const ContentType &other);
ContentType &operator= (const ContentType &src);
ContentType &operator= (const ContentType &other);
bool operator== (const ContentType &contentType) const;
bool operator!= (const ContentType &contentType) const;
bool operator== (const ContentType &other) const;
bool operator!= (const ContentType &other) const;
// Delete these operators to prevent putting complicated content-type strings
// in the code. Instead define static const ContentType objects below.
bool operator== (const std::string &contentType) const = delete;
bool operator!= (const std::string &contentType) const = delete;
bool operator== (const std::string &other) const = delete;
bool operator!= (const std::string &other) const = delete;
bool isEmpty () const;
bool isValid () const;
......
......@@ -34,18 +34,18 @@ LINPHONE_BEGIN_NAMESPACE
Content::Content () : ClonableObject(*new ContentPrivate) {}
Content::Content (const Content &src) : ClonableObject(*new ContentPrivate), AppDataContainer(src) {
Content::Content (const Content &other) : ClonableObject(*new ContentPrivate), AppDataContainer(other) {
L_D();
d->body = src.getBody();
d->contentType = src.getContentType();
d->contentDisposition = src.getContentDisposition();
d->body = other.getBody();
d->contentType = other.getContentType();
d->contentDisposition = other.getContentDisposition();
}
Content::Content (Content &&src) : ClonableObject(*new ContentPrivate), AppDataContainer(move(src)) {
Content::Content (Content &&other) : ClonableObject(*new ContentPrivate), AppDataContainer(move(other)) {
L_D();
d->body = move(src.getPrivate()->body);
d->contentType = move(src.getPrivate()->contentType);
d->contentDisposition = move(src.getPrivate()->contentDisposition);
d->body = move(other.getPrivate()->body);
d->contentType = move(other.getPrivate()->contentType);
d->contentDisposition = move(other.getPrivate()->contentDisposition);
}
Content::Content (ContentPrivate &p) : ClonableObject(p) {}
......@@ -59,32 +59,32 @@ Content::~Content () {
d->body.assign(d->body.size(), 0);
}
Content &Content::operator= (const Content &src) {
Content &Content::operator= (const Content &other) {
L_D();
if (this != &src) {
d->body = src.getBody();
d->contentType = src.getContentType();
d->contentDisposition = src.getContentDisposition();
AppDataContainer::operator=(src);
if (this != &other) {
d->body = other.getBody();
d->contentType = other.getContentType();
d->contentDisposition = other.getContentDisposition();
AppDataContainer::operator=(other);
}
return *this;
}
Content &Content::operator= (Content &&src) {
Content &Content::operator= (Content &&other) {
L_D();
d->body = move(src.getPrivate()->body);
d->contentType = move(src.getPrivate()->contentType);
d->contentDisposition = move(src.getPrivate()->contentDisposition);
AppDataContainer::operator=(move(src));
d->body = move(other.getPrivate()->body);
d->contentType = move(other.getPrivate()->contentType);
d->contentDisposition = move(other.getPrivate()->contentDisposition);
AppDataContainer::operator=(move(other));
return *this;
}
bool Content::operator== (const Content &content) const {
bool Content::operator== (const Content &other) const {
L_D();
return d->contentType == content.getContentType() &&
d->body == content.getBody() &&
d->contentDisposition == content.getContentDisposition();
return d->contentType == other.getContentType() &&
d->body == other.getBody() &&
d->contentDisposition == other.getContentDisposition();
}
const ContentType &Content::getContentType () const {
......
......@@ -37,14 +37,14 @@ class ContentPrivate;
class LINPHONE_PUBLIC Content : public ClonableObject, public AppDataContainer {
public:
Content ();
Content (const Content &src);
Content (Content &&src);
Content (const Content &other);
Content (Content &&other);
~Content ();
Content &operator= (const Content &src);
Content &operator= (Content &&src);
Content &operator= (const Content &other);
Content &operator= (Content &&other);
bool operator== (const Content &content) const;
bool operator== (const Content &other) const;
const ContentType &getContentType () const;
void setContentType (const ContentType &contentType);
......
......@@ -43,52 +43,52 @@ public:
FileContent::FileContent () : Content(*new FileContentPrivate) {}
FileContent::FileContent (const FileContent &src) : Content(*new FileContentPrivate) {
FileContent::FileContent (const FileContent &other) : Content(*new FileContentPrivate) {
L_D();
d->fileName = src.getFileName();
d->filePath = src.getFilePath();
d->fileSize = src.getFileSize();
d->fileKey = src.getFileKey();
d->fileName = other.getFileName();
d->filePath = other.getFilePath();
d->fileSize = other.getFileSize();
d->fileKey = other.getFileKey();
}
FileContent::FileContent (FileContent &&src) : Content(*new FileContentPrivate) {
FileContent::FileContent (FileContent &&other) : Content(*new FileContentPrivate) {
L_D();
d->fileName = move(src.getPrivate()->fileName);
d->filePath = move(src.getPrivate()->filePath);
d->fileSize = move(src.getPrivate()->fileSize);
d->fileKey = move(src.getPrivate()->fileKey);
d->fileName = move(other.getPrivate()->fileName);
d->filePath = move(other.getPrivate()->filePath);
d->fileSize = move(other.getPrivate()->fileSize);
d->fileKey = move(other.getPrivate()->fileKey);
}
FileContent &FileContent::operator= (const FileContent &src) {
FileContent &FileContent::operator= (const FileContent &other) {
L_D();
if (this != &src) {
Content::operator=(src);
d->fileName = src.getFileName();
d->filePath = src.getFilePath();
d->fileSize = src.getFileSize();
d->fileKey = src.getFileKey();
if (this != &other) {
Content::operator=(other);
d->fileName = other.getFileName();
d->filePath = other.getFilePath();
d->fileSize = other.getFileSize();
d->fileKey = other.getFileKey();
}
return *this;
}
FileContent &FileContent::operator= (FileContent &&src) {
FileContent &FileContent::operator= (FileContent &&other) {
L_D();
Content::operator=(move(src));
d->fileName = move(src.getPrivate()->fileName);
d->filePath = move(src.getPrivate()->filePath);
d->fileSize = move(src.getPrivate()->fileSize);
d->fileKey = move(src.getPrivate()->fileKey);
Content::operator=(move(other));
d->fileName = move(other.getPrivate()->fileName);
d->filePath = move(other.getPrivate()->filePath);
d->fileSize = move(other.getPrivate()->fileSize);
d->fileKey = move(other.getPrivate()->fileKey);
return *this;
}
bool FileContent::operator== (const FileContent &content) const {
bool FileContent::operator== (const FileContent &other) const {
L_D();
return Content::operator==(content) &&
d->fileName == content.getFileName() &&
d->filePath == content.getFilePath() &&
d->fileSize == content.getFileSize() &&
d->fileKey == content.getFileKey();
return Content::operator==(other) &&
d->fileName == other.getFileName() &&
d->filePath == other.getFilePath() &&
d->fileSize == other.getFileSize() &&
d->fileKey == other.getFileKey();
}
void FileContent::setFileSize (size_t size) {
......
......@@ -31,13 +31,13 @@ class FileContentPrivate;
class LINPHONE_PUBLIC FileContent : public Content {
public:
FileContent ();
FileContent (const FileContent &src);
FileContent (FileContent &&src);
FileContent (const FileContent &other);
FileContent (FileContent &&other);
FileContent &operator= (const FileContent &src);
FileContent &operator= (FileContent &&src);
FileContent &operator= (const FileContent &other);
FileContent &operator= (FileContent &&other);
bool operator== (const FileContent &content) const;
bool operator== (const FileContent &other) const;
void setFileSize (size_t size);
size_t getFileSize () const;
......
......@@ -44,56 +44,56 @@ public:
FileTransferContent::FileTransferContent () : Content(*new FileTransferContentPrivate) {}
FileTransferContent::FileTransferContent (const FileTransferContent &src) : Content(*new FileTransferContentPrivate) {
FileTransferContent::FileTransferContent (const FileTransferContent &other) : Content(*new FileTransferContentPrivate) {
L_D();
d->fileName = src.getFileName();
d->fileUrl = src.getFileUrl();
d->filePath = src.getFilePath();
d->fileContent = src.getFileContent();
d->fileSize = src.getFileSize();
d->fileName = other.getFileName();
d->fileUrl = other.getFileUrl();
d->filePath = other.getFilePath();
d->fileContent = other.getFileContent();
d->fileSize = other.getFileSize();
}
FileTransferContent::FileTransferContent (FileTransferContent &&src) : Content(*new FileTransferContentPrivate) {
FileTransferContent::FileTransferContent (FileTransferContent &&other) : Content(*new FileTransferContentPrivate) {
L_D();
d->fileName = move(src.getPrivate()->fileName);
d->fileUrl = move(src.getPrivate()->fileUrl);
d->filePath = move(src.getPrivate()->filePath);
d->fileContent = move(src.getPrivate()->fileContent);
d->fileSize = move(src.getPrivate()->fileSize);
d->fileName = move(other.getPrivate()->fileName);
d->fileUrl = move(other.getPrivate()->fileUrl);
d->filePath = move(other.getPrivate()->filePath);
d->fileContent = move(other.getPrivate()->fileContent);
d->fileSize = move(other.getPrivate()->fileSize);
}
FileTransferContent &FileTransferContent::operator= (const FileTransferContent &src) {
FileTransferContent &FileTransferContent::operator= (const FileTransferContent &other) {
L_D();
if (this != &src) {
Content::operator=(src);
d->fileName = src.getFileName();
d->fileUrl = src.getFileUrl();
d->filePath = src.getFilePath();
d->fileContent = src.getFileContent();
d->fileSize = src.getFileSize();
if (this != &other) {
Content::operator=(other);
d->fileName = other.getFileName();
d->fileUrl = other.getFileUrl();
d->filePath = other.getFilePath();
d->fileContent = other.getFileContent();
d->fileSize = other.getFileSize();
}
return *this;
}
FileTransferContent &FileTransferContent::operator= (FileTransferContent &&src) {
FileTransferContent &FileTransferContent::operator= (FileTransferContent &&other) {
L_D();
Content::operator=(move(src));
d->fileName = move(src.getPrivate()->fileName);
d->fileUrl = move(src.getPrivate()->fileUrl);
d->filePath = move(src.getPrivate()->filePath);
d->fileContent = move(src.getPrivate()->fileContent);
d->fileSize = move(src.getPrivate()->fileSize);
Content::operator=(move(other));
d->fileName = move(other.getPrivate()->fileName);
d->fileUrl = move(other.getPrivate()->fileUrl);
d->filePath = move(other.getPrivate()->filePath);
d->fileContent = move(other.getPrivate()->fileContent);
d->fileSize = move(other.getPrivate()->fileSize);
return *this;
}
bool FileTransferContent::operator== (const FileTransferContent &content) const {
bool FileTransferContent::operator== (const FileTransferContent &other) const {
L_D();
return Content::operator==(content) &&
d->fileName == content.getFileName() &&
d->fileUrl == content.getFileUrl() &&
d->filePath == content.getFilePath() &&
d->fileSize == content.getFileSize();
return Content::operator==(other) &&
d->fileName == other.getFileName() &&
d->fileUrl == other.getFileUrl() &&
d->filePath == other.getFilePath() &&
d->fileSize == other.getFileSize();
}
void FileTransferContent::setFileName (const string &name) {
......
......@@ -32,13 +32,13 @@ class FileTransferContentPrivate;
class LINPHONE_PUBLIC FileTransferContent : public Content {
public:
FileTransferContent ();
FileTransferContent (const FileTransferContent &src);
FileTransferContent (FileTransferContent &&src);
FileTransferContent (const FileTransferContent &other);
FileTransferContent (FileTransferContent &&other);
FileTransferContent &operator= (const FileTransferContent &src);
FileTransferContent &operator= (FileTransferContent &&src);
FileTransferContent &operator= (const FileTransferContent &other);
FileTransferContent &operator= (FileTransferContent &&other);
bool operator== (const FileTransferContent &content) const;
bool operator== (const FileTransferContent &other) const;
void setFileName (const std::string &name);
const std::string &getFileName () const;
......
......@@ -37,23 +37,23 @@ MainDbKey::MainDbKey (const shared_ptr<Core> &core, long long storageId) : MainD
d->storageId = storageId;
}
MainDbKey::MainDbKey (const MainDbKey &src) : MainDbKey() {
MainDbKey::MainDbKey (const MainDbKey &other) : MainDbKey() {
L_D();
const MainDbKeyPrivate *dSrc = src.getPrivate();
const MainDbKeyPrivate *dOther = other.getPrivate();
d->core = dSrc->core;
d->storageId = dSrc->storageId;
d->core = dOther->core;
d->storageId = dOther->storageId;
}
MainDbKey::~MainDbKey () {}
MainDbKey &MainDbKey::operator= (const MainDbKey &src) {
MainDbKey &MainDbKey::operator= (const MainDbKey &other) {
L_D();
if (this != &src) {
const MainDbKeyPrivate *dSrc = src.getPrivate();
d->core = dSrc->core;
d->storageId = dSrc->storageId;
if (