summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-03-20 00:05:55 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-03-20 19:13:43 (GMT)
commit3d6694b0c698fff63d11f8bb4aa995c1df882315 (patch)
treea46ccace647f23a65100cf69c951345aa6dea7ab /Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
parent3d27d98ccc232ae7bfacfd5a3f85f44b6c2e9cc9 (diff)
downloadswift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.zip
swift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.tar.bz2
boost::shared_ptr<?>(new ?(...)) -> boost::make_shared<?>(...) transformation where possible.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
index 12b1bb5..0db546e 100644
--- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
@@ -1,44 +1,45 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
InBandRegistrationPayloadSerializer::InBandRegistrationPayloadSerializer() {
}
std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<InBandRegistrationPayload> registration) const {
XMLElement registerElement("query", "jabber:iq:register");
if (registration->isRegistered()) {
registerElement.addNode(XMLElement::ref(new XMLElement("registered")));
}
if (registration->isRemove()) {
registerElement.addNode(XMLElement::ref(new XMLElement("remove")));
}
if (registration->getInstructions()) {
registerElement.addNode(XMLElement::ref(new XMLElement("instructions", "", *registration->getInstructions())));
}
if (registration->getUsername()) {
registerElement.addNode(XMLElement::ref(new XMLElement("username", "", *registration->getUsername())));
}
if (registration->getNick()) {
registerElement.addNode(XMLElement::ref(new XMLElement("nick", "", *registration->getNick())));
}
@@ -71,42 +72,42 @@ std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_
}
if (registration->getState()) {
registerElement.addNode(XMLElement::ref(new XMLElement("state", "", *registration->getState())));
}
if (registration->getZip()) {
registerElement.addNode(XMLElement::ref(new XMLElement("zip", "", *registration->getZip())));
}
if (registration->getPhone()) {
registerElement.addNode(XMLElement::ref(new XMLElement("phone", "", *registration->getPhone())));
}
if (registration->getURL()) {
registerElement.addNode(XMLElement::ref(new XMLElement("url", "", *registration->getURL())));
}
if (registration->getDate()) {
registerElement.addNode(XMLElement::ref(new XMLElement("date", "", *registration->getDate())));
}
if (registration->getMisc()) {
registerElement.addNode(XMLElement::ref(new XMLElement("misc", "", *registration->getMisc())));
}
if (registration->getText()) {
registerElement.addNode(XMLElement::ref(new XMLElement("text", "", *registration->getText())));
}
if (registration->getKey()) {
registerElement.addNode(XMLElement::ref(new XMLElement("key", "", *registration->getKey())));
}
if (Form::ref form = registration->getForm()) {
- registerElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form))));
+ registerElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form)));
}
return registerElement.serialize();
}
}