diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UserLocationParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UserLocationParser.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/Swiften/Parser/PayloadParsers/UserLocationParser.cpp b/Swiften/Parser/PayloadParsers/UserLocationParser.cpp index 4e98910..77a0fa1 100644 --- a/Swiften/Parser/PayloadParsers/UserLocationParser.cpp +++ b/Swiften/Parser/PayloadParsers/UserLocationParser.cpp @@ -19,88 +19,88 @@ UserLocationParser::~UserLocationParser() { } void UserLocationParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { - if (level == 1) { - currentText = ""; - } - ++level; + if (level == 1) { + currentText = ""; + } + ++level; } void UserLocationParser::handleEndElement(const std::string& element, const std::string&) { - --level; - if (level == 1) { - try { - if (element == "accuracy") { - getPayloadInternal()->setAccuracy(boost::lexical_cast<float>(currentText)); - } - else if (element == "alt") { - getPayloadInternal()->setAltitude(boost::lexical_cast<float>(currentText)); - } - else if (element == "area") { - getPayloadInternal()->setArea(currentText); - } - else if (element == "bearing") { - getPayloadInternal()->setBearing(boost::lexical_cast<float>(currentText)); - } - else if (element == "building") { - getPayloadInternal()->setBuilding(currentText); - } - else if (element == "country") { - getPayloadInternal()->setCountry(currentText); - } - else if (element == "countrycode") { - getPayloadInternal()->setCountryCode(currentText); - } - else if (element == "datum") { - getPayloadInternal()->setDatum(currentText); - } - else if (element == "description") { - getPayloadInternal()->setDescription(currentText); - } - else if (element == "error") { - getPayloadInternal()->setError(boost::lexical_cast<float>(currentText)); - } - else if (element == "floor") { - getPayloadInternal()->setFloor(currentText); - } - else if (element == "lat") { - getPayloadInternal()->setLatitude(boost::lexical_cast<float>(currentText)); - } - else if (element == "locality") { - getPayloadInternal()->setLocality(currentText); - } - else if (element == "lon") { - getPayloadInternal()->setLongitude(boost::lexical_cast<float>(currentText)); - } - else if (element == "postalcode") { - getPayloadInternal()->setPostalCode(currentText); - } - else if (element == "region") { - getPayloadInternal()->setRegion(currentText); - } - else if (element == "room") { - getPayloadInternal()->setRoom(currentText); - } - else if (element == "speed") { - getPayloadInternal()->setSpeed(boost::lexical_cast<float>(currentText)); - } - else if (element == "street") { - getPayloadInternal()->setStreet(currentText); - } - else if (element == "text") { - getPayloadInternal()->setText(currentText); - } - else if (element == "timestamp") { - getPayloadInternal()->setTimestamp(stringToDateTime(currentText)); - } - else if (element == "uri") { - getPayloadInternal()->setURI(currentText); - } - } - catch (const boost::bad_lexical_cast&) { - } - } + --level; + if (level == 1) { + try { + if (element == "accuracy") { + getPayloadInternal()->setAccuracy(boost::lexical_cast<float>(currentText)); + } + else if (element == "alt") { + getPayloadInternal()->setAltitude(boost::lexical_cast<float>(currentText)); + } + else if (element == "area") { + getPayloadInternal()->setArea(currentText); + } + else if (element == "bearing") { + getPayloadInternal()->setBearing(boost::lexical_cast<float>(currentText)); + } + else if (element == "building") { + getPayloadInternal()->setBuilding(currentText); + } + else if (element == "country") { + getPayloadInternal()->setCountry(currentText); + } + else if (element == "countrycode") { + getPayloadInternal()->setCountryCode(currentText); + } + else if (element == "datum") { + getPayloadInternal()->setDatum(currentText); + } + else if (element == "description") { + getPayloadInternal()->setDescription(currentText); + } + else if (element == "error") { + getPayloadInternal()->setError(boost::lexical_cast<float>(currentText)); + } + else if (element == "floor") { + getPayloadInternal()->setFloor(currentText); + } + else if (element == "lat") { + getPayloadInternal()->setLatitude(boost::lexical_cast<float>(currentText)); + } + else if (element == "locality") { + getPayloadInternal()->setLocality(currentText); + } + else if (element == "lon") { + getPayloadInternal()->setLongitude(boost::lexical_cast<float>(currentText)); + } + else if (element == "postalcode") { + getPayloadInternal()->setPostalCode(currentText); + } + else if (element == "region") { + getPayloadInternal()->setRegion(currentText); + } + else if (element == "room") { + getPayloadInternal()->setRoom(currentText); + } + else if (element == "speed") { + getPayloadInternal()->setSpeed(boost::lexical_cast<float>(currentText)); + } + else if (element == "street") { + getPayloadInternal()->setStreet(currentText); + } + else if (element == "text") { + getPayloadInternal()->setText(currentText); + } + else if (element == "timestamp") { + getPayloadInternal()->setTimestamp(stringToDateTime(currentText)); + } + else if (element == "uri") { + getPayloadInternal()->setURI(currentText); + } + } + catch (const boost::bad_lexical_cast&) { + } + } } void UserLocationParser::handleCharacterData(const std::string& data) { - currentText += data; + currentText += data; } |