summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/FormSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
index 53b4241..7a6bb79 100644
--- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
@@ -4,16 +4,17 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <string>
-#include "Swiften/Base/String.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
+#include <Swiften/Base/String.h>
+#include <Swiften/Base/Algorithm.h>
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
using namespace Swift;
@@ -129,14 +130,6 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF
fieldType = "text-multi";
multiLineify(boost::dynamic_pointer_cast<TextMultiFormField>(field)->getValue(), "value", fieldElement);
}
- else if (boost::dynamic_pointer_cast<UntypedFormField>(field)) {
- std::vector<std::string> lines = boost::dynamic_pointer_cast<UntypedFormField>(field)->getValue();
- foreach(const std::string& line, lines) {
- boost::shared_ptr<XMLElement> valueElement(new XMLElement("value"));
- valueElement->addNode(XMLTextNode::create(line));
- fieldElement->addNode(valueElement);
- }
- }
else {
assert(false);
}
@@ -162,7 +155,7 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF
void FormSerializer::multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> element) const {
std::string unRdText(text);
- unRdText.erase(std::remove(unRdText.begin(), unRdText.end(), '\r'), unRdText.end());
+ erase(unRdText, '\r');
std::vector<std::string> lines = String::split(unRdText, '\n');
foreach (std::string line, lines) {
boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName));