diff options
author | Evgen Servetnik <e.servetnik@samsung.com> | 2017-08-11 16:32:05 +0300 |
---|---|---|
committer | Denis Dolzhenko <d.dolzhenko@samsung.com> | 2017-08-14 07:47:14 +0000 |
commit | 4d9bd7b6423bdfcaa71f7589a48696a11a10d8f8 (patch) | |
tree | efc85d126f3e7afcc138c87d9b26a8961bde0348 | |
parent | 72068bd9cde165506402530ae3b15349b5ce1bf0 (diff) | |
download | message-4d9bd7b6423bdfcaa71f7589a48696a11a10d8f8.tar.gz message-4d9bd7b6423bdfcaa71f7589a48696a11a10d8f8.tar.bz2 message-4d9bd7b6423bdfcaa71f7589a48696a11a10d8f8.zip |
TizenRefApp-9099 Refactor MsgEngine classsubmit/tizen/20170814.131616
Change-Id: I5204b2553de0aa1e988863cb6fa14867e8b4a97f
Signed-off-by: Evgen Servetnik <e.servetnik@samsung.com>
39 files changed, 339 insertions, 357 deletions
diff --git a/src/Common/MsgEngine/src/MsgEngine.cpp b/src/Common/MsgEngine/src/MsgEngine.cpp index 32f6c57..7e250e3 100644 --- a/src/Common/MsgEngine/src/MsgEngine.cpp +++ b/src/Common/MsgEngine/src/MsgEngine.cpp @@ -80,10 +80,6 @@ int MsgEngine::openService() result = messages_open_service(&m_MsgHandle); - /* if (result == MESSAGES_ERROR_NONE) - { - m_Storage.reset(new MsgStorage(m_ServiceHandle)); - }*/ #else m_Storage.reset(new MsgStorageDummy); m_Transport.reset(new MsgTransportDummy); diff --git a/src/Common/MsgEngine/src/dummy/MessageDummy.h b/src/Common/MsgEngine/src/dummy/MessageDummy.h index a2c2618..329ad18 100644 --- a/src/Common/MsgEngine/src/dummy/MessageDummy.h +++ b/src/Common/MsgEngine/src/dummy/MessageDummy.h @@ -30,28 +30,28 @@ namespace Msg { public: MessageDummy(bool release); - virtual ~MessageDummy(); + ~MessageDummy() override; - virtual MsgId getId() const; - virtual ThreadId getThreadId() const; - virtual time_t getTime() const; - virtual const MsgAddressListDummy &getAddressList() const; - virtual MsgAddressDummy &addAddress(); - virtual void addAddresses(const MsgAddressList &list); - virtual std::string getText() const; - Message::Direction getDirection() const; - virtual Type getType() const; - virtual NetworkStatus getNetworkStatus() const; + MsgId getId() const override; + ThreadId getThreadId() const override; + time_t getTime() const override; + const MsgAddressListDummy &getAddressList() const override; + MsgAddressDummy &addAddress() override; + void addAddresses(const MsgAddressList &list) override; + std::string getText() const override; + Message::Direction getDirection() const override; + Type getType() const override; + NetworkStatus getNetworkStatus() const override; - virtual int getSize() const; - virtual std::string getSubject() const; - virtual void setSubject(const std::string &text); - virtual void setMessageStorageType(Message::MessageStorageType msgStorage); - virtual Message::MessageStorageType getMessageStorageType() const; - virtual bool isMms() const; - virtual bool isRestrictedByDpm() const; - virtual bool isDraft() const; - virtual bool isSpam() const; + int getSize() const override; + std::string getSubject() const override; + void setSubject(const std::string &text) override; + void setMessageStorageType(Message::MessageStorageType msgStorage) override; + Message::MessageStorageType getMessageStorageType() const override; + bool isMms() const override; + bool isRestrictedByDpm() const override; + bool isDraft() const override; + bool isSpam() const override; void setId(MsgId id); virtual void commit(); diff --git a/src/Common/MsgEngine/src/dummy/MessageMmsDummy.h b/src/Common/MsgEngine/src/dummy/MessageMmsDummy.h index c5dac9b..34118f8 100644 --- a/src/Common/MsgEngine/src/dummy/MessageMmsDummy.h +++ b/src/Common/MsgEngine/src/dummy/MessageMmsDummy.h @@ -30,21 +30,21 @@ namespace Msg { public: MessageMmsDummy(bool release); - virtual ~MessageMmsDummy(); + ~MessageMmsDummy() override; - virtual std::string getText() const; - virtual Type getType() const; - virtual int getSize() const; + std::string getText() const override; + Type getType() const override; + int getSize() const override; - virtual const MsgPageListDummy &getPageList() const; - virtual MsgPageDummy &addPage(); + const MsgPageListDummy &getPageList() const override; + MsgPageDummy &addPage() override; - virtual const MsgAttachmentListDummy &getAttachmentList() const; - virtual MsgAttachmentDummy &addAttachment(); - virtual time_t getExpired() const; + const MsgAttachmentListDummy &getAttachmentList() const override; + MsgAttachmentDummy &addAttachment() override; + time_t getExpired() const override; - virtual void commit(); - int getMediaCount() const; + void commit() override; + int getMediaCount() const override; private: mutable MsgPageListDummy m_PageList; diff --git a/src/Common/MsgEngine/src/dummy/MessageSMSDummy.h b/src/Common/MsgEngine/src/dummy/MessageSMSDummy.h index 91e7bee..e5b1de4 100644 --- a/src/Common/MsgEngine/src/dummy/MessageSMSDummy.h +++ b/src/Common/MsgEngine/src/dummy/MessageSMSDummy.h @@ -29,11 +29,11 @@ namespace Msg { public: MessageSMSDummy(bool release); - virtual ~MessageSMSDummy(); + ~MessageSMSDummy() override; - virtual Type getType() const; - virtual void setText(const std::string &text); - virtual std::string getText() const; + Type getType() const override; + void setText(const std::string &text) override; + std::string getText() const override; }; typedef class MsgListDummy<MessageSMSDummy, MessageSMS> SmsListDummy; diff --git a/src/Common/MsgEngine/src/dummy/MsgAddressDummy.h b/src/Common/MsgEngine/src/dummy/MsgAddressDummy.h index bdad4aa..67c567b 100644 --- a/src/Common/MsgEngine/src/dummy/MsgAddressDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgAddressDummy.h @@ -30,15 +30,15 @@ namespace Msg { public: MsgAddressDummy(bool release); - virtual ~MsgAddressDummy(); + ~MsgAddressDummy() override; - virtual std::string getAddress() const; - virtual AddressType getAddressType() const; - virtual RecipientType getRecipientType() const; + std::string getAddress() const override; + AddressType getAddressType() const override; + RecipientType getRecipientType() const override; - virtual void setAddress(const std::string &address); - virtual void setAddressType(AddressType type); - virtual void setRecipientType(RecipientType type); + void setAddress(const std::string &address) override; + void setAddressType(AddressType type) override; + void setRecipientType(RecipientType type) override; void setFields(const MsgAddress &addr); }; diff --git a/src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.h b/src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.h index 2af8efa..51324f3 100644 --- a/src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.h @@ -30,14 +30,14 @@ namespace Msg { public: MsgAttachmentDummy(bool release); - virtual ~MsgAttachmentDummy(); + ~MsgAttachmentDummy() override; - virtual std::string getFilePath() const; - virtual std::string getFileName() const; - virtual int getFileSize() const; - virtual std::string getMime() const; + std::string getFilePath() const override; + std::string getFileName() const override; + int getFileSize() const override; + std::string getMime() const override; - virtual void setFilePath(const std::string &path); + void setFilePath(const std::string &path) override; void setFileName(const std::string &fileName); void setFileSize(int size) const; void setMime(const std::string &mime); diff --git a/src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp b/src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp index 036f753..03f9a08 100644 --- a/src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp +++ b/src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp @@ -33,18 +33,12 @@ MsgComposerDummy::~MsgComposerDummy() MessageSMSRef MsgComposerDummy::createSms() { - MessageSMSRef smsRef; - MessageSMSDummy *sms = new MessageSMSDummy(true); - smsRef.reset(sms); - return smsRef; + return std::make_shared<MessageSMSDummy>(true); } MessageMmsRef MsgComposerDummy::createMms() { - MessageMmsRef mmsRef; - MessageMmsDummy *mms = new MessageMmsDummy(true); - mmsRef.reset(mms); - return mmsRef; + return std::make_shared<MessageMmsDummy>(true); } void MsgComposerDummy::calculateTextMetric(const std::string &text, MsgTextMetric &textMetric) diff --git a/src/Common/MsgEngine/src/dummy/MsgComposerDummy.h b/src/Common/MsgEngine/src/dummy/MsgComposerDummy.h index 943b267..0c9e954 100644 --- a/src/Common/MsgEngine/src/dummy/MsgComposerDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgComposerDummy.h @@ -28,7 +28,7 @@ namespace Msg MsgComposerDummy(); MsgComposerDummy(MsgComposerDummy&) = delete; MsgComposerDummy &operator=(MsgComposerDummy&) = delete; - virtual ~MsgComposerDummy(); + ~MsgComposerDummy() override; MessageSMSRef createSms() override; MessageMmsRef createMms() override; diff --git a/src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.h b/src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.h index c5bf082..91c8682 100644 --- a/src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.h @@ -30,15 +30,15 @@ namespace Msg { public: MsgConvMediaDummy(bool release); - virtual ~MsgConvMediaDummy(); + ~MsgConvMediaDummy() override; static int getNumberOfItems(); - virtual std::string getMime() const; - virtual std::string getName() const; - virtual std::string getPath() const; - virtual std::string getThumbPath() const; - virtual std::string getContentId() const; - virtual std::string getContentLocation() const; + std::string getMime() const override; + std::string getName() const override; + std::string getPath() const override; + std::string getThumbPath() const override; + std::string getContentId() const override; + std::string getContentLocation() const override; private: mutable int m_Number; diff --git a/src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.h b/src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.h index b5cbdb6..883aa9d 100644 --- a/src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.h @@ -32,23 +32,23 @@ namespace Msg { public: MsgConversationItemDummy(bool release); - virtual ~MsgConversationItemDummy(); + ~MsgConversationItemDummy() override; - virtual MsgId getMsgId() const; - virtual ThreadId getThreadId() const; - virtual std::string getText() const; - virtual std::string getSubject() const; - virtual time_t getTime() const; - virtual Message::Direction getDirection() const; - virtual Message::Type getType() const; - virtual Message::NetworkStatus getNetworkStatus() const; - virtual bool isDraft() const; - virtual bool isSpam() const; - virtual bool isRead() const; - virtual int getPagesCount() const; - virtual int getAttachCount() const; - virtual const MsgConvMediaListDummy &getMediaList() const; - virtual bool isRestrictedByDpm() const; + MsgId getMsgId() const override; + ThreadId getThreadId() const override; + std::string getText() const override; + std::string getSubject() const override; + time_t getTime() const override; + Message::Direction getDirection() const override; + Message::Type getType() const override; + Message::NetworkStatus getNetworkStatus() const override; + bool isDraft() const override; + bool isSpam() const override; + bool isRead() const override; + int getPagesCount() const override; + int getAttachCount() const override; + const MsgConvMediaListDummy &getMediaList() const override; + bool isRestrictedByDpm() const override; protected: mutable MsgConvMediaListDummy m_MultipartList; diff --git a/src/Common/MsgEngine/src/dummy/MsgListDummy.h b/src/Common/MsgEngine/src/dummy/MsgListDummy.h index 74dfbda..96e4c6a 100644 --- a/src/Common/MsgEngine/src/dummy/MsgListDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgListDummy.h @@ -38,21 +38,21 @@ namespace Msg { } - virtual ~MsgListDummy() + ~MsgListDummy() override { } - virtual BaseT &at(int i) + BaseT &at(int i) override { return m_Object; } - virtual const BaseT &at(int i) const + const BaseT &at(int i) const override { return m_Object; } - virtual int getLength() const + int getLength() const override { return m_Length; } diff --git a/src/Common/MsgEngine/src/dummy/MsgMediaDummy.h b/src/Common/MsgEngine/src/dummy/MsgMediaDummy.h index 8d749b9..f6db013 100644 --- a/src/Common/MsgEngine/src/dummy/MsgMediaDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgMediaDummy.h @@ -30,12 +30,12 @@ namespace Msg { public: MsgMediaDummy(bool release); - virtual ~MsgMediaDummy(); + ~MsgMediaDummy() override; - virtual Type getType() const; - virtual std::string getFilePath() const; - virtual std::string getFileName() const; - virtual void setFilePath(const std::string &path); + Type getType() const override; + std::string getFilePath() const override; + std::string getFileName() const override; + void setFilePath(const std::string &path) override; std::string getMime() const; void setFileName(const std::string &name); diff --git a/src/Common/MsgEngine/src/dummy/MsgPageDummy.h b/src/Common/MsgEngine/src/dummy/MsgPageDummy.h index c409175..5b3a34d 100644 --- a/src/Common/MsgEngine/src/dummy/MsgPageDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgPageDummy.h @@ -28,12 +28,12 @@ namespace Msg { public: MsgPageDummy(bool release); - virtual ~MsgPageDummy(); + ~MsgPageDummy() override; - virtual MsgMediaListDummy &getMediaList(); - virtual MsgMediaDummy &addMedia(); - virtual void setPageDuration(int duration); - virtual int getPageDuration() const; + MsgMediaListDummy &getMediaList() override; + MsgMediaDummy &addMedia() override; + void setPageDuration(int duration) override; + int getPageDuration() const override; private: MsgMediaListDummy m_MediaList; diff --git a/src/Common/MsgEngine/src/dummy/MsgReportDummy.h b/src/Common/MsgEngine/src/dummy/MsgReportDummy.h index 3a31cdc..308ba8d 100644 --- a/src/Common/MsgEngine/src/dummy/MsgReportDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgReportDummy.h @@ -30,13 +30,13 @@ namespace Msg { public: MsgReportDummy(bool release); - virtual ~MsgReportDummy(); + ~MsgReportDummy() override; - virtual std::string getAddress() const; - virtual DeliveryStatus getDeliveryStatus() const; - virtual ReadStatus getReadStatus() const; - virtual Type getType() const; - virtual time_t getTime() const; + std::string getAddress() const override; + DeliveryStatus getDeliveryStatus() const override; + ReadStatus getReadStatus() const override; + Type getType() const override; + time_t getTime() const override; }; typedef class MsgListDummy<MsgReportDummy, MsgReport> MsgReportListDummy; diff --git a/src/Common/MsgEngine/src/dummy/MsgSettingsDummy.h b/src/Common/MsgEngine/src/dummy/MsgSettingsDummy.h index c04dc45..b3451d1 100644 --- a/src/Common/MsgEngine/src/dummy/MsgSettingsDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgSettingsDummy.h @@ -30,45 +30,45 @@ namespace Msg MsgSettingsDummy(); MsgSettingsDummy(MsgSettingsDummy&) = delete; MsgSettingsDummy &operator=(MsgSettingsDummy&) = delete; - virtual ~MsgSettingsDummy(); + ~MsgSettingsDummy() override; - virtual int getAddressMaxLen() const; - virtual int getPhoneNumberMaxLen() const; - virtual int getAddressMaxCount() const; - virtual int getSubjectMaxLen() const; - virtual int getDisplayNameMaxLen() const; - virtual int getMaxRecipientCount() const; - virtual int getMaxMmsSize() const; - virtual int getMaxMsgTextLen() const; + int getAddressMaxLen() const override; + int getPhoneNumberMaxLen() const override; + int getAddressMaxCount() const override; + int getSubjectMaxLen() const override; + int getDisplayNameMaxLen() const override; + int getMaxRecipientCount() const override; + int getMaxMmsSize() const override; + int getMaxMsgTextLen() const override; - virtual void setAlerts(bool value); - virtual bool getAlerts() const; + void setAlerts(bool value) override; + bool getAlerts() const override; - virtual void setRingtoneType(RingtoneType type); - virtual RingtoneType getRingtoneType() const; - virtual void setRingtone(const std::string &soundPath); - virtual std::string getRingtone() const; + void setRingtoneType(RingtoneType type) override; + RingtoneType getRingtoneType() const override; + void setRingtone(const std::string &soundPath) override; + std::string getRingtone() const override; - virtual void setVibration(bool value); - virtual bool getVibration() const; + void setVibration(bool value) override; + bool getVibration() const override; - virtual void setSmsDelivReport(bool value); - virtual bool getSmsDelivReport() const; + void setSmsDelivReport(bool value) override; + bool getSmsDelivReport() const override; - virtual void setMmsDelivReport(bool value); - virtual bool getMmsDelivReport() const ; + void setMmsDelivReport(bool value) override; + bool getMmsDelivReport() const override; - virtual void setMmsReadReport(bool value); - virtual bool getMmsReadReport() const; + void setMmsReadReport(bool value) override; + bool getMmsReadReport() const override; - virtual void setMmsAutoRetr(bool value); - virtual bool getMmsAutoRetr() const; + void setMmsAutoRetr(bool value) override; + bool getMmsAutoRetr() const override; - virtual void setMmsAutoRetrRoaming(bool value); - virtual bool getMmsAutoRetrRoaming() const; + void setMmsAutoRetrRoaming(bool value) override; + bool getMmsAutoRetrRoaming() const override; - virtual void setActiveNotifPolicy(ActiveNotifPolicy type); - virtual void setActiveNotifPolicy(ThreadId id); + void setActiveNotifPolicy(ActiveNotifPolicy type) override; + void setActiveNotifPolicy(ThreadId id) override; }; } diff --git a/src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp b/src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp index 91a6cc2..2f003a8 100644 --- a/src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp +++ b/src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp @@ -44,21 +44,21 @@ MsgStorageDummy::~MsgStorageDummy() MsgThreadListRef MsgStorageDummy::getThreadList() { MsgThreadListRef res; - res.reset(new MsgThreadListDummy); + res = std::make_shared<MsgThreadListDummy>(); return res; } MessageSMSListRef MsgStorageDummy::getSimMsgList() { MessageSMSListRef res; - res.reset(new SmsListDummy); + res = std::make_shared<SmsListDummy>(); return res; } MessageListRef MsgStorageDummy::getBlockMsgList() { MessageListRef res; - res.reset(new MessageListDummy); + res = std::make_shared<MessageListDummy>(); return res; } @@ -74,8 +74,7 @@ ThreadId MsgStorageDummy::getThreadId(const std::list<std::string> &addressList) MsgAddressListRef MsgStorageDummy::getAddressList(ThreadId id) { - MsgAddressListDummy *result = new MsgAddressListDummy; - return MsgAddressListRef(result); + return std::make_shared<MsgAddressListDummy>(); } MsgThreadListRef MsgStorageDummy::searchThread(const std::string &word) @@ -91,7 +90,7 @@ int MsgStorageDummy::getUnreadThreadCount() const MsgThreadItemRef MsgStorageDummy::getThread(ThreadId id) { MsgThreadItemRef res; - res.reset(new MsgThreadItemDummy(true)); + res = std::make_shared<MsgThreadItemDummy>(true); return res; } @@ -108,21 +107,21 @@ bool MsgStorageDummy::moveMsgToInBox(MsgId id) MsgConversationListRef MsgStorageDummy::getConversationList(ThreadId id) { MsgConversationListRef res; - res.reset(new MsgConversationListDummy); + res = std::make_shared<MsgConversationListDummy>(); return res; } MsgConversationItemRef MsgStorageDummy::getConversationItem(MsgId id) { MsgConversationItemRef res; - res.reset(new MsgConversationItemDummy(true)); + res = std::make_shared<MsgConversationItemDummy>(true); return res; } MessageRef MsgStorageDummy::getMessage(MsgId id) { MessageRef res; - res.reset(new MessageSMSDummy(true)); + res = std::make_shared<MessageSMSDummy>(true); return res; } @@ -161,8 +160,7 @@ void MsgStorageDummy::setReadStatus(MsgId id, bool status) MsgReportListRef MsgStorageDummy::getMsgReportList(MsgId msgId) { - MsgReportListDummy *result = new MsgReportListDummy; - return MsgReportListRef(result); + return std::make_shared<MsgReportListDummy>(); } bool MsgStorageDummy::isReadReportChecked(MsgId msgId) diff --git a/src/Common/MsgEngine/src/dummy/MsgStorageDummy.h b/src/Common/MsgEngine/src/dummy/MsgStorageDummy.h index 30271bb..c7410c9 100644 --- a/src/Common/MsgEngine/src/dummy/MsgStorageDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgStorageDummy.h @@ -29,25 +29,25 @@ namespace Msg MsgStorageDummy(); MsgStorageDummy(MsgStorageDummy&) = delete; MsgStorageDummy &operator=(MsgStorageDummy&) = delete; - virtual ~MsgStorageDummy(); + ~MsgStorageDummy() override; // Thread: - virtual MsgThreadListRef getThreadList(); - virtual MsgThreadItemRef getThread(ThreadId id); - virtual ThreadId getThreadId(const MsgAddressList &addressList); - virtual ThreadId getThreadId(const std::list<std::string> &addressList); - virtual ThreadId getThreadId(MsgId id); - virtual bool deleteThread(ThreadId id); - virtual MsgAddressListRef getAddressList(ThreadId id); - virtual MsgThreadListRef searchThread(const std::string &word); - virtual void setReadStatus(ThreadId id); - virtual int getUnreadThreadCount() const; + MsgThreadListRef getThreadList() override; + MsgThreadItemRef getThread(ThreadId id) override; + ThreadId getThreadId(const MsgAddressList &addressList) override; + ThreadId getThreadId(const std::list<std::string> &addressList) override; + ThreadId getThreadId(MsgId id) override; + bool deleteThread(ThreadId id) override; + MsgAddressListRef getAddressList(ThreadId id) override; + MsgThreadListRef searchThread(const std::string &word) override; + void setReadStatus(ThreadId id) override; + int getUnreadThreadCount() const override; // Message: - virtual MessageListRef getBlockMsgList(); - virtual MessageSMSListRef getSimMsgList(); - virtual MessageRef getMessage(MsgId id); - virtual bool moveMsgToInBox(MsgId id); + MessageListRef getBlockMsgList() override; + MessageSMSListRef getSimMsgList() override; + MessageRef getMessage(MsgId id) override; + bool moveMsgToInBox(MsgId id) override; /** *@brief Return id of new message or of updated message @@ -57,18 +57,18 @@ namespace Msg *@param[out] result of storage operation. *@return MessageId */ - virtual MsgId saveMessage(Message &msg, bool updateExisting, StorageResult *result); - virtual bool deleteMessage(MsgId id); - virtual bool deleteMessages(const MsgIdList &idList); - virtual MessageListRef searchMessage(const std::string &word); - virtual void setReadStatus(MsgId id, bool status); - virtual MsgReportListRef getMsgReportList(MsgId msgId); - virtual bool isReadReportChecked(MsgId msgId); - virtual bool isDeliverReportChecked(MsgId msgId); + MsgId saveMessage(Message &msg, bool updateExisting, StorageResult *result) override; + bool deleteMessage(MsgId id) override; + bool deleteMessages(const MsgIdList &idList) override; + MessageListRef searchMessage(const std::string &word) override; + void setReadStatus(MsgId id, bool status) override; + MsgReportListRef getMsgReportList(MsgId msgId) override; + bool isReadReportChecked(MsgId msgId) override; + bool isDeliverReportChecked(MsgId msgId) override; // Conversation: - virtual MsgConversationListRef getConversationList(ThreadId id); - virtual MsgConversationItemRef getConversationItem(MsgId id); + MsgConversationListRef getConversationList(ThreadId id) override; + MsgConversationItemRef getConversationItem(MsgId id) override; private: template <typename T> diff --git a/src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.h b/src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.h index a49b554..269b291 100644 --- a/src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.h @@ -30,16 +30,16 @@ namespace Msg { public: MsgThreadItemDummy(bool release); - virtual ~MsgThreadItemDummy(); + ~MsgThreadItemDummy() override; - virtual ThreadId getId() const; - virtual std::string getName() const; - virtual std::string getLastMessage() const; - virtual time_t getTime() const; - virtual bool hasDraftMessage() const; - virtual bool hasFailedMessage() const; - virtual bool isSending() const; - virtual int getUnreadCount() const; + ThreadId getId() const override; + std::string getName() const override; + std::string getLastMessage() const override; + time_t getTime() const override; + bool hasDraftMessage() const override; + bool hasFailedMessage() const override; + bool isSending() const override; + int getUnreadCount() const override; }; typedef class MsgListDummy<MsgThreadItemDummy, MsgThreadItem> MsgThreadListDummy; diff --git a/src/Common/MsgEngine/src/dummy/MsgTransportDummy.h b/src/Common/MsgEngine/src/dummy/MsgTransportDummy.h index a3ac638..58779e0 100644 --- a/src/Common/MsgEngine/src/dummy/MsgTransportDummy.h +++ b/src/Common/MsgEngine/src/dummy/MsgTransportDummy.h @@ -29,7 +29,7 @@ namespace Msg { public: MsgTransportDummy(); - virtual ~MsgTransportDummy(); + ~MsgTransportDummy() override; SendResult sendMessage(Message &msg, ThreadId *threadId, RequestId *requestId) override; SendResult retrieveMessage(MsgId msgId, RequestId *requestId) override; diff --git a/src/Common/MsgEngine/src/private/MessageMmsPrivate.h b/src/Common/MsgEngine/src/private/MessageMmsPrivate.h index 9cac9dd..f2c1b16 100644 --- a/src/Common/MsgEngine/src/private/MessageMmsPrivate.h +++ b/src/Common/MsgEngine/src/private/MessageMmsPrivate.h @@ -28,21 +28,21 @@ namespace Msg { , public MessageMms { public: MessageMmsPrivate(bool release, msg_struct_t msgStruct = nullptr, msg_struct_t mmsStruct = nullptr); - virtual ~MessageMmsPrivate(); + ~MessageMmsPrivate() override; - virtual std::string getText() const; - virtual Type getType() const; - virtual int getSize() const; + std::string getText() const override; + Type getType() const override; + int getSize() const override; - virtual const MsgPageListHandlePrivate &getPageList() const; - virtual MsgPagePrivate &addPage(); + const MsgPageListHandlePrivate &getPageList() const override; + MsgPagePrivate &addPage() override; - virtual const MsgAttachmentListHandlePrivate &getAttachmentList() const; - virtual MsgAttachmentPrivate &addAttachment(); - virtual time_t getExpired() const; + const MsgAttachmentListHandlePrivate &getAttachmentList() const override; + MsgAttachmentPrivate &addAttachment() override; + time_t getExpired() const override; - virtual void commit(); - int getMediaCount() const; + void commit() override; + int getMediaCount() const override; void set(msg_struct_t msgStruct); msg_struct_t getMmsStruct() const; diff --git a/src/Common/MsgEngine/src/private/MessagePrivate.h b/src/Common/MsgEngine/src/private/MessagePrivate.h index dfbcf1f..054b798 100644 --- a/src/Common/MsgEngine/src/private/MessagePrivate.h +++ b/src/Common/MsgEngine/src/private/MessagePrivate.h @@ -29,28 +29,28 @@ namespace Msg { , public MsgStructPrivate { public: MessagePrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MessagePrivate(); + ~MessagePrivate() override; - virtual MsgId getId() const; - virtual ThreadId getThreadId() const; - virtual time_t getTime() const; - virtual const MsgAddressListHandlePrivate &getAddressList() const; - virtual MsgAddressPrivate &addAddress(); - virtual void addAddresses(const MsgAddressList &list); - virtual std::string getText() const; - Message::Direction getDirection() const; - virtual Type getType() const; - virtual NetworkStatus getNetworkStatus() const; + MsgId getId() const override; + ThreadId getThreadId() const override; + time_t getTime() const override; + const MsgAddressListHandlePrivate &getAddressList() const override; + MsgAddressPrivate &addAddress() override; + void addAddresses(const MsgAddressList &list) override; + std::string getText() const override; + Message::Direction getDirection() const override; + Type getType() const override; + NetworkStatus getNetworkStatus() const override; - virtual int getSize() const; - virtual std::string getSubject() const; - virtual void setSubject(const std::string &text); - virtual void setMessageStorageType(Message::MessageStorageType msgStorage); - virtual Message::MessageStorageType getMessageStorageType() const; - virtual bool isMms() const; - virtual bool isRestrictedByDpm() const; - virtual bool isDraft() const; - virtual bool isSpam() const; + int getSize() const override; + std::string getSubject() const override; + void setSubject(const std::string &text) override; + void setMessageStorageType(Message::MessageStorageType msgStorage) override; + Message::MessageStorageType getMessageStorageType() const override; + bool isMms() const override; + bool isRestrictedByDpm() const override; + bool isDraft() const override; + bool isSpam() const override; void setId(MsgId id); void set(msg_struct_t msgStruct); diff --git a/src/Common/MsgEngine/src/private/MessageSMSPrivate.h b/src/Common/MsgEngine/src/private/MessageSMSPrivate.h index c9d3b90..cdbf55a 100644 --- a/src/Common/MsgEngine/src/private/MessageSMSPrivate.h +++ b/src/Common/MsgEngine/src/private/MessageSMSPrivate.h @@ -28,11 +28,11 @@ namespace Msg { , public MessageSMS { public: MessageSMSPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MessageSMSPrivate(); + ~MessageSMSPrivate() override; - virtual Type getType() const; - virtual void setText(const std::string &text); - virtual std::string getText() const; + Type getType() const override; + void setText(const std::string &text) override; + std::string getText() const override; }; typedef class MsgListHandlePrivate<MessageSMSPrivate, MessageSMS> SmsListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgAddressPrivate.h b/src/Common/MsgEngine/src/private/MsgAddressPrivate.h index f269ece..01e5c5c 100644 --- a/src/Common/MsgEngine/src/private/MsgAddressPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgAddressPrivate.h @@ -28,15 +28,15 @@ namespace Msg { , public MsgAddress { public: MsgAddressPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgAddressPrivate(); + ~MsgAddressPrivate() override; - virtual std::string getAddress() const; - virtual AddressType getAddressType() const; - virtual RecipientType getRecipientType() const; + std::string getAddress() const override; + AddressType getAddressType() const override; + RecipientType getRecipientType() const override; - virtual void setAddress(const std::string &address); - virtual void setAddressType(AddressType type); - virtual void setRecipientType(RecipientType type); + void setAddress(const std::string &address) override; + void setAddressType(AddressType type) override; + void setRecipientType(RecipientType type) override; void setFields(const MsgAddress &addr); }; diff --git a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h index 507d0b8..5c9b3f2 100644 --- a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h @@ -28,14 +28,14 @@ namespace Msg { , public MsgAttachment { public: MsgAttachmentPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgAttachmentPrivate(); + ~MsgAttachmentPrivate() override; - virtual std::string getFilePath() const; - virtual std::string getFileName() const; - virtual int getFileSize() const; - virtual std::string getMime() const; + std::string getFilePath() const override; + std::string getFileName() const override; + int getFileSize() const override; + std::string getMime() const override; - virtual void setFilePath(const std::string &path); + void setFilePath(const std::string &path) override; void setFileName(const std::string &fileName); void setFileSize(int size) const; void setMime(const std::string &mime); diff --git a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp index f563a52..4924591 100644 --- a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp @@ -44,9 +44,7 @@ MessageSMSRef MsgComposerPrivate::createSms() msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); if (msgInfo) { msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS); - - MessageSMSPrivate *sms = new MessageSMSPrivate(true, msgInfo); - smsRef.reset(sms); + smsRef = std::make_shared<MessageSMSPrivate>(true, msgInfo); } return smsRef; } @@ -61,8 +59,7 @@ MessageMmsRef MsgComposerPrivate::createMms() setSmilHeader(mmsStruct, false); // BodyView support only Image after Text layout order isTextTop = false - MessageMmsPrivate *mms = new MessageMmsPrivate(true, msgInfo, mmsStruct); - mmsRef.reset(mms); + mmsRef = std::make_shared<MessageMmsPrivate>(true, msgInfo, mmsStruct); } return mmsRef; } diff --git a/src/Common/MsgEngine/src/private/MsgComposerPrivate.h b/src/Common/MsgEngine/src/private/MsgComposerPrivate.h index b0449ce..3cd5f05 100644 --- a/src/Common/MsgEngine/src/private/MsgComposerPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgComposerPrivate.h @@ -28,7 +28,7 @@ namespace Msg { MsgComposerPrivate(MsgEngine &msgEngine); MsgComposerPrivate(MsgComposerPrivate&) = delete; MsgComposerPrivate &operator=(MsgComposerPrivate&) = delete; - virtual ~MsgComposerPrivate(); + ~MsgComposerPrivate() override; MessageSMSRef createSms() override; MessageMmsRef createMms() override; diff --git a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h index 3f7eb44..566f4c1 100644 --- a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h @@ -27,14 +27,14 @@ namespace Msg { , public MsgConvMedia { public: MsgConvMediaPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgConvMediaPrivate(); + ~MsgConvMediaPrivate() override; - virtual std::string getMime() const; - virtual std::string getName() const; - virtual std::string getPath() const; - virtual std::string getThumbPath() const; - virtual std::string getContentId() const; - virtual std::string getContentLocation() const; + std::string getMime() const override; + std::string getName() const override; + std::string getPath() const override; + std::string getThumbPath() const override; + std::string getContentId() const override; + std::string getContentLocation() const override; }; typedef class MsgListHandlePrivate<MsgConvMediaPrivate, MsgConvMedia> MsgConvMediaListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h index a485980..242bc90 100644 --- a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h @@ -32,23 +32,23 @@ namespace Msg { , public MsgConversationItem { public: MsgConversationItemPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgConversationItemPrivate(); + ~MsgConversationItemPrivate() override; - virtual MsgId getMsgId() const; - virtual ThreadId getThreadId() const; - virtual std::string getText() const; - virtual std::string getSubject() const; - virtual time_t getTime() const; - virtual Message::Direction getDirection() const; - virtual Message::Type getType() const; - virtual Message::NetworkStatus getNetworkStatus() const; - virtual bool isDraft() const; - virtual bool isSpam() const; - virtual bool isRead() const; - virtual int getPagesCount() const; - virtual int getAttachCount() const; - virtual const MsgConvMediaListHandlePrivate &getMediaList() const; - virtual bool isRestrictedByDpm() const; + MsgId getMsgId() const override; + ThreadId getThreadId() const override; + std::string getText() const override; + std::string getSubject() const override; + time_t getTime() const override; + Message::Direction getDirection() const override; + Message::Type getType() const override; + Message::NetworkStatus getNetworkStatus() const override; + bool isDraft() const override; + bool isSpam() const override; + bool isRead() const override; + int getPagesCount() const override; + int getAttachCount() const override; + const MsgConvMediaListHandlePrivate &getMediaList() const override; + bool isRestrictedByDpm() const override; protected: mutable MsgConvMediaListHandlePrivate m_MultipartList; diff --git a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h index 8c8bd22..050a7bd 100644 --- a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h @@ -34,27 +34,27 @@ namespace Msg { { } - virtual ~MsgListHandlePrivate() + ~MsgListHandlePrivate() override { if (m_Release && m_List) msg_list_free(m_List); } - virtual BaseT &at(int i) + BaseT &at(int i) override { msg_struct_t msgStruct = msg_list_nth_data(m_List, i); m_Object.set(msgStruct); return m_Object; } - virtual const BaseT &at(int i) const + const BaseT &at(int i) const override { msg_struct_t msgStruct = msg_list_nth_data(m_List, i); m_Object.set(msgStruct); return m_Object; } - virtual int getLength() const + int getLength() const override { return msg_list_length(m_List); } diff --git a/src/Common/MsgEngine/src/private/MsgMediaPrivate.h b/src/Common/MsgEngine/src/private/MsgMediaPrivate.h index 5c36a87..ed250f1 100644 --- a/src/Common/MsgEngine/src/private/MsgMediaPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgMediaPrivate.h @@ -28,12 +28,12 @@ namespace Msg { , public MsgMedia { public: MsgMediaPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgMediaPrivate(); + ~MsgMediaPrivate() override; - virtual Type getType() const; - virtual std::string getFilePath() const; - virtual std::string getFileName() const; - virtual void setFilePath(const std::string &path); + Type getType() const override; + std::string getFilePath() const override; + std::string getFileName() const override; + void setFilePath(const std::string &path) override; std::string getMime() const; void setFileName(const std::string &name); diff --git a/src/Common/MsgEngine/src/private/MsgPagePrivate.h b/src/Common/MsgEngine/src/private/MsgPagePrivate.h index 3a6be19..dd746f0 100644 --- a/src/Common/MsgEngine/src/private/MsgPagePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgPagePrivate.h @@ -26,12 +26,12 @@ namespace Msg { , public MsgPage { public: MsgPagePrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgPagePrivate(); + ~MsgPagePrivate() override; - virtual MsgMediaListHandlePrivate &getMediaList(); - virtual MsgMediaPrivate &addMedia(); - virtual void setPageDuration(int duration); - virtual int getPageDuration() const; + MsgMediaListHandlePrivate &getMediaList() override; + MsgMediaPrivate &addMedia() override; + void setPageDuration(int duration) override; + int getPageDuration() const override; private: MsgMediaListHandlePrivate m_MediaList; diff --git a/src/Common/MsgEngine/src/private/MsgReportPrivate.h b/src/Common/MsgEngine/src/private/MsgReportPrivate.h index 8974191..88ce054 100644 --- a/src/Common/MsgEngine/src/private/MsgReportPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgReportPrivate.h @@ -28,13 +28,13 @@ namespace Msg { , public MsgReport { public: MsgReportPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgReportPrivate(); + ~MsgReportPrivate() override; - virtual std::string getAddress() const; - virtual DeliveryStatus getDeliveryStatus() const; - virtual ReadStatus getReadStatus() const; - virtual Type getType() const; - virtual time_t getTime() const; + std::string getAddress() const override; + DeliveryStatus getDeliveryStatus() const override; + ReadStatus getReadStatus() const override; + Type getType() const override; + time_t getTime() const override; }; typedef class MsgListHandlePrivate<MsgReportPrivate, MsgReport> MsgReportListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgSentStatusPrivate.h b/src/Common/MsgEngine/src/private/MsgSentStatusPrivate.h index 4fed6b5..c13e774 100644 --- a/src/Common/MsgEngine/src/private/MsgSentStatusPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgSentStatusPrivate.h @@ -27,7 +27,7 @@ namespace Msg { public: MsgSentStatusPrivate(msg_struct_t msgStruct); - virtual ~MsgSentStatusPrivate(); + ~MsgSentStatusPrivate() override; RequestId getId() const override; Message::NetworkStatus getNetworkStatus() const override; diff --git a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h index 1331427..b973c75 100644 --- a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h @@ -29,45 +29,45 @@ namespace Msg { MsgSettingsPrivate(msg_handle_t serviceHandle); MsgSettingsPrivate(MsgSettingsPrivate&) = delete; MsgSettingsPrivate &operator=(MsgSettingsPrivate&) = delete; - virtual ~MsgSettingsPrivate(); + ~MsgSettingsPrivate() override; - virtual int getAddressMaxLen() const; - virtual int getPhoneNumberMaxLen() const; - virtual int getAddressMaxCount() const; - virtual int getSubjectMaxLen() const; - virtual int getDisplayNameMaxLen() const; - virtual int getMaxRecipientCount() const; - virtual int getMaxMmsSize() const; - virtual int getMaxMsgTextLen() const; + int getAddressMaxLen() const override; + int getPhoneNumberMaxLen() const override; + int getAddressMaxCount() const override; + int getSubjectMaxLen() const override; + int getDisplayNameMaxLen() const override; + int getMaxRecipientCount() const override; + int getMaxMmsSize() const override; + int getMaxMsgTextLen() const override; - virtual void setAlerts(bool value); - virtual bool getAlerts() const; + void setAlerts(bool value) override; + bool getAlerts() const override; - virtual void setRingtoneType(RingtoneType type); - virtual RingtoneType getRingtoneType() const; - virtual void setRingtone(const std::string &soundPath); - virtual std::string getRingtone() const; + void setRingtoneType(RingtoneType type) override; + RingtoneType getRingtoneType() const override; + void setRingtone(const std::string &soundPath) override; + std::string getRingtone() const override; - virtual void setVibration(bool value); - virtual bool getVibration() const; + void setVibration(bool value) override; + bool getVibration() const override; - virtual void setSmsDelivReport(bool value); - virtual bool getSmsDelivReport() const; + void setSmsDelivReport(bool value) override; + bool getSmsDelivReport() const override; - virtual void setMmsDelivReport(bool value); - virtual bool getMmsDelivReport() const ; + void setMmsDelivReport(bool value) override; + bool getMmsDelivReport() const override; - virtual void setMmsReadReport(bool value); - virtual bool getMmsReadReport() const; + void setMmsReadReport(bool value) override; + bool getMmsReadReport() const override; - virtual void setMmsAutoRetr(bool value); - virtual bool getMmsAutoRetr() const; + void setMmsAutoRetr(bool value) override; + bool getMmsAutoRetr() const override; - virtual void setMmsAutoRetrRoaming(bool value); - virtual bool getMmsAutoRetrRoaming() const; + void setMmsAutoRetrRoaming(bool value) override; + bool getMmsAutoRetrRoaming() const override; - virtual void setActiveNotifPolicy(ActiveNotifPolicy type); - virtual void setActiveNotifPolicy(ThreadId id); + void setActiveNotifPolicy(ActiveNotifPolicy type) override; + void setActiveNotifPolicy(ThreadId id) override; private: void init(); diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp index b286734..982b4bf 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp @@ -112,7 +112,7 @@ MsgThreadListRef MsgStoragePrivate::getThreadList() msg_release_struct(&sortRule); if (error == 0) - res.reset(new MsgThreadStructListPrivate(true, msgList)); + res = std::make_shared<MsgThreadStructListPrivate>(true, msgList); return res; } @@ -129,8 +129,7 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList() msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM); if (msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) - res.reset(new SmsStructListPrivate(true, msgList)); - + res = std::make_shared<SmsStructListPrivate>(true, msgList); msg_release_struct(&listCond); return res; } @@ -143,7 +142,7 @@ MessageListRef MsgStoragePrivate::getBlockMsgList() msg_struct_t listCond = msg_create_struct(MSG_STRUCT_MSG_LIST_CONDITION); msg_set_int_value(listCond, MSG_LIST_CONDITION_FOLDER_ID_INT, MSG_SPAMBOX_ID); if (msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) - res.reset(new MessageStructListPrivate(true, msgList)); + res = std::make_shared<MessageStructListPrivate>(true, msgList); msg_release_struct(&listCond); return res; @@ -212,7 +211,8 @@ MsgThreadListRef MsgStoragePrivate::searchThread(const std::string &word) } if (error == 0) - res.reset(new MsgThreadStructListPrivate(true, searchList)); + res = std::make_shared<MsgThreadStructListPrivate>(true, searchList); + return res; } @@ -246,8 +246,7 @@ MsgThreadItemRef MsgStoragePrivate::getThread(ThreadId id) MsgThreadItemRef res; msg_struct_t thread = msg_create_struct(MSG_STRUCT_THREAD_INFO); if (msg_get_thread(m_ServiceHandle, id, thread) == 0) - res.reset(new MsgThreadItemPrivate(true, thread)); - + res = std::make_shared<MsgThreadItemPrivate>(true, thread); return res; } @@ -263,8 +262,7 @@ MsgConversationListRef MsgStoragePrivate::getConversationList(ThreadId id) int error = msg_get_conversation_view_list(m_ServiceHandle, id, &convList); if (error == 0) - res.reset(new MsgConversationStructListPrivate(true, convList)); - + res = std::make_shared<MsgConversationStructListPrivate>(true, convList); return res; } @@ -273,7 +271,7 @@ MsgConversationItemRef MsgStoragePrivate::getConversationItem(MsgId id) MsgConversationItemRef res; msg_struct_t convItem = msg_create_struct(MSG_STRUCT_CONV_INFO); if (msg_get_conversation(m_ServiceHandle, id, convItem) == 0) { - res.reset(new MsgConversationItemPrivate(true, convItem)); + res = std::make_shared<MsgConversationItemPrivate>(true, convItem); } else { msg_release_struct(&convItem); } @@ -372,8 +370,7 @@ MessageListRef MsgStoragePrivate::searchMessage(const std::string &word) msg_release_struct(&listCond); if (error == 0) - res.reset(new MessageStructListPrivate(true, searchList)); - + res = std::make_shared<MessageStructListPrivate>(true, searchList); return res; } diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h index 124b869..8b65d90 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h @@ -30,25 +30,25 @@ namespace Msg { MsgStoragePrivate(msg_handle_t serviceHandle); MsgStoragePrivate(MsgStoragePrivate&) = delete; MsgStoragePrivate &operator=(MsgStoragePrivate&) = delete; - virtual ~MsgStoragePrivate(); + ~MsgStoragePrivate() override; // Thread: - virtual MsgThreadListRef getThreadList(); - virtual MsgThreadItemRef getThread(ThreadId id); - virtual ThreadId getThreadId(const MsgAddressList &addressList); - virtual ThreadId getThreadId(const std::list<std::string> &addressList); - virtual ThreadId getThreadId(MsgId id); - virtual bool deleteThread(ThreadId id); - virtual MsgAddressListRef getAddressList(ThreadId id); - virtual MsgThreadListRef searchThread(const std::string &word); - virtual void setReadStatus(ThreadId id); - virtual int getUnreadThreadCount() const; + MsgThreadListRef getThreadList() override; + MsgThreadItemRef getThread(ThreadId id) override; + ThreadId getThreadId(const MsgAddressList &addressList) override; + ThreadId getThreadId(const std::list<std::string> &addressList) override; + ThreadId getThreadId(MsgId id) override; + bool deleteThread(ThreadId id) override; + MsgAddressListRef getAddressList(ThreadId id) override; + MsgThreadListRef searchThread(const std::string &word) override; + void setReadStatus(ThreadId id) override; + int getUnreadThreadCount() const override; // Message: - virtual MessageListRef getBlockMsgList(); - virtual MessageSMSListRef getSimMsgList(); - virtual MessageRef getMessage(MsgId id); - virtual bool moveMsgToInBox(MsgId id); + MessageListRef getBlockMsgList() override; + MessageSMSListRef getSimMsgList() override; + MessageRef getMessage(MsgId id) override; + bool moveMsgToInBox(MsgId id) override; /** *@brief Return id of new message or of updated message @@ -58,18 +58,18 @@ namespace Msg { *@param[out] result of storage operation. *@return MessageId */ - virtual MsgId saveMessage(Message &msg, bool updateExisting, StorageResult *result); - virtual bool deleteMessage(MsgId id); - virtual bool deleteMessages(const MsgIdList &idList); - virtual MessageListRef searchMessage(const std::string &word); - virtual void setReadStatus(MsgId id, bool status); - virtual MsgReportListRef getMsgReportList(MsgId msgId); - virtual bool isReadReportChecked(MsgId msgId); - virtual bool isDeliverReportChecked(MsgId msgId); + MsgId saveMessage(Message &msg, bool updateExisting, StorageResult *result) override; + bool deleteMessage(MsgId id) override; + bool deleteMessages(const MsgIdList &idList) override; + MessageListRef searchMessage(const std::string &word) override; + void setReadStatus(MsgId id, bool status) override; + MsgReportListRef getMsgReportList(MsgId msgId) override; + bool isReadReportChecked(MsgId msgId) override; + bool isDeliverReportChecked(MsgId msgId) override; // Conversation: - virtual MsgConversationListRef getConversationList(ThreadId id); - virtual MsgConversationItemRef getConversationItem(MsgId id); + MsgConversationListRef getConversationList(ThreadId id) override; + MsgConversationItemRef getConversationItem(MsgId id) override; private: template <typename T> diff --git a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h index 187eb15..c393003 100644 --- a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h @@ -36,27 +36,27 @@ namespace Msg { { } - virtual ~MsgStructListPrivate() + ~MsgStructListPrivate() override { if (m_Release && m_List.nCount) msg_release_list_struct(&m_List); } - virtual BaseT &at(int i) + BaseT &at(int i) override { msg_struct_t msgStruct = m_List.msg_struct_info[i]; m_Object.set(msgStruct); return m_Object; } - virtual const BaseT &at(int i) const + const BaseT &at(int i) const override { msg_struct_t msgStruct = m_List.msg_struct_info[i]; m_Object.set(msgStruct); return m_Object; } - virtual int getLength() const + int getLength() const override { return m_List.nCount; } diff --git a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h index a000522..dd5195f 100644 --- a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h @@ -28,16 +28,16 @@ namespace Msg { , public MsgThreadItem { public: MsgThreadItemPrivate(bool release, msg_struct_t msgStruct = nullptr); - virtual ~MsgThreadItemPrivate(); + ~MsgThreadItemPrivate() override; - virtual ThreadId getId() const; - virtual std::string getName() const; - virtual std::string getLastMessage() const; - virtual time_t getTime() const; - virtual bool hasDraftMessage() const; - virtual bool hasFailedMessage() const; - virtual bool isSending() const; - virtual int getUnreadCount() const; + ThreadId getId() const override; + std::string getName() const override; + std::string getLastMessage() const override; + time_t getTime() const override; + bool hasDraftMessage() const override; + bool hasFailedMessage() const override; + bool isSending() const override; + int getUnreadCount() const override; }; typedef class MsgListHandlePrivate<MsgThreadItemPrivate, MsgThreadItem> MsgThreadListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgTransportPrivate.h b/src/Common/MsgEngine/src/private/MsgTransportPrivate.h index 1ce667a..868d86a 100644 --- a/src/Common/MsgEngine/src/private/MsgTransportPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgTransportPrivate.h @@ -31,7 +31,7 @@ namespace Msg { : public MsgTransport { public: MsgTransportPrivate(msg_handle_t serviceHandle); - virtual ~MsgTransportPrivate(); + ~MsgTransportPrivate() override; SendResult sendMessage(Message &msg, ThreadId *threadId, RequestId *requestId) override; SendResult retrieveMessage(MsgId msgId, RequestId *requestId) override; |