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/PayloadParsers/JingleFileTransferFileInfoParser.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/PayloadParsers/JingleFileTransferFileInfoParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
index 51c13e9..4f8b9a9 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
@@ -14,66 +14,66 @@
namespace Swift {
-JingleFileTransferFileInfoParser::JingleFileTransferFileInfoParser() : level(0) {
+JingleFileTransferFileInfoParser::JingleFileTransferFileInfoParser() : level(0) {
}
template<typename T> boost::optional<T> safeLexicalCast(const std::string& str) {
- boost::optional<T> ret;
- try {
- ret = boost::lexical_cast<T>(str);
- } catch (boost::bad_lexical_cast &) {
+ boost::optional<T> ret;
+ try {
+ ret = boost::lexical_cast<T>(str);
+ } catch (boost::bad_lexical_cast &) {
- }
- return ret;
+ }
+ return ret;
}
void JingleFileTransferFileInfoParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- charData.clear();
- if (element == "hash") {
- hashAlg = attributes.getAttributeValue("algo").get_value_or("");
- }
- else if (element == "range") {
- rangeOffset = safeLexicalCast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or(""));
- }
+ charData.clear();
+ if (element == "hash") {
+ hashAlg = attributes.getAttributeValue("algo").get_value_or("");
+ }
+ else if (element == "range") {
+ rangeOffset = safeLexicalCast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or(""));
+ }
- ++level;
+ ++level;
}
void JingleFileTransferFileInfoParser::handleEndElement(const std::string& element, const std::string&) {
- --level;
- if (level == 1) {
- if (element == "date") {
- getPayloadInternal()->setDate(stringToDateTime(charData));
- }
- else if (element == "desc") {
- getPayloadInternal()->setDescription(charData);
- }
- else if (element == "media-type") {
- getPayloadInternal()->setMediaType(charData);
- }
- else if (element == "name") {
- getPayloadInternal()->setName(charData);
- }
- else if (element == "size") {
- boost::optional<boost::uintmax_t> size = safeLexicalCast<boost::uintmax_t>(charData);
- if (size) {
- getPayloadInternal()->setSize(size.get());
- }
- }
- else if (element == "range") {
- getPayloadInternal()->setSupportsRangeRequests(true);
- if (rangeOffset) {
- getPayloadInternal()->setRangeOffset(rangeOffset.get_value_or(0));
- }
- }
- else if (element == "hash") {
- getPayloadInternal()->addHash(HashElement(hashAlg, Base64::decode(charData)));
- }
- }
+ --level;
+ if (level == 1) {
+ if (element == "date") {
+ getPayloadInternal()->setDate(stringToDateTime(charData));
+ }
+ else if (element == "desc") {
+ getPayloadInternal()->setDescription(charData);
+ }
+ else if (element == "media-type") {
+ getPayloadInternal()->setMediaType(charData);
+ }
+ else if (element == "name") {
+ getPayloadInternal()->setName(charData);
+ }
+ else if (element == "size") {
+ boost::optional<boost::uintmax_t> size = safeLexicalCast<boost::uintmax_t>(charData);
+ if (size) {
+ getPayloadInternal()->setSize(size.get());
+ }
+ }
+ else if (element == "range") {
+ getPayloadInternal()->setSupportsRangeRequests(true);
+ if (rangeOffset) {
+ getPayloadInternal()->setRangeOffset(rangeOffset.get_value_or(0));
+ }
+ }
+ else if (element == "hash") {
+ getPayloadInternal()->addHash(HashElement(hashAlg, Base64::decode(charData)));
+ }
+ }
}
void JingleFileTransferFileInfoParser::handleCharacterData(const std::string& data) {
- charData += data;
+ charData += data;
}
}