summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/JingleContentPayload.h8
-rw-r--r--Swiften/Elements/JinglePayload.h8
-rw-r--r--Swiften/Elements/Stanza.cpp6
-rw-r--r--Swiften/Elements/Stanza.h8
4 files changed, 15 insertions, 15 deletions
diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h
index 286e08b..744ac09 100644
--- a/Swiften/Elements/JingleContentPayload.h
+++ b/Swiften/Elements/JingleContentPayload.h
@@ -72,8 +72,8 @@ namespace Swift {
template<typename T>
std::shared_ptr<T> getDescription() const {
- for (size_t i = 0; i < descriptions.size(); ++i) {
- std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(descriptions[i]));
+ for (const auto& description : descriptions) {
+ std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(description));
if (result) {
return result;
}
@@ -83,8 +83,8 @@ namespace Swift {
template<typename T>
std::shared_ptr<T> getTransport() const {
- for (size_t i = 0; i < transports.size(); ++i) {
- std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(transports[i]));
+ for (const auto& transport : transports) {
+ std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(transport));
if (result) {
return result;
}
diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h
index d1dfb44..a1e8500 100644
--- a/Swiften/Elements/JinglePayload.h
+++ b/Swiften/Elements/JinglePayload.h
@@ -124,8 +124,8 @@ namespace Swift {
template<typename T>
const std::vector<std::shared_ptr<T> > getPayloads() const {
std::vector<std::shared_ptr<T> > matched_payloads;
- for (std::vector<std::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) {
- std::shared_ptr<T> result = std::dynamic_pointer_cast<T>(*i);
+ for (const auto& payload : payloads) {
+ std::shared_ptr<T> result = std::dynamic_pointer_cast<T>(payload);
if (result) {
matched_payloads.push_back(result);
}
@@ -138,8 +138,8 @@ namespace Swift {
template<typename T>
const std::shared_ptr<T> getPayload() const {
std::shared_ptr<T> result;
- for (std::vector<std::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) {
- result = std::dynamic_pointer_cast<T>(*i);
+ for (const auto& payload : payloads) {
+ result = std::dynamic_pointer_cast<T>(payload);
if (result) {
return result;
}
diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp
index 5d1229c..f5a1b58 100644
--- a/Swiften/Elements/Stanza.cpp
+++ b/Swiften/Elements/Stanza.cpp
@@ -58,9 +58,9 @@ boost::optional<boost::posix_time::ptime> Stanza::getTimestamp() const {
boost::optional<boost::posix_time::ptime> Stanza::getTimestampFrom(const JID& jid) const {
std::vector< std::shared_ptr<Delay> > delays = getPayloads<Delay>();
- for (size_t i = 0; i < delays.size(); ++i) {
- if (delays[i]->getFrom() == jid) {
- return delays[i]->getStamp();
+ for (auto& delay : delays) {
+ if (delay->getFrom() == jid) {
+ return delay->getStamp();
}
}
return getTimestamp();
diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h
index 2df64a1..9a69696 100644
--- a/Swiften/Elements/Stanza.h
+++ b/Swiften/Elements/Stanza.h
@@ -33,8 +33,8 @@ namespace Swift {
template<typename T>
std::shared_ptr<T> getPayload() const {
- for (size_t i = 0; i < payloads_.size(); ++i) {
- std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payloads_[i]));
+ for (const auto& payload : payloads_) {
+ std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payload));
if (result) {
return result;
}
@@ -45,8 +45,8 @@ namespace Swift {
template<typename T>
std::vector< std::shared_ptr<T> > getPayloads() const {
std::vector< std::shared_ptr<T> > results;
- for (size_t i = 0; i < payloads_.size(); ++i) {
- std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payloads_[i]));
+ for (const auto& payload : payloads_) {
+ std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payload));
if (result) {
results.push_back(result);
}