summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2014-04-27 12:07:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2014-04-27 12:07:48 (GMT)
commit64511948b075e650cacfcc78e40371abee1d2716 (patch)
tree1a8e4a9232edddc182a14e29306a45176843a8bd
parent05f2ef44c2203317a6fc766cd0c5a9a1f241af23 (diff)
downloadswift-contrib-64511948b075e650cacfcc78e40371abee1d2716.zip
swift-contrib-64511948b075e650cacfcc78e40371abee1d2716.tar.bz2
Make stanza constructor protected
Change-Id: I417b35e0b76795aea97b677b8a33aa56f6b81c12
-rw-r--r--Swiften/Elements/Stanza.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h
index f1c9e00..e83f522 100644
--- a/Swiften/Elements/Stanza.h
+++ b/Swiften/Elements/Stanza.h
@@ -1,61 +1,64 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/optional/optional_fwd.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/Element.h>
#include <Swiften/JID/JID.h>
namespace Swift {
class Payload;
class SWIFTEN_API Stanza : public Element {
public:
typedef boost::shared_ptr<Stanza> ref;
+ protected:
Stanza();
+
+ public:
virtual ~Stanza();
SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza)
template<typename T>
boost::shared_ptr<T> getPayload() const {
for (size_t i = 0; i < payloads_.size(); ++i) {
boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i]));
if (result) {
return result;
}
}
return boost::shared_ptr<T>();
}
template<typename T>
std::vector< boost::shared_ptr<T> > getPayloads() const {
std::vector< boost::shared_ptr<T> > results;
for (size_t i = 0; i < payloads_.size(); ++i) {
boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i]));
if (result) {
results.push_back(result);
}
}
return results;
}
const std::vector< boost::shared_ptr<Payload> >& getPayloads() const {
return payloads_;
}
void addPayload(boost::shared_ptr<Payload> payload) {
payloads_.push_back(payload);
}