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 /Swiften/Base | |
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 'Swiften/Base')
-rw-r--r-- | Swiften/Base/Debug.cpp | 11 | ||||
-rw-r--r-- | Swiften/Base/SafeByteArray.h | 15 |
2 files changed, 12 insertions, 14 deletions
diff --git a/Swiften/Base/Debug.cpp b/Swiften/Base/Debug.cpp index 2d306d5..b59de35 100644 --- a/Swiften/Base/Debug.cpp +++ b/Swiften/Base/Debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,8 +7,7 @@ #include <Swiften/Base/Debug.h> #include <iostream> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Client/ClientError.h> #include <Swiften/Serializer/PayloadSerializer.h> @@ -119,16 +118,16 @@ std::ostream& operator<<(std::ostream& os, const Swift::ClientError& error) { std::ostream& operator<<(std::ostream& os, Swift::Element* ele) { using namespace Swift; - boost::shared_ptr<Element> element = boost::shared_ptr<Element>(ele); + std::shared_ptr<Element> element = std::shared_ptr<Element>(ele); - boost::shared_ptr<Payload> payload = boost::dynamic_pointer_cast<Payload>(element); + std::shared_ptr<Payload> payload = std::dynamic_pointer_cast<Payload>(element); if (payload) { FullPayloadSerializerCollection payloadSerializerCollection; PayloadSerializer *serializer = payloadSerializerCollection.getPayloadSerializer(payload); os << "Payload(" << serializer->serialize(payload) << ")"; return os; } - boost::shared_ptr<ToplevelElement> topLevelElement = boost::dynamic_pointer_cast<ToplevelElement>(element); + std::shared_ptr<ToplevelElement> topLevelElement = std::dynamic_pointer_cast<ToplevelElement>(element); if (topLevelElement) { FullPayloadSerializerCollection payloadSerializerCollection; XMPPSerializer xmppSerializer(&payloadSerializerCollection, ClientStreamType, false); diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h index f824194..342c185 100644 --- a/Swiften/Base/SafeByteArray.h +++ b/Swiften/Base/SafeByteArray.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/Base/SafeAllocator.h> @@ -27,8 +26,8 @@ namespace Swift { return SafeByteArray(s.begin(), s.end()); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) { - return boost::make_shared<SafeByteArray>(s.begin(), s.end()); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) { + return std::make_shared<SafeByteArray>(s.begin(), s.end()); } inline SafeByteArray createSafeByteArray(char c) { @@ -39,16 +38,16 @@ namespace Swift { return SafeByteArray(c, c + n); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) { - return boost::make_shared<SafeByteArray>(c, c + n); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) { + return std::make_shared<SafeByteArray>(c, c + n); } inline SafeByteArray createSafeByteArray(const unsigned char* c, size_t n) { return SafeByteArray(c, c + n); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) { - return boost::make_shared<SafeByteArray>(c, c + n); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) { + return std::make_shared<SafeByteArray>(c, c + n); } /* WARNING! This breaks the safety of the data in the safe byte array. |