From 75025326ec13a76cb2a724380bf7569aa6dc6ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 12 Jun 2011 21:41:19 +0200 Subject: Replace explicit new with make_shared. diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index 0f452ef..8e6d7cc 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -24,7 +24,7 @@ boost::shared_ptr IQ::createRequest( } boost::shared_ptr IQ::createResult(const JID& to, const std::string& id, boost::shared_ptr payload) { - boost::shared_ptr iq(new IQ(Result)); + boost::shared_ptr iq = boost::make_shared(Result); iq->setTo(to); iq->setID(id); if (payload) { @@ -34,7 +34,7 @@ boost::shared_ptr IQ::createResult(const JID& to, const std::string& id, boo } boost::shared_ptr IQ::createResult(const JID& to, const JID& from, const std::string& id, boost::shared_ptr payload) { - boost::shared_ptr iq(new IQ(Result)); + boost::shared_ptr iq = boost::make_shared(Result); iq->setTo(to); iq->setFrom(from); iq->setID(id); @@ -45,19 +45,19 @@ boost::shared_ptr IQ::createResult(const JID& to, const JID& from, const std } boost::shared_ptr IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { - boost::shared_ptr iq(new IQ(IQ::Error)); + boost::shared_ptr iq = boost::make_shared(IQ::Error); iq->setTo(to); iq->setID(id); - iq->addPayload(boost::shared_ptr(new Swift::ErrorPayload(condition, type))); + iq->addPayload(boost::make_shared(condition, type)); return iq; } boost::shared_ptr IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { - boost::shared_ptr iq(new IQ(IQ::Error)); + boost::shared_ptr iq = boost::make_shared(IQ::Error); iq->setTo(to); iq->setFrom(from); iq->setID(id); - iq->addPayload(boost::shared_ptr(new Swift::ErrorPayload(condition, type))); + iq->addPayload(boost::make_shared(condition, type)); return iq; } diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index dc2eaf1..19e3fbb 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -34,7 +35,7 @@ namespace Swift { } void setSubject(const std::string& subject) { - updatePayload(boost::shared_ptr(new Subject(subject))); + updatePayload(boost::make_shared(subject)); } std::string getBody() const { @@ -46,7 +47,7 @@ namespace Swift { } void setBody(const std::string& body) { - updatePayload(boost::shared_ptr(new Body(body))); + updatePayload(boost::make_shared(body)); } bool isError() { diff --git a/Swiften/Elements/Presence.cpp b/Swiften/Elements/Presence.cpp index 6cde567..38b8a4c 100644 --- a/Swiften/Elements/Presence.cpp +++ b/Swiften/Elements/Presence.cpp @@ -27,7 +27,7 @@ int Presence::getPriority() const { } void Presence::setPriority(int priority) { - updatePayload(boost::shared_ptr(new Priority(priority))); + updatePayload(boost::make_shared(priority)); } std::string Presence::getStatus() const { @@ -39,7 +39,7 @@ std::string Presence::getStatus() const { } void Presence::setStatus(const std::string& status) { - updatePayload(boost::shared_ptr(new Status(status))); + updatePayload(boost::make_shared(status)); } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 5ae482b..28a9ee5 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include @@ -21,15 +23,15 @@ namespace Swift { virtual ~Presence(); static ref create() { - return ref(new Presence()); + return boost::make_shared(); } static ref create(const std::string& status) { - return ref(new Presence(status)); + return boost::make_shared(status); } static ref create(Presence::ref presence) { - return ref(new Presence(*presence)); + return boost::make_shared(*presence); } Type getType() const { return type_; } @@ -44,7 +46,7 @@ namespace Swift { } void setShow(const StatusShow::Type &show) { - updatePayload(boost::shared_ptr(new StatusShow(show))); + updatePayload(boost::make_shared(show)); } std::string getStatus() const; @@ -54,7 +56,7 @@ namespace Swift { void setPriority(int priority); boost::shared_ptr clone() const { - return boost::shared_ptr(new Presence(*this)); + return boost::make_shared(*this); } bool isAvailable() const { -- cgit v0.10.2-6-g49f6