summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h')
m---------Swiften0
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h55
2 files changed, 0 insertions, 55 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
deleted file mode 100644
index ac167cf..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Parser/XMLParser.h"
-#include "Swiften/Parser/XMLParserClient.h"
-#include "Swiften/Parser/PlatformXMLParserFactory.h"
-
-namespace Swift {
- class PayloadsParserTester : public XMLParserClient {
- public:
- PayloadsParserTester() : level(0) {
- xmlParser = PlatformXMLParserFactory().createXMLParser(this);
- }
-
- ~PayloadsParserTester() {
- delete xmlParser;
- }
-
- bool parse(const String& data) {
- return xmlParser->parse(data);
- }
-
- virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- if (level == 0) {
- CPPUNIT_ASSERT(!payloadParser.get());
- PayloadParserFactory* payloadParserFactory = factories.getPayloadParserFactory(element, ns, attributes);
- CPPUNIT_ASSERT(payloadParserFactory);
- payloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- payloadParser->handleStartElement(element, ns, attributes);
- level++;
- }
-
- virtual void handleEndElement(const String& element, const String& ns) {
- level--;
- payloadParser->handleEndElement(element, ns);
- }
-
- virtual void handleCharacterData(const String& data) {
- payloadParser->handleCharacterData(data);
- }
-
- boost::shared_ptr<Payload> getPayload() const {
- return payloadParser->getPayload();
- }
-
- private:
- XMLParser* xmlParser;
- FullPayloadParserFactoryCollection factories;
- std::auto_ptr<PayloadParser> payloadParser;
- int level;
- };
-}