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
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')
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/StatusSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp31
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp3
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.cpp12
-rw-r--r--Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp6
23 files changed, 80 insertions, 54 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
index 2fb86b0..40acd8e 100644
--- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -54,7 +55,7 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma
actions += "<" + actionToString(action) + "/>";
}
actions += "</actions>";
- commandElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(actions)));
+ commandElement.addNode(boost::make_shared<XMLRawTextNode>(actions));
}
foreach (Command::Note note, command->getNotes()) {
@@ -68,13 +69,13 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma
if (!type.empty()) {
noteElement->setAttribute("type", type);
}
- noteElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(note.note)));
+ noteElement->addNode(boost::make_shared<XMLTextNode>(note.note));
commandElement.addNode(noteElement);
}
Form::ref form = command->getForm();
if (form) {
- commandElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form))));
+ commandElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form)));
}
return commandElement.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
index e2c6f59..03b3eb2 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -39,7 +40,7 @@ std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> d
queryElement.addNode(featureElement);
}
foreach(const Form::ref extension, discoInfo->getExtensions()) {
- queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(extension))));
+ queryElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension)));
}
return queryElement.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
index 15c4f32..ba658e3 100644
--- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <iostream>
#include <string>
@@ -81,11 +82,11 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF
fieldElement->setAttribute("label", field->getLabel());
}
if (field->getRequired()) {
- fieldElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("required")));
+ fieldElement->addNode(boost::make_shared<XMLElement>("required"));
}
if (!field->getDescription().empty()) {
boost::shared_ptr<XMLElement> descriptionElement(new XMLElement("desc"));
- descriptionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(field->getDescription())));
+ descriptionElement->addNode(boost::make_shared<XMLTextNode>(field->getDescription()));
fieldElement->addNode(descriptionElement);
}
@@ -174,7 +175,7 @@ void FormSerializer::multiLineify(const std::string& text, const std::string& el
std::vector<std::string> lines = String::split(unRdText, '\n');
foreach (std::string line, lines) {
boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName));
- lineElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(line)));
+ lineElement->addNode(boost::make_shared<XMLTextNode>(line));
element->addNode(lineElement);
}
}
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
index f3dad80..e78cdb4 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/foreach.h>
@@ -27,7 +28,7 @@ std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const {
if (ibb->getSequenceNumber() >= 0) {
ibbElement.setAttribute("seq", boost::lexical_cast<std::string>(ibb->getSequenceNumber()));
}
- ibbElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(Base64::encode(ibb->getData()))));
+ ibbElement.addNode(boost::make_shared<XMLTextNode>(Base64::encode(ibb->getData())));
return ibbElement.serialize();
}
case IBB::Open: {
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
@@ -7,6 +7,7 @@
#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>
@@ -103,7 +104,7 @@ std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_
}
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();
diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
index c16a2e4..a04687b 100644
--- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
@@ -43,7 +43,7 @@ std::string JinglePayloadSerializer::serializePayload(boost::shared_ptr<JinglePa
foreach(boost::shared_ptr<Payload> subPayload, payloads) {
PayloadSerializer* serializer = serializers->getPayloadSerializer(subPayload);
if (serializer) {
- jinglePayload.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(subPayload))));
+ jinglePayload.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(subPayload)));
}
}
}
diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
index f86b59e..3cb8cf6 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
@@ -6,6 +6,8 @@
#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h>
+#include <boost/smart_ptr/make_shared.hpp>
+
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -21,7 +23,7 @@ std::string MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptr<MUCOwn
if (payload) {
PayloadSerializer* serializer = serializers->getPayloadSerializer(payload);
if (serializer) {
- mucElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(payload))));
+ mucElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(payload)));
}
}
return mucElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
index 66ca5d0..2e60654 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
@@ -9,6 +9,7 @@
#include <sstream>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -60,7 +61,7 @@ std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUser
if (childPayload) {
PayloadSerializer* serializer = serializers->getPayloadSerializer(childPayload);
if (serializer) {
- mucElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(childPayload))));
+ mucElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(childPayload)));
}
}
return mucElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
index 38a5db5..33385b0 100644
--- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -18,7 +19,7 @@ NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer<Nickname>()
std::string NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick) const {
XMLElement nickElement("nick", "http://jabber.org/protocol/nick");
- nickElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(nick->getNickname())));
+ nickElement.addNode(boost::make_shared<XMLTextNode>(nick->getNickname()));
return nickElement.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
index 6cb226c..cfba552 100644
--- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -25,7 +26,7 @@ std::string PrivateStorageSerializer::serializePayload(boost::shared_ptr<Private
if (payload) {
PayloadSerializer* serializer = serializers->getPayloadSerializer(payload);
if (serializer) {
- storageElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(payload))));
+ storageElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(payload)));
}
}
return storageElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
index af0c609..c72734b 100644
--- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -20,12 +21,12 @@ std::string ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceB
XMLElement bindElement("bind", "urn:ietf:params:xml:ns:xmpp-bind");
if (resourceBind->getJID().isValid()) {
boost::shared_ptr<XMLElement> jidNode(new XMLElement("jid"));
- jidNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getJID().toString())));
+ jidNode->addNode(boost::make_shared<XMLTextNode>(resourceBind->getJID().toString()));
bindElement.addNode(jidNode);
}
else if (!resourceBind->getResource().empty()) {
boost::shared_ptr<XMLElement> resourceNode(new XMLElement("resource"));
- resourceNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getResource())));
+ resourceNode->addNode(boost::make_shared<XMLTextNode>(resourceBind->getResource()));
bindElement.addNode(resourceNode);
}
return bindElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
index b60db12..39eaf7d 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -33,7 +34,7 @@ std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<Ros
foreach(const std::string& group, item.getGroups()) {
boost::shared_ptr<XMLElement> groupElement(new XMLElement("group"));
- groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group)));
+ groupElement->addNode(boost::make_shared<XMLTextNode>(group));
itemElement->addNode(groupElement);
}
diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
index 84f36d2..d2d143d 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -42,12 +43,12 @@ std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload>
foreach(const std::string& group, item.getGroups()) {
boost::shared_ptr<XMLElement> groupElement(new XMLElement("group"));
- groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group)));
+ groupElement->addNode(boost::make_shared<XMLTextNode>(group));
itemElement->addNode(groupElement);
}
if (!item.getUnknownContent().empty()) {
- itemElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(item.getUnknownContent())));
+ itemElement->addNode(boost::make_shared<XMLRawTextNode>(item.getUnknownContent()));
}
diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
index a5cd634..07dd8de 100644
--- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -53,7 +54,7 @@ std::string SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPa
}
if (Form::ref form = searchPayload->getForm()) {
- searchElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form))));
+ searchElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form)));
}
return searchElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
index 51079ee..7a0b513 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
@@ -4,6 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <boost/smart_ptr/make_shared.hpp>
+
#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -25,17 +27,17 @@ std::string SecurityLabelSerializer::serializePayload(boost::shared_ptr<Security
if (!label->getBackgroundColor().empty()) {
displayMarking->setAttribute("bgcolor", label->getBackgroundColor());
}
- displayMarking->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(label->getDisplayMarking())));
+ displayMarking->addNode(boost::make_shared<XMLTextNode>(label->getDisplayMarking()));
element.addNode(displayMarking);
}
boost::shared_ptr<XMLElement> labelElement(new XMLElement("label"));
- labelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(label->getLabel())));
+ labelElement->addNode(boost::make_shared<XMLRawTextNode>(label->getLabel()));
element.addNode(labelElement);
foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) {
boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel"));
- equivalentLabelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(equivalentLabel)));
+ equivalentLabelElement->addNode(boost::make_shared<XMLRawTextNode>(equivalentLabel));
element.addNode(equivalentLabelElement);
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
index 1078292..8871eff 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
@@ -4,6 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <boost/smart_ptr/make_shared.hpp>
+
#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -34,7 +36,7 @@ std::string SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr<
}
if (item.getLabel()) {
std::string serializedLabel = SecurityLabelSerializer().serialize(item.getLabel());
- itemElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializedLabel)));
+ itemElement->addNode(boost::make_shared<XMLRawTextNode>(serializedLabel));
}
element.addNode(itemElement);
}
diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
index a8de26f..bd076ae 100644
--- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
@@ -6,6 +6,8 @@
#pragma once
+#include <boost/smart_ptr/make_shared.hpp>
+
#include <Swiften/Serializer/GenericPayloadSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -18,7 +20,7 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<Status> status) const {
XMLElement element("status");
- element.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(status->getText())));
+ element.addNode(boost::make_shared<XMLTextNode>(status->getText()));
return element.serialize();
}
};
diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
index 77fb3c0..296d5dd 100644
--- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -27,12 +28,12 @@ std::string StorageSerializer::serializePayload(boost::shared_ptr<Storage> stora
conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0");
if (!room.nick.empty()) {
boost::shared_ptr<XMLElement> nickElement(new XMLElement("nick"));
- nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(room.nick)));
+ nickElement->addNode(boost::make_shared<XMLTextNode>(room.nick));
conferenceElement->addNode(nickElement);
}
if (room.password) {
boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password"));
- passwordElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(*room.password)));
+ passwordElement->addNode(boost::make_shared<XMLTextNode>(*room.password));
conferenceElement->addNode(passwordElement);
}
storageElement.addNode(conferenceElement);
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
index 9ccfab2..030b024 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/foreach.h>
@@ -42,7 +43,7 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea
}
if (!file.getDescription().empty()) {
boost::shared_ptr<XMLElement> descElement(new XMLElement("desc"));
- descElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(file.getDescription())));
+ descElement->addNode(boost::make_shared<XMLTextNode>(file.getDescription()));
fileElement->addNode(descElement);
}
siElement.addNode(fileElement);
@@ -57,14 +58,14 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea
field->addOption(FormField::Option("", method));
}
form->addField(field);
- featureElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form))));
+ featureElement->addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form)));
}
else if (!streamInitiation->getRequestedMethod().empty()) {
Form::ref form(new Form(Form::SubmitType));
ListSingleFormField::ref field = ListSingleFormField::create(streamInitiation->getRequestedMethod());
field->setName("stream-method");
form->addField(field);
- featureElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form))));
+ featureElement->addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form)));
}
siElement.addNode(featureElement);
return siElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
index 17a6b49..1512c6c 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -23,39 +24,39 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
XMLElement queryElement("vCard", "vcard-temp");
if (!vcard->getVersion().empty()) {
boost::shared_ptr<XMLElement> versionElement(new XMLElement("VERSION"));
- versionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getVersion())));
+ versionElement->addNode(boost::make_shared<XMLTextNode>(vcard->getVersion()));
queryElement.addNode(versionElement);
}
if (!vcard->getFullName().empty()) {
boost::shared_ptr<XMLElement> fullNameElement(new XMLElement("FN"));
- fullNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFullName())));
+ fullNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFullName()));
queryElement.addNode(fullNameElement);
}
if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) {
boost::shared_ptr<XMLElement> nameElement(new XMLElement("N"));
if (!vcard->getFamilyName().empty()) {
boost::shared_ptr<XMLElement> familyNameElement(new XMLElement("FAMILY"));
- familyNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFamilyName())));
+ familyNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFamilyName()));
nameElement->addNode(familyNameElement);
}
if (!vcard->getGivenName().empty()) {
boost::shared_ptr<XMLElement> givenNameElement(new XMLElement("GIVEN"));
- givenNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getGivenName())));
+ givenNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getGivenName()));
nameElement->addNode(givenNameElement);
}
if (!vcard->getMiddleName().empty()) {
boost::shared_ptr<XMLElement> middleNameElement(new XMLElement("MIDDLE"));
- middleNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getMiddleName())));
+ middleNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getMiddleName()));
nameElement->addNode(middleNameElement);
}
if (!vcard->getPrefix().empty()) {
boost::shared_ptr<XMLElement> prefixElement(new XMLElement("PREFIX"));
- prefixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getPrefix())));
+ prefixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getPrefix()));
nameElement->addNode(prefixElement);
}
if (!vcard->getSuffix().empty()) {
boost::shared_ptr<XMLElement> suffixElement(new XMLElement("SUFFIX"));
- suffixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getSuffix())));
+ suffixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getSuffix()));
nameElement->addNode(suffixElement);
}
queryElement.addNode(nameElement);
@@ -63,28 +64,28 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) {
boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL"));
boost::shared_ptr<XMLElement> userIDElement(new XMLElement("USERID"));
- userIDElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(emailAddress.address)));
+ userIDElement->addNode(boost::make_shared<XMLTextNode>(emailAddress.address));
emailElement->addNode(userIDElement);
if (emailAddress.isHome) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("HOME")));
+ emailElement->addNode(boost::make_shared<XMLElement>("HOME"));
}
if (emailAddress.isWork) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("WORK")));
+ emailElement->addNode(boost::make_shared<XMLElement>("WORK"));
}
if (emailAddress.isInternet) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("INTERNET")));
+ emailElement->addNode(boost::make_shared<XMLElement>("INTERNET"));
}
if (emailAddress.isPreferred) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("PREF")));
+ emailElement->addNode(boost::make_shared<XMLElement>("PREF"));
}
if (emailAddress.isX400) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("X400")));
+ emailElement->addNode(boost::make_shared<XMLElement>("X400"));
}
queryElement.addNode(emailElement);
}
if (!vcard->getNickname().empty()) {
boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME"));
- nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname())));
+ nickElement->addNode(boost::make_shared<XMLTextNode>(vcard->getNickname()));
queryElement.addNode(nickElement);
}
if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) {
@@ -102,7 +103,7 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
queryElement.addNode(photoElement);
}
if (!vcard->getUnknownContent().empty()) {
- queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(vcard->getUnknownContent())));
+ queryElement.addNode(boost::make_shared<XMLRawTextNode>(vcard->getUnknownContent()));
}
return queryElement.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
index c06262f..78c700b 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -19,7 +20,7 @@ VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer<VCardU
std::string VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate) const {
XMLElement updateElement("x", "vcard-temp:x:update");
boost::shared_ptr<XMLElement> photoElement(new XMLElement("photo"));
- photoElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcardUpdate->getPhotoHash())));
+ photoElement->addNode(boost::make_shared<XMLTextNode>(vcardUpdate->getPhotoHash()));
updateElement.addNode(photoElement);
return updateElement.serialize();
}
diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp
index fb7bb8c..2344349 100644
--- a/Swiften/Serializer/StreamFeaturesSerializer.cpp
+++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp
@@ -22,13 +22,13 @@ SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> ele
XMLElement streamFeaturesElement("stream:features");
if (streamFeatures->hasStartTLS()) {
- streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls")));
+ streamFeaturesElement.addNode(boost::make_shared<XMLElement>("starttls", "urn:ietf:params:xml:ns:xmpp-tls"));
}
if (!streamFeatures->getCompressionMethods().empty()) {
boost::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress"));
foreach(const std::string& method, streamFeatures->getCompressionMethods()) {
boost::shared_ptr<XMLElement> methodElement(new XMLElement("method"));
- methodElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(method)));
+ methodElement->addNode(boost::make_shared<XMLTextNode>(method));
compressionElement->addNode(methodElement);
}
streamFeaturesElement.addNode(compressionElement);
@@ -37,19 +37,19 @@ SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> ele
boost::shared_ptr<XMLElement> mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl"));
foreach(const std::string& mechanism, streamFeatures->getAuthenticationMechanisms()) {
boost::shared_ptr<XMLElement> mechanismElement(new XMLElement("mechanism"));
- mechanismElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(mechanism)));
+ mechanismElement->addNode(boost::make_shared<XMLTextNode>(mechanism));
mechanismsElement->addNode(mechanismElement);
}
streamFeaturesElement.addNode(mechanismsElement);
}
if (streamFeatures->hasResourceBind()) {
- streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("bind", "urn:ietf:params:xml:ns:xmpp-bind")));
+ streamFeaturesElement.addNode(boost::make_shared<XMLElement>("bind", "urn:ietf:params:xml:ns:xmpp-bind"));
}
if (streamFeatures->hasSession()) {
- streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session")));
+ streamFeaturesElement.addNode(boost::make_shared<XMLElement>("session", "urn:ietf:params:xml:ns:xmpp-session"));
}
if (streamFeatures->hasStreamManagement()) {
- streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("sm", "urn:xmpp:sm:2")));
+ streamFeaturesElement.addNode(boost::make_shared<XMLElement>("sm", "urn:xmpp:sm:2"));
}
if (streamFeatures->hasRosterVersioning()) {
streamFeaturesElement.addNode(boost::make_shared<XMLElement>("ver", "urn:xmpp:features:rosterver"));
diff --git a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
index b70128b..a2197b0 100644
--- a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
+++ b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
@@ -7,6 +7,8 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <boost/smart_ptr/make_shared.hpp>
+
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -28,10 +30,10 @@ class XMLElementTest : public CppUnit::TestFixture
XMLElement testling("foo", "http://example.com");
testling.setAttribute("myatt", "myval");
boost::shared_ptr<XMLElement> barElement(new XMLElement("bar"));
- barElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode("Blo")));
+ barElement->addNode(boost::make_shared<XMLTextNode>("Blo"));
testling.addNode(barElement);
boost::shared_ptr<XMLElement> bazElement(new XMLElement("baz"));
- bazElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode("Bli&</stream>")));
+ bazElement->addNode(boost::make_shared<XMLTextNode>("Bli&</stream>"));
testling.addNode(bazElement);
std::string result = testling.serialize();