diff options
Diffstat (limited to 'Swiften/Serializer/IQSerializer.h')
-rw-r--r-- | Swiften/Serializer/IQSerializer.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Swiften/Serializer/IQSerializer.h b/Swiften/Serializer/IQSerializer.h new file mode 100644 index 0000000..3623f24 --- /dev/null +++ b/Swiften/Serializer/IQSerializer.h @@ -0,0 +1,30 @@ +#ifndef SWIFTEN_IQSerializer_H +#define SWIFTEN_IQSerializer_H + +#include <cassert> + +#include "Swiften/Serializer/GenericStanzaSerializer.h" +#include "Swiften/Elements/IQ.h" +#include "Swiften/Serializer/XML/XMLElement.h" + +namespace Swift { + class IQSerializer : public GenericStanzaSerializer<IQ> { + public: + IQSerializer(PayloadSerializerCollection* payloadSerializers) : + GenericStanzaSerializer<IQ>("iq", payloadSerializers) {} + + private: + virtual void setStanzaSpecificAttributesGeneric( + boost::shared_ptr<IQ> iq, + XMLElement& element) const { + switch (iq->getType()) { + case IQ::Get: element.setAttribute("type","get"); break; + case IQ::Set: element.setAttribute("type","set"); break; + case IQ::Result: element.setAttribute("type","result"); break; + case IQ::Error: element.setAttribute("type","error"); break; + } + } + }; +} + +#endif |