summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Robbings <tim.robbings@isode.com>2015-03-09 16:11:32 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-03-17 17:35:17 (GMT)
commitdaf513a6567100322d3c51733ea0c449ca6adb1b (patch)
tree1e782b7581c90b2e0ca79a36de5df3dcd6804462 /Swiften/Parser/PayloadParsers
parent141b0cb28e2b830553cbb654499cce3a7a8a1907 (diff)
downloadswift-daf513a6567100322d3c51733ea0c449ca6adb1b.zip
swift-daf513a6567100322d3c51733ea0c449ca6adb1b.tar.bz2
Tidy XEP-0141 code
This change addresses some feedback the previous XEP-0141 commit (a39d650). Test-information: Ran the CPPUnit tests, these completed successfully. Change-Id: I2caf1eb1349f7527bd9af8ce8adfb194391253e4
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.cpp15
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.h1
2 files changed, 7 insertions, 9 deletions
diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp
index d400c4c..bc48fcb 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.cpp
+++ b/Swiften/Parser/PayloadParsers/FormParser.cpp
@@ -4,18 +4,17 @@
* See the COPYING file for more information.
*/
#include <iostream>
-#include <Swiften/Parser/PayloadParsers/FormParser.h>
#include <map>
#include <Swiften/Base/foreach.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
namespace Swift {
-FormParser::FormParser() : level_(TopLevel), parsingItem_(false), parsingReported_(false), parsingOption_(false), parseStarted_(false), hasReportedRef_(false){
+FormParser::FormParser() : level_(TopLevel), parsingItem_(false), parsingReported_(false), parsingOption_(false), hasReportedRef_(false){
}
void FormParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
if (level_ == TopLevel) {
- parseStarted_ = true;
std::string type = attributes.getAttribute("type");
if (type == "form") {
getPayloadInternal()->setType(Form::FormType);
@@ -191,15 +190,15 @@ void FormParser::handleEndElement(const std::string& element, const std::string&
else {
if (currentPages_.size() > 0) {
foreach (boost::shared_ptr<FormPage> page, currentPages_) {
- foreach (std::string pRef, page->getFieldRefs()) {
- if (pRef == currentField_->getName()) {
+ foreach (std::string pageRef, page->getFieldRefs()) {
+ if (pageRef == currentField_->getName()) {
page->addField(currentField_);
}
}
}
foreach (boost::shared_ptr<FormSection> section, currentSections_) {
- foreach (std::string sRef, section->getFieldRefs()) {
- if (sRef == currentField_->getName()) {
+ foreach (std::string sectionRef, section->getFieldRefs()) {
+ if (sectionRef == currentField_->getName()) {
section->addField(currentField_);
}
}
@@ -219,7 +218,7 @@ void FormParser::handleEndElement(const std::string& element, const std::string&
sectionStack_.pop_back();
}
else if (sectionStack_.size() == 1) {
- // Add the remaining section on the stack to it's parent page
+ // Add the remaining section on the stack to its parent page
currentPage_->addChildSection(sectionStack_.at(sectionStack_.size()-1));
sectionStack_.pop_back();
}
diff --git a/Swiften/Parser/PayloadParsers/FormParser.h b/Swiften/Parser/PayloadParsers/FormParser.h
index a3b7556..c8c2294 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.h
+++ b/Swiften/Parser/PayloadParsers/FormParser.h
@@ -32,7 +32,6 @@ namespace Swift {
bool parsingItem_;
bool parsingReported_;
bool parsingOption_;
- bool parseStarted_;
bool hasReportedRef_;
FormField::ref currentField_;
std::vector<FormField::ref> currentFields_;