summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/StanzaSerializer.cpp')
m---------Swiften0
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp50
2 files changed, 0 insertions, 50 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp
deleted file mode 100644
index d940634..0000000
--- a/Swiften/Serializer/StanzaSerializer.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "Swiften/Serializer/StanzaSerializer.h"
-
-#include <sstream>
-#include <typeinfo>
-#include <iostream>
-
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Elements/Stanza.h"
-
-namespace Swift {
-
-StanzaSerializer::StanzaSerializer(const String& tag, PayloadSerializerCollection* payloadSerializers) : tag_(tag), payloadSerializers_(payloadSerializers) {
-}
-
-String StanzaSerializer::serialize(boost::shared_ptr<Element> element) const {
- boost::shared_ptr<Stanza> stanza(boost::dynamic_pointer_cast<Stanza>(element));
-
- XMLElement stanzaElement(tag_);
- if (stanza->getFrom().isValid()) {
- stanzaElement.setAttribute("from", stanza->getFrom());
- }
- if (stanza->getTo().isValid()) {
- stanzaElement.setAttribute("to", stanza->getTo());
- }
- if (!stanza->getID().isEmpty()) {
- stanzaElement.setAttribute("id", stanza->getID());
- }
- setStanzaSpecificAttributes(stanza, stanzaElement);
-
- String serializedPayloads;
- foreach (const boost::shared_ptr<Payload>& payload, stanza->getPayloads()) {
- PayloadSerializer* serializer = payloadSerializers_->getPayloadSerializer(payload);
- if (serializer) {
- serializedPayloads += serializer->serialize(payload);
- }
- else {
- std::cerr << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl;
- }
- }
- if (!serializedPayloads.isEmpty()) {
- stanzaElement.addNode(boost::shared_ptr<XMLNode>(new XMLRawTextNode(serializedPayloads)));
- }
-
- return stanzaElement.serialize();
-}
-
-}