summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Parser/StanzaParser.cpp
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Parser/StanzaParser.cpp')
-rw-r--r--Swiften/Parser/StanzaParser.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/Swiften/Parser/StanzaParser.cpp b/Swiften/Parser/StanzaParser.cpp
index 5b06af1..82ddb5c 100644
--- a/Swiften/Parser/StanzaParser.cpp
+++ b/Swiften/Parser/StanzaParser.cpp
@@ -18,69 +18,69 @@
namespace Swift {
-StanzaParser::StanzaParser(PayloadParserFactoryCollection* factories) :
- currentDepth_(0), factories_(factories) {
+StanzaParser::StanzaParser(PayloadParserFactoryCollection* factories) :
+ currentDepth_(0), factories_(factories) {
}
StanzaParser::~StanzaParser() {
}
void StanzaParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (inStanza()) {
- if (!inPayload()) {
- assert(!currentPayloadParser_);
- PayloadParserFactory* payloadParserFactory = factories_->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser_.reset(payloadParserFactory->createPayloadParser());
- }
- else {
- currentPayloadParser_.reset(new UnknownPayloadParser());
- }
- }
- assert(currentPayloadParser_);
- currentPayloadParser_->handleStartElement(element, ns, attributes);
- }
- else {
- boost::optional<std::string> from = attributes.getAttributeValue("from");
- if (from) {
- getStanza()->setFrom(JID(*from));
- }
- boost::optional<std::string> to = attributes.getAttributeValue("to");
- if (to) {
- getStanza()->setTo(JID(*to));
- }
- boost::optional<std::string> id = attributes.getAttributeValue("id");
- if (id) {
- getStanza()->setID(*id);
- }
- handleStanzaAttributes(attributes);
- }
- ++currentDepth_;
+ if (inStanza()) {
+ if (!inPayload()) {
+ assert(!currentPayloadParser_);
+ PayloadParserFactory* payloadParserFactory = factories_->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser_.reset(payloadParserFactory->createPayloadParser());
+ }
+ else {
+ currentPayloadParser_.reset(new UnknownPayloadParser());
+ }
+ }
+ assert(currentPayloadParser_);
+ currentPayloadParser_->handleStartElement(element, ns, attributes);
+ }
+ else {
+ boost::optional<std::string> from = attributes.getAttributeValue("from");
+ if (from) {
+ getStanza()->setFrom(JID(*from));
+ }
+ boost::optional<std::string> to = attributes.getAttributeValue("to");
+ if (to) {
+ getStanza()->setTo(JID(*to));
+ }
+ boost::optional<std::string> id = attributes.getAttributeValue("id");
+ if (id) {
+ getStanza()->setID(*id);
+ }
+ handleStanzaAttributes(attributes);
+ }
+ ++currentDepth_;
}
void StanzaParser::handleEndElement(const std::string& element, const std::string& ns) {
- assert(inStanza());
- if (inPayload()) {
- assert(currentPayloadParser_);
- currentPayloadParser_->handleEndElement(element, ns);
- --currentDepth_;
- if (!inPayload()) {
- boost::shared_ptr<Payload> payload(currentPayloadParser_->getPayload());
- if (payload) {
- getStanza()->addPayload(payload);
- }
- currentPayloadParser_.reset();
- }
- }
- else {
- --currentDepth_;
- }
+ assert(inStanza());
+ if (inPayload()) {
+ assert(currentPayloadParser_);
+ currentPayloadParser_->handleEndElement(element, ns);
+ --currentDepth_;
+ if (!inPayload()) {
+ boost::shared_ptr<Payload> payload(currentPayloadParser_->getPayload());
+ if (payload) {
+ getStanza()->addPayload(payload);
+ }
+ currentPayloadParser_.reset();
+ }
+ }
+ else {
+ --currentDepth_;
+ }
}
void StanzaParser::handleCharacterData(const std::string& data) {
- if (currentPayloadParser_) {
- currentPayloadParser_->handleCharacterData(data);
- }
+ if (currentPayloadParser_) {
+ currentPayloadParser_->handleCharacterData(data);
+ }
}
}