diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swift/Controllers/UIInterfaces | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
11 files changed, 28 insertions, 26 deletions
diff --git a/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h b/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h index d3003f7..7b9b6f7 100644 --- a/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h @@ -15,6 +15,6 @@ class AdHocCommandWindow; class AdHocCommandWindowFactory { public: virtual ~AdHocCommandWindowFactory() {} - virtual AdHocCommandWindow* createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) = 0; + virtual AdHocCommandWindow* createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) = 0; }; } diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h index a94e14e..5d470cc 100644 --- a/Swift/Controllers/UIInterfaces/ChatListWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h @@ -8,10 +8,10 @@ #include <list> #include <map> +#include <memory> #include <set> #include <boost/filesystem/path.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Base/foreach.h> diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 310c967..28bf543 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -6,14 +6,13 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/algorithm/string.hpp> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/make_shared.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/Tristate.h> #include <Swiften/Base/boost_bsignals.h> @@ -47,13 +46,13 @@ namespace Swift { public: ChatMessage() {} ChatMessage(const std::string& text) { - append(boost::make_shared<ChatTextMessagePart>(text)); + append(std::make_shared<ChatTextMessagePart>(text)); } - void append(const boost::shared_ptr<ChatMessagePart>& part) { + void append(const std::shared_ptr<ChatMessagePart>& part) { parts_.push_back(part); } - const std::vector<boost::shared_ptr<ChatMessagePart> >& getParts() const { + const std::vector<std::shared_ptr<ChatMessagePart> >& getParts() const { return parts_; } @@ -68,7 +67,7 @@ namespace Swift { bool isMeCommand() const { bool isMeCommand = false; if (!parts_.empty()) { - boost::shared_ptr<ChatTextMessagePart> textPart = boost::dynamic_pointer_cast<ChatTextMessagePart>(parts_[0]); + std::shared_ptr<ChatTextMessagePart> textPart = std::dynamic_pointer_cast<ChatTextMessagePart>(parts_[0]); if (textPart) { if (boost::starts_with(textPart->text, "/me ")) { isMeCommand = true; @@ -79,7 +78,7 @@ namespace Swift { } private: - std::vector<boost::shared_ptr<ChatMessagePart> > parts_; + std::vector<std::shared_ptr<ChatMessagePart> > parts_; HighlightAction fullMessageHighlightAction_; }; @@ -134,11 +133,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds system message to window * @return id of added message (for replacement) diff --git a/Swift/Controllers/UIInterfaces/ContactEditWindow.h b/Swift/Controllers/UIInterfaces/ContactEditWindow.h index 055c0f0..9aa2dcb 100644 --- a/Swift/Controllers/UIInterfaces/ContactEditWindow.h +++ b/Swift/Controllers/UIInterfaces/ContactEditWindow.h @@ -6,12 +6,11 @@ #pragma once +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> namespace Swift { diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h index 1d254f4..c05976b 100644 --- a/Swift/Controllers/UIInterfaces/EventWindow.h +++ b/Swift/Controllers/UIInterfaces/EventWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swift/Controllers/XMPPEvents/StanzaEvent.h> @@ -20,8 +20,8 @@ namespace Swift { } virtual ~EventWindow() {} - virtual void addEvent(boost::shared_ptr<StanzaEvent> event, bool active) = 0; - virtual void removeEvent(boost::shared_ptr<StanzaEvent> event) = 0; + virtual void addEvent(std::shared_ptr<StanzaEvent> event, bool active) = 0; + virtual void removeEvent(std::shared_ptr<StanzaEvent> event) = 0; private: bool canDelete_; diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h index cedc549..4518469 100644 --- a/Swift/Controllers/UIInterfaces/LoginWindow.h +++ b/Swift/Controllers/UIInterfaces/LoginWindow.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Client/ClientOptions.h> #include <Swiften/TLS/Certificate.h> diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h index d8bcb58..ed225d8 100644 --- a/Swift/Controllers/UIInterfaces/MainWindow.h +++ b/Swift/Controllers/UIInterfaces/MainWindow.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/DiscoItems.h> #include <Swiften/Elements/StatusShow.h> @@ -35,7 +34,7 @@ namespace Swift { virtual void setMyAvatarPath(const std::string& path) = 0; virtual void setMyStatusText(const std::string& status) = 0; virtual void setMyStatusType(StatusShow::Type type) = 0; - virtual void setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) = 0; + virtual void setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact) = 0; /** Must be able to cope with NULL to clear the roster */ virtual void setRosterModel(Roster* roster) = 0; virtual void setConnecting() = 0; diff --git a/Swift/Controllers/UIInterfaces/ProfileWindow.h b/Swift/Controllers/UIInterfaces/ProfileWindow.h index 8aa620c..27b0d1a 100644 --- a/Swift/Controllers/UIInterfaces/ProfileWindow.h +++ b/Swift/Controllers/UIInterfaces/ProfileWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/VCard.h> diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h index 4ddc29b..55bd117 100644 --- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h @@ -29,7 +29,7 @@ namespace Swift { virtual void setSelectedService(const JID& service) = 0; virtual void setServerSupportsSearch(bool support) = 0; virtual void setSearchError(bool support) = 0; - virtual void setSearchFields(boost::shared_ptr<SearchPayload> fields) = 0; + virtual void setSearchFields(std::shared_ptr<SearchPayload> fields) = 0; virtual void setNameSuggestions(const std::vector<std::string>& suggestions) = 0; virtual void prepopulateJIDAndName(const JID& jid, const std::string& name) = 0; virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions) = 0; @@ -46,7 +46,7 @@ namespace Swift { virtual void show() = 0; boost::signal<void (const JID&)> onFormRequested; - boost::signal<void (boost::shared_ptr<SearchPayload>, const JID&)> onSearchRequested; + boost::signal<void (std::shared_ptr<SearchPayload>, const JID&)> onSearchRequested; boost::signal<void (const JID&)> onNameSuggestionRequested; boost::signal<void (const std::string&)> onContactSuggestionsRequested; boost::signal<void (const std::vector<JID>&)> onJIDUpdateRequested; diff --git a/Swift/Controllers/UIInterfaces/WhiteboardWindow.h b/Swift/Controllers/UIInterfaces/WhiteboardWindow.h index f3b35db..28348df 100644 --- a/Swift/Controllers/UIInterfaces/WhiteboardWindow.h +++ b/Swift/Controllers/UIInterfaces/WhiteboardWindow.h @@ -25,7 +25,7 @@ namespace Swift { virtual ~WhiteboardWindow() {} virtual void show() = 0; - virtual void setSession(boost::shared_ptr<WhiteboardSession> session) = 0; + virtual void setSession(std::shared_ptr<WhiteboardSession> session) = 0; virtual void activateWindow() = 0; virtual void setName(const std::string& name) = 0; }; diff --git a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h index 163368b..0153a5a 100644 --- a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once namespace Swift { @@ -14,6 +20,6 @@ namespace Swift { public : virtual ~WhiteboardWindowFactory() {} - virtual WhiteboardWindow* createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession) = 0; + virtual WhiteboardWindow* createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession) = 0; }; } |