summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp7
1 files changed, 4 insertions, 3 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
@@ -1,18 +1,19 @@
/*
* Copyright (c) 2010 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#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>
#include <Swiften/Serializer/XML/XMLTextNode.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
@@ -48,39 +49,39 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma
std::string executeAction = actionToString(command->getExecuteAction());
if (!executeAction.empty()) {
actions += " execute='" + executeAction + "'";
}
actions += ">";
foreach (Command::Action action, command->getAvailableActions()) {
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()) {
boost::shared_ptr<XMLElement> noteElement(new XMLElement("note"));
std::string type;
switch (note.type) {
case Command::Note::Info: type = "info"; break;
case Command::Note::Warn: type = "warn"; break;
case Command::Note::Error: type = "error"; break;
}
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();
}
std::string CommandSerializer::actionToString(Command::Action action) const {
std::string string;
switch (action) {
case Command::Cancel: string = "cancel"; break;
case Command::Execute: string = "execute"; break;