diff options
Diffstat (limited to 'Swiften/Elements')
194 files changed, 6692 insertions, 6617 deletions
diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h index 8cfba19..0c43980 100644 --- a/Swiften/Elements/AuthChallenge.h +++ b/Swiften/Elements/AuthChallenge.h @@ -1,35 +1,36 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> #include <vector> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API AuthChallenge : public ToplevelElement { - public: - AuthChallenge() { - } + class SWIFTEN_API AuthChallenge : public ToplevelElement { + public: + AuthChallenge() { + } - AuthChallenge(const std::vector<unsigned char>& value) : value(value) { - } + AuthChallenge(const std::vector<unsigned char>& value) : value(value) { + } - const boost::optional< std::vector<unsigned char> >& getValue() const { - return value; - } + const boost::optional< std::vector<unsigned char> >& getValue() const { + return value; + } - void setValue(const std::vector<unsigned char>& value) { - this->value = boost::optional<std::vector<unsigned char> >(value); - } + void setValue(const std::vector<unsigned char>& value) { + this->value = boost::optional<std::vector<unsigned char> >(value); + } - private: - boost::optional< std::vector<unsigned char> > value; - }; + private: + boost::optional< std::vector<unsigned char> > value; + }; } diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h index e722d04..9546b0d 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -1,21 +1,21 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API AuthFailure : public ToplevelElement { - public: - typedef boost::shared_ptr<AuthFailure> ref; + class SWIFTEN_API AuthFailure : public ToplevelElement { + public: + typedef std::shared_ptr<AuthFailure> ref; - AuthFailure() {} - }; + AuthFailure() {} + }; } diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index 939a95a..33b25b4 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -1,51 +1,52 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> #include <string> +#include <vector> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API AuthRequest : public ToplevelElement { - public: - AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { - } - - AuthRequest(const std::string& mechanism, const SafeByteArray& message) : - mechanism_(mechanism), message_(message) { - } - - AuthRequest(const std::string& mechanism, const boost::optional<SafeByteArray>& message) : - mechanism_(mechanism), message_(message) { - } - - const boost::optional<SafeByteArray>& getMessage() const { - return message_; - } - - void setMessage(const SafeByteArray& message) { - message_ = boost::optional<SafeByteArray>(message); - } - - const std::string& getMechanism() const { - return mechanism_; - } - - void setMechanism(const std::string& mechanism) { - mechanism_ = mechanism; - } - - private: - std::string mechanism_; - boost::optional<SafeByteArray> message_; - }; + class SWIFTEN_API AuthRequest : public ToplevelElement { + public: + AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { + } + + AuthRequest(const std::string& mechanism, const SafeByteArray& message) : + mechanism_(mechanism), message_(message) { + } + + AuthRequest(const std::string& mechanism, const boost::optional<SafeByteArray>& message) : + mechanism_(mechanism), message_(message) { + } + + const boost::optional<SafeByteArray>& getMessage() const { + return message_; + } + + void setMessage(const SafeByteArray& message) { + message_ = boost::optional<SafeByteArray>(message); + } + + const std::string& getMechanism() const { + return mechanism_; + } + + void setMechanism(const std::string& mechanism) { + mechanism_ = mechanism; + } + + private: + std::string mechanism_; + boost::optional<SafeByteArray> message_; + }; } diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h index b1f4419..a88e8d0 100644 --- a/Swiften/Elements/AuthResponse.h +++ b/Swiften/Elements/AuthResponse.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,33 +7,34 @@ #pragma once #include <vector> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API AuthResponse : public ToplevelElement { - public: - AuthResponse() { - } + class SWIFTEN_API AuthResponse : public ToplevelElement { + public: + AuthResponse() { + } - AuthResponse(const SafeByteArray& value) : value(value) { - } + AuthResponse(const SafeByteArray& value) : value(value) { + } - AuthResponse(const boost::optional<SafeByteArray>& value) : value(value) { - } + AuthResponse(const boost::optional<SafeByteArray>& value) : value(value) { + } - const boost::optional<SafeByteArray>& getValue() const { - return value; - } + const boost::optional<SafeByteArray>& getValue() const { + return value; + } - void setValue(const SafeByteArray& value) { - this->value = boost::optional<SafeByteArray>(value); - } + void setValue(const SafeByteArray& value) { + this->value = boost::optional<SafeByteArray>(value); + } - private: - boost::optional<SafeByteArray> value; - }; + private: + boost::optional<SafeByteArray> value; + }; } diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h index 22c259d..860702c 100644 --- a/Swiften/Elements/AuthSuccess.h +++ b/Swiften/Elements/AuthSuccess.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,25 +7,26 @@ #pragma once #include <vector> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API AuthSuccess : public ToplevelElement { - public: - AuthSuccess() {} + class SWIFTEN_API AuthSuccess : public ToplevelElement { + public: + AuthSuccess() {} - const boost::optional<std::vector<unsigned char> >& getValue() const { - return value; - } + const boost::optional<std::vector<unsigned char> >& getValue() const { + return value; + } - void setValue(const std::vector<unsigned char>& value) { - this->value = boost::optional<std::vector<unsigned char> >(value); - } + void setValue(const std::vector<unsigned char>& value) { + this->value = boost::optional<std::vector<unsigned char> >(value); + } - private: - boost::optional<std::vector<unsigned char> > value; - }; + private: + boost::optional<std::vector<unsigned char> > value; + }; } diff --git a/Swiften/Elements/BlockListPayload.h b/Swiften/Elements/BlockListPayload.h index 93e738d..acc9df4 100644 --- a/Swiften/Elements/BlockListPayload.h +++ b/Swiften/Elements/BlockListPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,24 +9,24 @@ #include <vector> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API BlockListPayload : public Payload { - public: - BlockListPayload(const std::vector<JID>& items = std::vector<JID>()) : items(items) { - } + class SWIFTEN_API BlockListPayload : public Payload { + public: + BlockListPayload(const std::vector<JID>& items = std::vector<JID>()) : items(items) { + } - void addItem(const JID& item) { - items.push_back(item); - } + void addItem(const JID& item) { + items.push_back(item); + } - const std::vector<JID>& getItems() const { - return items; - } + const std::vector<JID>& getItems() const { + return items; + } - private: - std::vector<JID> items; - }; + private: + std::vector<JID> items; + }; } diff --git a/Swiften/Elements/BlockPayload.h b/Swiften/Elements/BlockPayload.h index 495c79b..df8d150 100644 --- a/Swiften/Elements/BlockPayload.h +++ b/Swiften/Elements/BlockPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,24 +9,24 @@ #include <vector> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API BlockPayload : public Payload { - public: - BlockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { - } + class SWIFTEN_API BlockPayload : public Payload { + public: + BlockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { + } - void addItem(const JID& jid) { - items.push_back(jid); - } + void addItem(const JID& jid) { + items.push_back(jid); + } - const std::vector<JID>& getItems() const { - return items; - } + const std::vector<JID>& getItems() const { + return items; + } - private: - std::vector<JID> items; - }; + private: + std::vector<JID> items; + }; } diff --git a/Swiften/Elements/Body.h b/Swiften/Elements/Body.h index fc7016f..8761d5a 100644 --- a/Swiften/Elements/Body.h +++ b/Swiften/Elements/Body.h @@ -12,20 +12,20 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Body : public Payload { - public: - Body(const std::string& text = "") : text_(text) { - } + class SWIFTEN_API Body : public Payload { + public: + Body(const std::string& text = "") : text_(text) { + } - void setText(const std::string& text) { - text_ = text; - } + void setText(const std::string& text) { + text_ = text; + } - const std::string& getText() const { - return text_; - } + const std::string& getText() const { + return text_; + } - private: - std::string text_; - }; + private: + std::string text_; + }; } diff --git a/Swiften/Elements/Bytestreams.h b/Swiften/Elements/Bytestreams.h index bc114a2..ca30922 100644 --- a/Swiften/Elements/Bytestreams.h +++ b/Swiften/Elements/Bytestreams.h @@ -1,62 +1,63 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> +#include <string> #include <vector> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <string> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API Bytestreams : public Payload { - public: - typedef boost::shared_ptr<Bytestreams> ref; + class SWIFTEN_API Bytestreams : public Payload { + public: + typedef std::shared_ptr<Bytestreams> ref; - struct StreamHost { - StreamHost(const std::string& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} + struct StreamHost { + StreamHost(const std::string& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} - std::string host; - JID jid; - int port; - }; + std::string host; + JID jid; + int port; + }; - Bytestreams() {} + Bytestreams() {} - const std::string& getStreamID() const { - return id; - } + const std::string& getStreamID() const { + return id; + } - void setStreamID(const std::string& id) { - this->id = id; - } + void setStreamID(const std::string& id) { + this->id = id; + } - const boost::optional<JID>& getUsedStreamHost() const { - return usedStreamHost; - } + const boost::optional<JID>& getUsedStreamHost() const { + return usedStreamHost; + } - void setUsedStreamHost(const JID& host) { - usedStreamHost = host; - } + void setUsedStreamHost(const JID& host) { + usedStreamHost = host; + } - const std::vector<StreamHost>& getStreamHosts() const { - return streamHosts; - } + const std::vector<StreamHost>& getStreamHosts() const { + return streamHosts; + } - void addStreamHost(const StreamHost& streamHost) { - streamHosts.push_back(streamHost); - } + void addStreamHost(const StreamHost& streamHost) { + streamHosts.push_back(streamHost); + } - private: - std::string id; - boost::optional<JID> usedStreamHost; - std::vector<StreamHost> streamHosts; - }; + private: + std::string id; + boost::optional<JID> usedStreamHost; + std::vector<StreamHost> streamHosts; + }; } diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h index bdfe342..d1e5103 100644 --- a/Swiften/Elements/CapsInfo.h +++ b/Swiften/Elements/CapsInfo.h @@ -1,60 +1,60 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CapsInfo : public Payload { - public: - typedef boost::shared_ptr<CapsInfo> ref; - - CapsInfo(const std::string& node = "", const std::string& version = "", const std::string& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} - - bool operator==(const CapsInfo& o) const { - return o.node_ == node_ && o.version_ == version_ && o.hash_ == hash_; - } - - bool operator<(const CapsInfo& o) const { - if (o.node_ == node_) { - if (o.version_ == version_) { - return hash_ < o.hash_; - } - else { - return version_ < o.version_; - } - } - else { - return node_ < o.node_; - } - } - - const std::string& getNode() const { return node_; } - void setNode(const std::string& node) { - node_ = node; - } - - const std::string& getVersion() const { return version_; } - void setVersion(const std::string& version) { - version_ = version; - } - - const std::string& getHash() const { return hash_; } - void setHash(const std::string& hash) { - hash_ = hash; - } - - private: - std::string node_; - std::string version_; - std::string hash_; - }; + class SWIFTEN_API CapsInfo : public Payload { + public: + typedef std::shared_ptr<CapsInfo> ref; + + CapsInfo(const std::string& node = "", const std::string& version = "", const std::string& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} + + bool operator==(const CapsInfo& o) const { + return o.node_ == node_ && o.version_ == version_ && o.hash_ == hash_; + } + + bool operator<(const CapsInfo& o) const { + if (o.node_ == node_) { + if (o.version_ == version_) { + return hash_ < o.hash_; + } + else { + return version_ < o.version_; + } + } + else { + return node_ < o.node_; + } + } + + const std::string& getNode() const { return node_; } + void setNode(const std::string& node) { + node_ = node; + } + + const std::string& getVersion() const { return version_; } + void setVersion(const std::string& version) { + version_ = version; + } + + const std::string& getHash() const { return hash_; } + void setHash(const std::string& hash) { + hash_ = hash; + } + + private: + std::string node_; + std::string version_; + std::string hash_; + }; } diff --git a/Swiften/Elements/CarbonsDisable.cpp b/Swiften/Elements/CarbonsDisable.cpp index b5d80ca..848fa92 100644 --- a/Swiften/Elements/CarbonsDisable.cpp +++ b/Swiften/Elements/CarbonsDisable.cpp @@ -7,6 +7,6 @@ #include <Swiften/Elements/CarbonsDisable.h> namespace Swift { - CarbonsDisable::~CarbonsDisable() { - } + CarbonsDisable::~CarbonsDisable() { + } } diff --git a/Swiften/Elements/CarbonsDisable.h b/Swiften/Elements/CarbonsDisable.h index e31526d..9526061 100644 --- a/Swiften/Elements/CarbonsDisable.h +++ b/Swiften/Elements/CarbonsDisable.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CarbonsDisable : public Payload { - public: - typedef boost::shared_ptr<CarbonsDisable> ref; + class SWIFTEN_API CarbonsDisable : public Payload { + public: + typedef std::shared_ptr<CarbonsDisable> ref; - public: - virtual ~CarbonsDisable(); - }; + public: + virtual ~CarbonsDisable(); + }; } diff --git a/Swiften/Elements/CarbonsEnable.cpp b/Swiften/Elements/CarbonsEnable.cpp index 7d38be1..c927cfb 100644 --- a/Swiften/Elements/CarbonsEnable.cpp +++ b/Swiften/Elements/CarbonsEnable.cpp @@ -7,6 +7,6 @@ #include <Swiften/Elements/CarbonsEnable.h> namespace Swift { - CarbonsEnable::~CarbonsEnable() { - } + CarbonsEnable::~CarbonsEnable() { + } } diff --git a/Swiften/Elements/CarbonsEnable.h b/Swiften/Elements/CarbonsEnable.h index b100e8d..bcb27a2 100644 --- a/Swiften/Elements/CarbonsEnable.h +++ b/Swiften/Elements/CarbonsEnable.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CarbonsEnable : public Payload { - public: - typedef boost::shared_ptr<CarbonsEnable> ref; + class SWIFTEN_API CarbonsEnable : public Payload { + public: + typedef std::shared_ptr<CarbonsEnable> ref; - public: - virtual ~CarbonsEnable(); - }; + public: + virtual ~CarbonsEnable(); + }; } diff --git a/Swiften/Elements/CarbonsPrivate.cpp b/Swiften/Elements/CarbonsPrivate.cpp index a0c6369..4ebcd31 100644 --- a/Swiften/Elements/CarbonsPrivate.cpp +++ b/Swiften/Elements/CarbonsPrivate.cpp @@ -7,6 +7,6 @@ #include <Swiften/Elements/CarbonsPrivate.h> namespace Swift { - CarbonsPrivate::~CarbonsPrivate() { - } + CarbonsPrivate::~CarbonsPrivate() { + } } diff --git a/Swiften/Elements/CarbonsPrivate.h b/Swiften/Elements/CarbonsPrivate.h index e363b5c..5cc25ff 100644 --- a/Swiften/Elements/CarbonsPrivate.h +++ b/Swiften/Elements/CarbonsPrivate.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CarbonsPrivate : public Payload { - public: - typedef boost::shared_ptr<CarbonsPrivate> ref; + class SWIFTEN_API CarbonsPrivate : public Payload { + public: + typedef std::shared_ptr<CarbonsPrivate> ref; - public: - virtual ~CarbonsPrivate(); - }; + public: + virtual ~CarbonsPrivate(); + }; } diff --git a/Swiften/Elements/CarbonsReceived.cpp b/Swiften/Elements/CarbonsReceived.cpp index d906f8e..7c233a3 100644 --- a/Swiften/Elements/CarbonsReceived.cpp +++ b/Swiften/Elements/CarbonsReceived.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,15 +7,15 @@ #include <Swiften/Elements/CarbonsReceived.h> namespace Swift { - CarbonsReceived::~CarbonsReceived() { + CarbonsReceived::~CarbonsReceived() { - } + } - void CarbonsReceived::setForwarded(boost::shared_ptr<Forwarded> forwarded) { - forwarded_ = forwarded; - } + void CarbonsReceived::setForwarded(std::shared_ptr<Forwarded> forwarded) { + forwarded_ = forwarded; + } - boost::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { - return forwarded_; - } + std::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { + return forwarded_; + } } diff --git a/Swiften/Elements/CarbonsReceived.h b/Swiften/Elements/CarbonsReceived.h index b057893..c33b600 100644 --- a/Swiften/Elements/CarbonsReceived.h +++ b/Swiften/Elements/CarbonsReceived.h @@ -1,28 +1,28 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Forwarded.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CarbonsReceived : public Payload { - public: - typedef boost::shared_ptr<CarbonsReceived> ref; + class SWIFTEN_API CarbonsReceived : public Payload { + public: + typedef std::shared_ptr<CarbonsReceived> ref; - public: - virtual ~CarbonsReceived(); - void setForwarded(boost::shared_ptr<Forwarded> forwarded); - boost::shared_ptr<Forwarded> getForwarded() const; + public: + virtual ~CarbonsReceived(); + void setForwarded(std::shared_ptr<Forwarded> forwarded); + std::shared_ptr<Forwarded> getForwarded() const; - private: - boost::shared_ptr<Forwarded> forwarded_; - }; + private: + std::shared_ptr<Forwarded> forwarded_; + }; } diff --git a/Swiften/Elements/CarbonsSent.cpp b/Swiften/Elements/CarbonsSent.cpp index 08b2e13..a026871 100644 --- a/Swiften/Elements/CarbonsSent.cpp +++ b/Swiften/Elements/CarbonsSent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,15 +7,15 @@ #include <Swiften/Elements/CarbonsSent.h> namespace Swift { - CarbonsSent::~CarbonsSent() { - - } + CarbonsSent::~CarbonsSent() { - void CarbonsSent::setForwarded(boost::shared_ptr<Forwarded> forwarded) { - forwarded_ = forwarded; - } + } - boost::shared_ptr<Forwarded> CarbonsSent::getForwarded() const { - return forwarded_; - } + void CarbonsSent::setForwarded(std::shared_ptr<Forwarded> forwarded) { + forwarded_ = forwarded; + } + + std::shared_ptr<Forwarded> CarbonsSent::getForwarded() const { + return forwarded_; + } } diff --git a/Swiften/Elements/CarbonsSent.h b/Swiften/Elements/CarbonsSent.h index f6b2b53..89739de 100644 --- a/Swiften/Elements/CarbonsSent.h +++ b/Swiften/Elements/CarbonsSent.h @@ -1,28 +1,28 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Forwarded.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API CarbonsSent : public Payload { - public: - typedef boost::shared_ptr<CarbonsSent> ref; + class SWIFTEN_API CarbonsSent : public Payload { + public: + typedef std::shared_ptr<CarbonsSent> ref; - public: - virtual ~CarbonsSent(); - void setForwarded(boost::shared_ptr<Forwarded> forwarded); - boost::shared_ptr<Forwarded> getForwarded() const; + public: + virtual ~CarbonsSent(); + void setForwarded(std::shared_ptr<Forwarded> forwarded); + std::shared_ptr<Forwarded> getForwarded() const; - private: - boost::shared_ptr<Forwarded> forwarded_; - }; + private: + std::shared_ptr<Forwarded> forwarded_; + }; } diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h index 5f0bb9b..4288398 100644 --- a/Swiften/Elements/ChatState.h +++ b/Swiften/Elements/ChatState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,20 +12,20 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API ChatState : public Payload { - public: - typedef boost::shared_ptr<ChatState> ref; + class SWIFTEN_API ChatState : public Payload { + public: + typedef std::shared_ptr<ChatState> ref; - public: - enum ChatStateType {Active, Composing, Paused, Inactive, Gone}; - ChatState(ChatStateType state = Active) { - state_ = state; - } + public: + enum ChatStateType {Active, Composing, Paused, Inactive, Gone}; + ChatState(ChatStateType state = Active) { + state_ = state; + } - ChatStateType getChatState() const { return state_; } - void setChatState(ChatStateType state) {state_ = state;} + ChatStateType getChatState() const { return state_; } + void setChatState(ChatStateType state) {state_ = state;} - private: - ChatStateType state_; - }; + private: + ChatStateType state_; + }; } diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h index 060037d..33aadd5 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -1,82 +1,82 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - /** - * Ad-Hoc Command (XEP-0050). - */ - class SWIFTEN_API Command : public Payload { - public: - typedef boost::shared_ptr<Command> ref; - - enum Status {Executing, Completed, Canceled, NoStatus}; - enum Action {Cancel, Execute, Complete, Prev, Next, NoAction}; - - struct Note { - enum Type {Info, Warn, Error}; - - Note(std::string note, Type type) : note(note), type(type) {} - - std::string note; - Type type; - }; - - public: - Command(const std::string& node, const std::string& sessionID, Status status) { constructor(node, sessionID, NoAction, status);} - Command(const std::string& node = "", const std::string& sessionID = "", Action action = Execute) { constructor(node, sessionID, action, NoStatus); } - - const std::string& getNode() const { return node_; } - void setNode(const std::string& node) { node_ = node; } - - const std::string& getSessionID() const { return sessionID_; } - void setSessionID(const std::string& id) { sessionID_ = id; } - - Action getAction() const { return action_; } - void setAction(Action action) { action_ = action; } - - void setExecuteAction(Action action) { executeAction_ = action; } - Action getExecuteAction() const { return executeAction_; } - - Status getStatus() const { return status_; } - void setStatus(Status status) { status_ = status; } - - void addAvailableAction(Action action) { availableActions_.push_back(action); } - const std::vector<Action>& getAvailableActions() const { return availableActions_; } - void addNote(const Note& note) { notes_.push_back(note); } - const std::vector<Note>& getNotes() const { return notes_; } - - Form::ref getForm() const { return form_; } - void setForm(Form::ref payload) { form_ = payload; } - - private: - void constructor(const std::string& node, const std::string& sessionID, Action action, Status status) { - node_ = node; - sessionID_ = sessionID; - action_ = action; - status_ = status; - executeAction_ = NoAction; - } - - private: - std::string node_; - std::string sessionID_; - Action action_; - Status status_; - Action executeAction_; - std::vector<Action> availableActions_; - std::vector<Note> notes_; - Form::ref form_; - }; + /** + * Ad-Hoc Command (XEP-0050). + */ + class SWIFTEN_API Command : public Payload { + public: + typedef std::shared_ptr<Command> ref; + + enum Status {Executing, Completed, Canceled, NoStatus}; + enum Action {Cancel, Execute, Complete, Prev, Next, NoAction}; + + struct Note { + enum Type {Info, Warn, Error}; + + Note(std::string note, Type type) : note(note), type(type) {} + + std::string note; + Type type; + }; + + public: + Command(const std::string& node, const std::string& sessionID, Status status) { constructor(node, sessionID, NoAction, status);} + Command(const std::string& node = "", const std::string& sessionID = "", Action action = Execute) { constructor(node, sessionID, action, NoStatus); } + + const std::string& getNode() const { return node_; } + void setNode(const std::string& node) { node_ = node; } + + const std::string& getSessionID() const { return sessionID_; } + void setSessionID(const std::string& id) { sessionID_ = id; } + + Action getAction() const { return action_; } + void setAction(Action action) { action_ = action; } + + void setExecuteAction(Action action) { executeAction_ = action; } + Action getExecuteAction() const { return executeAction_; } + + Status getStatus() const { return status_; } + void setStatus(Status status) { status_ = status; } + + void addAvailableAction(Action action) { availableActions_.push_back(action); } + const std::vector<Action>& getAvailableActions() const { return availableActions_; } + void addNote(const Note& note) { notes_.push_back(note); } + const std::vector<Note>& getNotes() const { return notes_; } + + Form::ref getForm() const { return form_; } + void setForm(Form::ref payload) { form_ = payload; } + + private: + void constructor(const std::string& node, const std::string& sessionID, Action action, Status status) { + node_ = node; + sessionID_ = sessionID; + action_ = action; + status_ = status; + executeAction_ = NoAction; + } + + private: + std::string node_; + std::string sessionID_; + Action action_; + Status status_; + Action executeAction_; + std::vector<Action> availableActions_; + std::vector<Note> notes_; + Form::ref form_; + }; } diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index f19c488..4d6d059 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -1,34 +1,34 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API ComponentHandshake : public ToplevelElement { - public: - typedef boost::shared_ptr<ComponentHandshake> ref; + class SWIFTEN_API ComponentHandshake : public ToplevelElement { + public: + typedef std::shared_ptr<ComponentHandshake> ref; - ComponentHandshake(const std::string& data = "") : data(data) { - } + ComponentHandshake(const std::string& data = "") : data(data) { + } - void setData(const std::string& d) { - data = d; - } + void setData(const std::string& d) { + data = d; + } - const std::string& getData() const { - return data; - } + const std::string& getData() const { + return data; + } - private: - std::string data; - }; + private: + std::string data; + }; } diff --git a/Swiften/Elements/CompressFailure.h b/Swiften/Elements/CompressFailure.h index a32ba27..8cdd268 100644 --- a/Swiften/Elements/CompressFailure.h +++ b/Swiften/Elements/CompressFailure.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API CompressFailure : public ToplevelElement { - public: - CompressFailure() {} - }; + class SWIFTEN_API CompressFailure : public ToplevelElement { + public: + CompressFailure() {} + }; } diff --git a/Swiften/Elements/CompressRequest.h b/Swiften/Elements/CompressRequest.h index 1c3fb39..7e813b9 100644 --- a/Swiften/Elements/CompressRequest.h +++ b/Swiften/Elements/CompressRequest.h @@ -12,20 +12,20 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API CompressRequest : public ToplevelElement - { - public: - CompressRequest(const std::string& method = "") : method_(method) {} + class SWIFTEN_API CompressRequest : public ToplevelElement + { + public: + CompressRequest(const std::string& method = "") : method_(method) {} - const std::string& getMethod() const { - return method_; - } + const std::string& getMethod() const { + return method_; + } - void setMethod(const std::string& method) { - method_ = method; - } + void setMethod(const std::string& method) { + method_ = method; + } - private: - std::string method_; - }; + private: + std::string method_; + }; } diff --git a/Swiften/Elements/Compressed.h b/Swiften/Elements/Compressed.h index bcfcacc..a2e236f 100644 --- a/Swiften/Elements/Compressed.h +++ b/Swiften/Elements/Compressed.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API Compressed : public ToplevelElement { - public: - Compressed() {} - }; + class SWIFTEN_API Compressed : public ToplevelElement { + public: + Compressed() {} + }; } diff --git a/Swiften/Elements/ContainerPayload.h b/Swiften/Elements/ContainerPayload.h index 0ca073c..3da04b7 100644 --- a/Swiften/Elements/ContainerPayload.h +++ b/Swiften/Elements/ContainerPayload.h @@ -1,33 +1,34 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <memory> +#include <vector> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> -#include <vector> namespace Swift { - template<typename T> - class SWIFTEN_API ContainerPayload : public Payload { - public: - ContainerPayload() {} - ContainerPayload(boost::shared_ptr<T> payload) : payload(payload) {} + template<typename T> + class SWIFTEN_API ContainerPayload : public Payload { + public: + ContainerPayload() {} + ContainerPayload(std::shared_ptr<T> payload) : payload(payload) {} + + void setPayload(std::shared_ptr<T> payload) { + this->payload = payload; + } - void setPayload(boost::shared_ptr<T> payload) { - this->payload = payload; - } - - boost::shared_ptr<T> getPayload() const { - return payload; - } + std::shared_ptr<T> getPayload() const { + return payload; + } - private: - boost::shared_ptr<T> payload; - }; + private: + std::shared_ptr<T> payload; + }; } diff --git a/Swiften/Elements/Delay.h b/Swiften/Elements/Delay.h index 2cfb1d0..b154dea 100644 --- a/Swiften/Elements/Delay.h +++ b/Swiften/Elements/Delay.h @@ -14,19 +14,19 @@ #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API Delay : public Payload { - public: - Delay() {} - Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {} + class SWIFTEN_API Delay : public Payload { + public: + Delay() {} + Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {} - const boost::posix_time::ptime& getStamp() const {return time_;} - void setStamp(const boost::posix_time::ptime& time) {time_ = time;} + const boost::posix_time::ptime& getStamp() const {return time_;} + void setStamp(const boost::posix_time::ptime& time) {time_ = time;} - const boost::optional<JID>& getFrom() const {return from_;} - void setFrom(const JID& from) {from_ = from;} + const boost::optional<JID>& getFrom() const {return from_;} + void setFrom(const JID& from) {from_ = from;} - private: - boost::posix_time::ptime time_; - boost::optional<JID> from_; - }; + private: + boost::posix_time::ptime time_; + boost::optional<JID> from_; + }; } diff --git a/Swiften/Elements/DeliveryReceipt.h b/Swiften/Elements/DeliveryReceipt.h index eac5280..238485d 100644 --- a/Swiften/Elements/DeliveryReceipt.h +++ b/Swiften/Elements/DeliveryReceipt.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,24 +20,24 @@ namespace Swift { class SWIFTEN_API DeliveryReceipt : public Payload { - public: - typedef boost::shared_ptr<DeliveryReceipt> ref; + public: + typedef std::shared_ptr<DeliveryReceipt> ref; - public: - DeliveryReceipt() {} + public: + DeliveryReceipt() {} - DeliveryReceipt(const std::string& msgId) : receivedID_(msgId) {} + DeliveryReceipt(const std::string& msgId) : receivedID_(msgId) {} - void setReceivedID(const std::string& msgId) { - receivedID_ = msgId; - } + void setReceivedID(const std::string& msgId) { + receivedID_ = msgId; + } - std::string getReceivedID() const { - return receivedID_; - } + std::string getReceivedID() const { + return receivedID_; + } - private: - std::string receivedID_; + private: + std::string receivedID_; }; } diff --git a/Swiften/Elements/DeliveryReceiptRequest.h b/Swiften/Elements/DeliveryReceiptRequest.h index 1f03c5a..9a7d478 100644 --- a/Swiften/Elements/DeliveryReceiptRequest.h +++ b/Swiften/Elements/DeliveryReceiptRequest.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,11 +18,11 @@ namespace Swift { class SWIFTEN_API DeliveryReceiptRequest : public Payload { - public: - typedef boost::shared_ptr<DeliveryReceiptRequest> ref; + public: + typedef std::shared_ptr<DeliveryReceiptRequest> ref; - public: - DeliveryReceiptRequest() {} + public: + DeliveryReceiptRequest() {} }; } diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index 84f5ed3..51a4450 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -24,28 +24,29 @@ const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protoco const std::string DiscoInfo::MessageDeliveryReceiptsFeature = std::string("urn:xmpp:receipts"); const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/whiteboard"); const std::string DiscoInfo::BlockingCommandFeature = std::string("urn:xmpp:blocking"); +const std::string DiscoInfo::MessageCarbonsFeature = std::string("urn:xmpp:carbons:2"); bool DiscoInfo::Identity::operator<(const Identity& other) const { - if (category_ == other.category_) { - if (type_ == other.type_) { - if (lang_ == other.lang_) { - return name_ < other.name_; - } - else { - return lang_ < other.lang_; - } - } - else { - return type_ < other.type_; - } - } - else { - return category_ < other.category_; - } + if (category_ == other.category_) { + if (type_ == other.type_) { + if (lang_ == other.lang_) { + return name_ < other.name_; + } + else { + return lang_ < other.lang_; + } + } + else { + return type_ < other.type_; + } + } + else { + return category_ < other.category_; + } } bool DiscoInfo::hasFeature(const std::string& feature) const { - return std::find(features_.begin(), features_.end(), feature) != features_.end(); + return std::find(features_.begin(), features_.end(), feature) != features_.end(); } } diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index 4019b2e..ebc598c 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -1,113 +1,114 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> #include <string> +#include <vector> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - /** - * disco#info from XEP-0030 - */ - class SWIFTEN_API DiscoInfo : public Payload { - public: - typedef boost::shared_ptr<DiscoInfo> ref; - - static const std::string ChatStatesFeature; - static const std::string SecurityLabelsFeature; - static const std::string SecurityLabelsCatalogFeature; - static const std::string JabberSearchFeature; - static const std::string CommandsFeature; - static const std::string MessageCorrectionFeature; - static const std::string JingleFeature; - static const std::string JingleFTFeature; - static const std::string JingleTransportsIBBFeature; - static const std::string JingleTransportsS5BFeature; - static const std::string Bytestream; - static const std::string MessageDeliveryReceiptsFeature; - static const std::string WhiteboardFeature; - static const std::string BlockingCommandFeature; - - class Identity { - public: - Identity(const std::string& name, const std::string& category = "client", const std::string& type = "pc", const std::string& lang = "") : name_(name), category_(category), type_(type), lang_(lang) { - } - - const std::string& getCategory() const { - return category_; - } - - const std::string& getType() const { - return type_; - } - - const std::string& getLanguage() const { - return lang_; - } - - const std::string& getName() const { - return name_; - } - - // Sorted according to XEP-115 rules - bool operator<(const Identity& other) const; - - private: - std::string name_; - std::string category_; - std::string type_; - std::string lang_; - }; - - DiscoInfo() { - } - - const std::string& getNode() const { - return node_; - } - - void setNode(const std::string& node) { - node_ = node; - } - - const std::vector<Identity>& getIdentities() const { - return identities_; - } - - void addIdentity(const Identity& identity) { - identities_.push_back(identity); - } - - const std::vector<std::string>& getFeatures() const { - return features_; - } - - void addFeature(const std::string& feature) { - features_.push_back(feature); - } - - bool hasFeature(const std::string& feature) const; - - void addExtension(Form::ref form) { - extensions_.push_back(form); - } - - const std::vector<Form::ref>& getExtensions() const { - return extensions_; - } - - private: - std::string node_; - std::vector<Identity> identities_; - std::vector<std::string> features_; - std::vector<Form::ref> extensions_; - }; + /** + * disco#info from XEP-0030 + */ + class SWIFTEN_API DiscoInfo : public Payload { + public: + typedef std::shared_ptr<DiscoInfo> ref; + + static const std::string ChatStatesFeature; + static const std::string SecurityLabelsFeature; + static const std::string SecurityLabelsCatalogFeature; + static const std::string JabberSearchFeature; + static const std::string CommandsFeature; + static const std::string MessageCorrectionFeature; + static const std::string JingleFeature; + static const std::string JingleFTFeature; + static const std::string JingleTransportsIBBFeature; + static const std::string JingleTransportsS5BFeature; + static const std::string Bytestream; + static const std::string MessageDeliveryReceiptsFeature; + static const std::string WhiteboardFeature; + static const std::string BlockingCommandFeature; + static const std::string MessageCarbonsFeature; + + class Identity { + public: + Identity(const std::string& name, const std::string& category = "client", const std::string& type = "pc", const std::string& lang = "") : name_(name), category_(category), type_(type), lang_(lang) { + } + + const std::string& getCategory() const { + return category_; + } + + const std::string& getType() const { + return type_; + } + + const std::string& getLanguage() const { + return lang_; + } + + const std::string& getName() const { + return name_; + } + + // Sorted according to XEP-115 rules + bool operator<(const Identity& other) const; + + private: + std::string name_; + std::string category_; + std::string type_; + std::string lang_; + }; + + DiscoInfo() { + } + + const std::string& getNode() const { + return node_; + } + + void setNode(const std::string& node) { + node_ = node; + } + + const std::vector<Identity>& getIdentities() const { + return identities_; + } + + void addIdentity(const Identity& identity) { + identities_.push_back(identity); + } + + const std::vector<std::string>& getFeatures() const { + return features_; + } + + void addFeature(const std::string& feature) { + features_.push_back(feature); + } + + bool hasFeature(const std::string& feature) const; + + void addExtension(Form::ref form) { + extensions_.push_back(form); + } + + const std::vector<Form::ref>& getExtensions() const { + return extensions_; + } + + private: + std::string node_; + std::vector<Identity> identities_; + std::vector<std::string> features_; + std::vector<Form::ref> extensions_; + }; } diff --git a/Swiften/Elements/DiscoItems.h b/Swiften/Elements/DiscoItems.h index 1084f2b..9c06b8d 100644 --- a/Swiften/Elements/DiscoItems.h +++ b/Swiften/Elements/DiscoItems.h @@ -1,71 +1,71 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> #include <string> +#include <vector> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> namespace Swift { - /** - * Service discovery disco#items from XEP-0030. - */ - class SWIFTEN_API DiscoItems : public Payload { - public: - /** - * A single result item. - */ - class Item { - public: - Item(const std::string& name, const JID& jid, const std::string& node="") : name_(name), jid_(jid), node_(node) { - } + /** + * Service discovery disco#items from XEP-0030. + */ + class SWIFTEN_API DiscoItems : public Payload { + public: + /** + * A single result item. + */ + class Item { + public: + Item(const std::string& name, const JID& jid, const std::string& node="") : name_(name), jid_(jid), node_(node) { + } - const std::string& getName() const { - return name_; - } + const std::string& getName() const { + return name_; + } - const std::string& getNode() const { - return node_; - } + const std::string& getNode() const { + return node_; + } - const JID& getJID() const { - return jid_; - } + const JID& getJID() const { + return jid_; + } - private: - std::string name_; - JID jid_; - std::string node_; - }; + private: + std::string name_; + JID jid_; + std::string node_; + }; - DiscoItems() { - } + DiscoItems() { + } - const std::string& getNode() const { - return node_; - } + const std::string& getNode() const { + return node_; + } - void setNode(const std::string& node) { - node_ = node; - } + void setNode(const std::string& node) { + node_ = node; + } - const std::vector<Item>& getItems() const { - return items_; - } + const std::vector<Item>& getItems() const { + return items_; + } - void addItem(const Item& item) { - items_.push_back(item); - } + void addItem(const Item& item) { + items_.push_back(item); + } - private: - std::string node_; - std::vector<Item> items_; - }; + private: + std::string node_; + std::vector<Item> items_; + }; } diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/Element.h index 3cd5f94..b036a29 100644 --- a/Swiften/Elements/Element.h +++ b/Swiften/Elements/Element.h @@ -9,12 +9,12 @@ #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API Element { - public: - Element() {} - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Element) - virtual ~Element(); + class SWIFTEN_API Element { + public: + Element() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Element) + virtual ~Element(); - SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Element) - }; + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Element) + }; } diff --git a/Swiften/Elements/EnableStreamManagement.h b/Swiften/Elements/EnableStreamManagement.h index ef09f79..bf867e2 100644 --- a/Swiften/Elements/EnableStreamManagement.h +++ b/Swiften/Elements/EnableStreamManagement.h @@ -1,17 +1,17 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/API.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API EnableStreamManagement : public ToplevelElement { - public: - EnableStreamManagement() {} - }; + class SWIFTEN_API EnableStreamManagement : public ToplevelElement { + public: + EnableStreamManagement() {} + }; } diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h index 27f4249..0269e4d 100644 --- a/Swiften/Elements/ErrorPayload.h +++ b/Swiften/Elements/ErrorPayload.h @@ -1,87 +1,87 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API ErrorPayload : public Payload { - public: - typedef boost::shared_ptr<ErrorPayload> ref; - - enum Type { Cancel, Continue, Modify, Auth, Wait }; - - enum Condition { - BadRequest, - Conflict, - FeatureNotImplemented, - Forbidden, - Gone, - InternalServerError, - ItemNotFound, - JIDMalformed, - NotAcceptable, - NotAllowed, - NotAuthorized, - PaymentRequired, - RecipientUnavailable, - Redirect, - RegistrationRequired, - RemoteServerNotFound, - RemoteServerTimeout, - ResourceConstraint, - ServiceUnavailable, - SubscriptionRequired, - UndefinedCondition, - UnexpectedRequest - }; - - ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const std::string& text = std::string()) : type_(type), condition_(condition), text_(text) { } - - Type getType() const { - return type_; - } - - void setType(Type type) { - type_ = type; - } - - Condition getCondition() const { - return condition_; - } - - void setCondition(Condition condition) { - condition_ = condition; - } - - void setText(const std::string& text) { - text_ = text; - } - - const std::string& getText() const { - return text_; - } - - void setPayload(boost::shared_ptr<Payload> payload) { - payload_ = payload; - } - - boost::shared_ptr<Payload> getPayload() const { - return payload_; - } - - private: - Type type_; - Condition condition_; - std::string text_; - boost::shared_ptr<Payload> payload_; - }; + class SWIFTEN_API ErrorPayload : public Payload { + public: + typedef std::shared_ptr<ErrorPayload> ref; + + enum Type { Cancel, Continue, Modify, Auth, Wait }; + + enum Condition { + BadRequest, + Conflict, + FeatureNotImplemented, + Forbidden, + Gone, + InternalServerError, + ItemNotFound, + JIDMalformed, + NotAcceptable, + NotAllowed, + NotAuthorized, + PaymentRequired, + RecipientUnavailable, + Redirect, + RegistrationRequired, + RemoteServerNotFound, + RemoteServerTimeout, + ResourceConstraint, + ServiceUnavailable, + SubscriptionRequired, + UndefinedCondition, + UnexpectedRequest + }; + + ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const std::string& text = std::string()) : type_(type), condition_(condition), text_(text) { } + + Type getType() const { + return type_; + } + + void setType(Type type) { + type_ = type; + } + + Condition getCondition() const { + return condition_; + } + + void setCondition(Condition condition) { + condition_ = condition; + } + + void setText(const std::string& text) { + text_ = text; + } + + const std::string& getText() const { + return text_; + } + + void setPayload(std::shared_ptr<Payload> payload) { + payload_ = payload; + } + + std::shared_ptr<Payload> getPayload() const { + return payload_; + } + + private: + Type type_; + Condition condition_; + std::string text_; + std::shared_ptr<Payload> payload_; + }; } diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp index b24afea..dc4bd72 100644 --- a/Swiften/Elements/Form.cpp +++ b/Swiften/Elements/Form.cpp @@ -1,65 +1,64 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/Form.h> -#include <Swiften/Base/foreach.h> namespace Swift { std::string Form::getFormType() const { - FormField::ref field = getField("FORM_TYPE"); - if (field && field->getType() == FormField::HiddenType) { - return field->getValues().empty() ? "" : field->getValues()[0]; - } - return ""; + FormField::ref field = getField("FORM_TYPE"); + if (field && field->getType() == FormField::HiddenType) { + return field->getValues().empty() ? "" : field->getValues()[0]; + } + return ""; } FormField::ref Form::getField(const std::string& name) const { - foreach(FormField::ref field, fields_) { - if (field->getName() == name) { - return field; - } - } - return FormField::ref(); + for (const auto& field : fields_) { + if (field->getName() == name) { + return field; + } + } + return FormField::ref(); } void Form::addReportedField(FormField::ref field) { - reportedFields_.push_back(field); + reportedFields_.push_back(field); } const std::vector<FormField::ref>& Form::getReportedFields() const { - return reportedFields_; + return reportedFields_; } void Form::addItem(const Form::FormItem& item) { - items_.push_back(item); + items_.push_back(item); } const std::vector<Form::FormItem>& Form::getItems() const { - return items_; + return items_; } void Form::clearEmptyTextFields() { - std::vector<FormField::ref> populatedFields; - foreach (FormField::ref field, fields_) { - if (field->getType() == FormField::TextSingleType) { - if (!field->getTextSingleValue().empty()) { - populatedFields.push_back(field); - } - } - else if (field->getType() == FormField::TextMultiType) { - if (!field->getTextMultiValue().empty()) { - populatedFields.push_back(field); - } - } - else { - populatedFields.push_back(field); - } - } - fields_ = populatedFields; + std::vector<FormField::ref> populatedFields; + for (const auto& field : fields_) { + if (field->getType() == FormField::TextSingleType) { + if (!field->getTextSingleValue().empty()) { + populatedFields.push_back(field); + } + } + else if (field->getType() == FormField::TextMultiType) { + if (!field->getTextMultiValue().empty()) { + populatedFields.push_back(field); + } + } + else { + populatedFields.push_back(field); + } + } + fields_ = populatedFields; } } diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index c1d7a5b..899fb93 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -1,123 +1,124 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> +#include <cassert> #include <string> +#include <vector> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/FormField.h> #include <Swiften/Elements/FormPage.h> #include <Swiften/Elements/FormSection.h> -#include <Swiften/Elements/FormField.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> namespace Swift { - /** - * XEP-0004 Data form. - * For the relevant Fields, the parsers and serialisers protect the API user against - * the strange multi-value instead of newline thing by transforming them. - */ - class SWIFTEN_API Form : public Payload { - public: - typedef boost::shared_ptr<Form> ref; - typedef std::vector<FormField::ref> FormItem; - - enum Type { FormType, SubmitType, CancelType, ResultType }; - - public: - Form(Type type = FormType) : type_(type) {} - - void addPage(boost::shared_ptr<FormPage> page) { - assert(page); - pages_.push_back(page); - } - - const std::vector<boost::shared_ptr<FormPage> >& getPages() const { - return pages_; - } - - void addField(boost::shared_ptr<FormField> field) { - assert(field); - fields_.push_back(field); - } - - const std::vector<boost::shared_ptr<FormField> >& getFields() const { - return fields_; - } - - void clearFields() { - fields_.clear(); - } - - void addTextElement(boost::shared_ptr<FormText> text) { - assert(text); - textElements_.push_back(text); - } - - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const { - return textElements_; - } - - void addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { - assert(reportedRef); - reportedRefs_.push_back(reportedRef); - } - - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const { - return reportedRefs_; - } - - void setTitle(const std::string& title) { - title_ = title; - } - - const std::string& getTitle() const { - return title_; - } - - void setInstructions(const std::string& instructions) { - instructions_ = instructions; - } - - const std::string& getInstructions() const { - return instructions_; - } - - Type getType() const { - return type_; - } - - void setType(Type type) { - type_ = type; - } - - std::string getFormType() const; - FormField::ref getField(const std::string& name) const; - void addItem(const FormItem& item); - const std::vector<FormItem>& getItems() const; - void clearItems() { items_.clear(); } - - void clearEmptyTextFields(); - - void addReportedField(FormField::ref field); - const std::vector<FormField::ref> & getReportedFields() const; - void clearReportedFields() { reportedFields_.clear(); } - - private: - std::vector<boost::shared_ptr<FormReportedRef> >reportedRefs_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormPage> > pages_; - std::vector<boost::shared_ptr<FormField> > fields_; - std::vector<boost::shared_ptr<FormField> > reportedFields_; - std::vector<FormItem> items_; - boost::shared_ptr<FormReportedRef> reportedRef_; - std::string title_; - std::string instructions_; - Type type_; - }; + /** + * XEP-0004 Data form. + * For the relevant Fields, the parsers and serialisers protect the API user against + * the strange multi-value instead of newline thing by transforming them. + */ + class SWIFTEN_API Form : public Payload { + public: + typedef std::shared_ptr<Form> ref; + typedef std::vector<FormField::ref> FormItem; + + enum Type { FormType, SubmitType, CancelType, ResultType }; + + public: + Form(Type type = FormType) : type_(type) {} + + void addPage(std::shared_ptr<FormPage> page) { + assert(page); + pages_.push_back(page); + } + + const std::vector<std::shared_ptr<FormPage> >& getPages() const { + return pages_; + } + + void addField(std::shared_ptr<FormField> field) { + assert(field); + fields_.push_back(field); + } + + const std::vector<std::shared_ptr<FormField> >& getFields() const { + return fields_; + } + + void clearFields() { + fields_.clear(); + } + + void addTextElement(std::shared_ptr<FormText> text) { + assert(text); + textElements_.push_back(text); + } + + const std::vector<std::shared_ptr<FormText> >& getTextElements() const { + return textElements_; + } + + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { + assert(reportedRef); + reportedRefs_.push_back(reportedRef); + } + + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const { + return reportedRefs_; + } + + void setTitle(const std::string& title) { + title_ = title; + } + + const std::string& getTitle() const { + return title_; + } + + void setInstructions(const std::string& instructions) { + instructions_ = instructions; + } + + const std::string& getInstructions() const { + return instructions_; + } + + Type getType() const { + return type_; + } + + void setType(Type type) { + type_ = type; + } + + std::string getFormType() const; + FormField::ref getField(const std::string& name) const; + void addItem(const FormItem& item); + const std::vector<FormItem>& getItems() const; + void clearItems() { items_.clear(); } + + void clearEmptyTextFields(); + + void addReportedField(FormField::ref field); + const std::vector<FormField::ref> & getReportedFields() const; + void clearReportedFields() { reportedFields_.clear(); } + + private: + std::vector<std::shared_ptr<FormReportedRef> >reportedRefs_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormPage> > pages_; + std::vector<std::shared_ptr<FormField> > fields_; + std::vector<std::shared_ptr<FormField> > reportedFields_; + std::vector<FormItem> items_; + std::shared_ptr<FormReportedRef> reportedRef_; + std::string title_; + std::string instructions_; + Type type_; + }; } diff --git a/Swiften/Elements/FormField.cpp b/Swiften/Elements/FormField.cpp index 870672c..d4bc9f4 100644 --- a/Swiften/Elements/FormField.cpp +++ b/Swiften/Elements/FormField.cpp @@ -1,14 +1,14 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/FormField.h> -#include <boost/algorithm/string/split.hpp> -#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/join.hpp> +#include <boost/algorithm/string/split.hpp> using namespace Swift; @@ -16,17 +16,17 @@ FormField::~FormField() { } std::string FormField::getTextMultiValue() const { - assert(type == TextMultiType || type == UnknownType); - return boost::algorithm::join(values, "\n"); + assert(type == TextMultiType || type == UnknownType); + return boost::algorithm::join(values, "\n"); } void FormField::setTextMultiValue(const std::string& value) { - assert(type == TextMultiType || type == UnknownType); - values.clear(); - boost::split(values, value, boost::is_any_of("\n")); + assert(type == TextMultiType || type == UnknownType); + values.clear(); + boost::split(values, value, boost::is_any_of("\n")); } void FormField::setBoolValue(bool b) { - values.clear(); - values.push_back(b ? "1" : "0"); + values.clear(); + values.push_back(b ? "1" : "0"); } diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h index a8649fb..194589c 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -1,139 +1,140 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> -#include <boost/shared_ptr.hpp> +#include <cassert> +#include <memory> #include <string> +#include <vector> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API FormField { - public: - typedef boost::shared_ptr<FormField> ref; - - enum Type { - UnknownType, - BooleanType, - FixedType, - HiddenType, - ListSingleType, - TextMultiType, - TextPrivateType, - TextSingleType, - JIDSingleType, - JIDMultiType, - ListMultiType - }; - - FormField(Type type = UnknownType) : type(type), required(false) {} - FormField(Type type, const std::string& value) : type(type), required(false) { - addValue(value); - } - virtual ~FormField(); - - struct Option { - Option(const std::string& label, const std::string& value) : label(label), value(value) {} - std::string label; - std::string value; - }; - - void setName(const std::string& name) { this->name = name; } - const std::string& getName() const { return name; } - - void setLabel(const std::string& label) { this->label = label; } - const std::string& getLabel() const { return label; } - - void setDescription(const std::string& description) { this->description = description; } - const std::string& getDescription() const { return description; } - - void setRequired(bool required) { this->required = required; } - bool getRequired() const { return required; } - - void addOption(const Option& option) { - options.push_back(option); - } - - const std::vector<Option>& getOptions() const { - return options; - } - - void clearOptions() { - options.clear(); - } - - const std::vector<std::string>& getValues() const { - return values; - } - - void addValue(const std::string& value) { - values.push_back(value); - } - - Type getType() const { - return type; - } - - void setType(Type type) { - this->type = type; - } - - // Type specific - - bool getBoolValue() const { - assert(type == BooleanType || type == UnknownType); - if (values.empty()) { - return false; - } - return values[0] == "true" || values[0] == "1"; - } - - void setBoolValue(bool b); - - JID getJIDSingleValue() const { - assert(type == JIDSingleType || type == UnknownType); - return values.empty() ? JID() : JID(values[0]); - } - - JID getJIDMultiValue(size_t index) const { - assert(type == JIDMultiType || type == UnknownType); - return values.empty() ? JID() : JID(values[index]); - } - - std::string getTextPrivateValue() const { - assert(type == TextPrivateType || type == UnknownType); - return values.empty() ? "" : values[0]; - } - - std::string getFixedValue() const { - assert(type == FixedType || type == UnknownType); - return values.empty() ? "" : values[0]; - } - - std::string getTextSingleValue() const { - assert(type == TextSingleType || type == UnknownType); - return values.empty() ? "" : values[0]; - } - - std::string getTextMultiValue() const; - void setTextMultiValue(const std::string& value); - - protected: - - private: - Type type; - std::string name; - std::string label; - std::string description; - bool required; - std::vector<Option> options; - std::vector<std::string> values; - }; + class SWIFTEN_API FormField { + public: + typedef std::shared_ptr<FormField> ref; + + enum Type { + UnknownType, + BooleanType, + FixedType, + HiddenType, + ListSingleType, + TextMultiType, + TextPrivateType, + TextSingleType, + JIDSingleType, + JIDMultiType, + ListMultiType + }; + + FormField(Type type = UnknownType) : type(type), required(false) {} + FormField(Type type, const std::string& value) : type(type), required(false) { + addValue(value); + } + virtual ~FormField(); + + struct Option { + Option(const std::string& label, const std::string& value) : label(label), value(value) {} + std::string label; + std::string value; + }; + + void setName(const std::string& name) { this->name = name; } + const std::string& getName() const { return name; } + + void setLabel(const std::string& label) { this->label = label; } + const std::string& getLabel() const { return label; } + + void setDescription(const std::string& description) { this->description = description; } + const std::string& getDescription() const { return description; } + + void setRequired(bool required) { this->required = required; } + bool getRequired() const { return required; } + + void addOption(const Option& option) { + options.push_back(option); + } + + const std::vector<Option>& getOptions() const { + return options; + } + + void clearOptions() { + options.clear(); + } + + const std::vector<std::string>& getValues() const { + return values; + } + + void addValue(const std::string& value) { + values.push_back(value); + } + + Type getType() const { + return type; + } + + void setType(Type type) { + this->type = type; + } + + // Type specific + + bool getBoolValue() const { + assert(type == BooleanType || type == UnknownType); + if (values.empty()) { + return false; + } + return values[0] == "true" || values[0] == "1"; + } + + void setBoolValue(bool b); + + JID getJIDSingleValue() const { + assert(type == JIDSingleType || type == UnknownType); + return values.empty() ? JID() : JID(values[0]); + } + + JID getJIDMultiValue(size_t index) const { + assert(type == JIDMultiType || type == UnknownType); + return values.empty() ? JID() : JID(values[index]); + } + + std::string getTextPrivateValue() const { + assert(type == TextPrivateType || type == UnknownType); + return values.empty() ? "" : values[0]; + } + + std::string getFixedValue() const { + assert(type == FixedType || type == UnknownType); + return values.empty() ? "" : values[0]; + } + + std::string getTextSingleValue() const { + assert(type == TextSingleType || type == UnknownType); + return values.empty() ? "" : values[0]; + } + + std::string getTextMultiValue() const; + void setTextMultiValue(const std::string& value); + + protected: + + private: + Type type; + std::string name; + std::string label; + std::string description; + bool required; + std::vector<Option> options; + std::vector<std::string> values; + }; } diff --git a/Swiften/Elements/FormPage.cpp b/Swiften/Elements/FormPage.cpp index 1a9bd32..0afa112 100644 --- a/Swiften/Elements/FormPage.cpp +++ b/Swiften/Elements/FormPage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,62 +7,58 @@ namespace Swift { -FormPage::FormPage() : xmlns_("http://jabber.org/protocol/xdata-layout") { +FormPage::FormPage() { } FormPage::~FormPage() { } void FormPage::setLabel(const std::string& label) { - label_ = label; + label_ = label; } const std::string& FormPage::getLabel() const { - return label_; + return label_; } -const std::string& FormPage::getXMLNS() const { - return xmlns_; +void FormPage::addChildSection(std::shared_ptr<FormSection> section) { + childSections_.push_back(section); } -void FormPage::addChildSection(boost::shared_ptr<FormSection>& section) { - childSections_.push_back(section); +const std::vector<std::shared_ptr<FormSection> >& FormPage::getChildSections() const { + return childSections_; } -const std::vector<boost::shared_ptr<FormSection> >& FormPage::getChildSections() const { - return childSections_; +void FormPage::addTextElement(std::shared_ptr<FormText> textElement) { + textElements_.push_back(textElement); } -void FormPage::addTextElement(boost::shared_ptr<FormText>& textElement) { - textElements_.push_back(textElement); +const std::vector<std::shared_ptr<FormText> >& FormPage::getTextElements() const { + return textElements_; } -const std::vector<boost::shared_ptr<FormText> >& FormPage::getTextElements() const { - return textElements_; +void FormPage::addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { + reportedRefs_.push_back(reportedRef); } -void FormPage::addReportedRef(boost::shared_ptr<FormReportedRef>& reportedRef) { - reportedRefs_.push_back(reportedRef); +const std::vector<std::shared_ptr<FormReportedRef> >& FormPage::getReportedRefs() const { + return reportedRefs_; } -const std::vector<boost::shared_ptr<FormReportedRef> >& FormPage::getReportedRefs() const { - return reportedRefs_; +void FormPage::addField(std::shared_ptr<FormField> field) { + fields_.push_back(field); } -void FormPage::addField(boost::shared_ptr<FormField>& field) { - fields_.push_back(field); -} - -const std::vector<boost::shared_ptr<FormField> >& FormPage::getFields() const { - return fields_; +const std::vector<std::shared_ptr<FormField> >& FormPage::getFields() const { + return fields_; } void FormPage::addFieldRef(std::string ref) { - fieldRefs_.push_back(ref); + fieldRefs_.push_back(ref); } const std::vector<std::string> FormPage::getFieldRefs() const { - return fieldRefs_; + return fieldRefs_; } } diff --git a/Swiften/Elements/FormPage.h b/Swiften/Elements/FormPage.h index e5ecda2..8412d9e 100644 --- a/Swiften/Elements/FormPage.h +++ b/Swiften/Elements/FormPage.h @@ -1,13 +1,14 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> + #include <Swiften/Base/API.h> #include <Swiften/Elements/FormField.h> #include <Swiften/Elements/FormReportedRef.h> @@ -16,32 +17,30 @@ namespace Swift { - class SWIFTEN_API FormPage { - public: - typedef boost::shared_ptr<FormPage> page; - FormPage (); - ~FormPage(); - void setLabel(const std::string& label); - const std::string& getLabel() const; - const std::string& getXMLNS() const; - void addChildSection(boost::shared_ptr<FormSection>& section); - const std::vector<boost::shared_ptr<FormSection> >& getChildSections() const; - void addTextElement(boost::shared_ptr<FormText>& textElement); - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const; - void addReportedRef(boost::shared_ptr<FormReportedRef>& reportedRef); - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const; - void addField(boost::shared_ptr<FormField>& field); - const std::vector<boost::shared_ptr<FormField> >& getFields() const; - void addFieldRef(std::string ref); - const std::vector<std::string> getFieldRefs() const; + class SWIFTEN_API FormPage { + public: + typedef std::shared_ptr<FormPage> page; + FormPage (); + ~FormPage(); + void setLabel(const std::string& label); + const std::string& getLabel() const; + void addChildSection(std::shared_ptr<FormSection> section); + const std::vector<std::shared_ptr<FormSection> >& getChildSections() const; + void addTextElement(std::shared_ptr<FormText> textElement); + const std::vector<std::shared_ptr<FormText> >& getTextElements() const; + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef); + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const; + void addField(std::shared_ptr<FormField> field); + const std::vector<std::shared_ptr<FormField> >& getFields() const; + void addFieldRef(std::string ref); + const std::vector<std::string> getFieldRefs() const; - private: - std::string xmlns_; - std::string label_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormSection> > childSections_; - std::vector<boost::shared_ptr<FormReportedRef> > reportedRefs_; - std::vector<boost::shared_ptr<FormField> > fields_; - std::vector<std::string> fieldRefs_; - }; + private: + std::string label_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormSection> > childSections_; + std::vector<std::shared_ptr<FormReportedRef> > reportedRefs_; + std::vector<std::shared_ptr<FormField> > fields_; + std::vector<std::string> fieldRefs_; + }; } diff --git a/Swiften/Elements/FormReportedRef.h b/Swiften/Elements/FormReportedRef.h index 03a89d1..d6dc718 100644 --- a/Swiften/Elements/FormReportedRef.h +++ b/Swiften/Elements/FormReportedRef.h @@ -1,19 +1,19 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API FormReportedRef { + class SWIFTEN_API FormReportedRef { - public: - typedef boost::shared_ptr<FormReportedRef> ref; - }; + public: + typedef std::shared_ptr<FormReportedRef> ref; + }; } diff --git a/Swiften/Elements/FormSection.cpp b/Swiften/Elements/FormSection.cpp index 46005a0..9ca3b4d 100644 --- a/Swiften/Elements/FormSection.cpp +++ b/Swiften/Elements/FormSection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,51 +14,51 @@ FormSection::~FormSection() { } void FormSection::setLabel(const std::string& label) { - label_ = label; + label_ = label; } const std::string& FormSection::getLabel() const { - return label_; + return label_; } -void FormSection::addTextElement(boost::shared_ptr<FormText>& textElement) { - textElements_.push_back(textElement); +void FormSection::addTextElement(std::shared_ptr<FormText> textElement) { + textElements_.push_back(textElement); } -const std::vector<boost::shared_ptr<FormText> >& FormSection::getTextElements() const { - return textElements_; +const std::vector<std::shared_ptr<FormText> >& FormSection::getTextElements() const { + return textElements_; } -void FormSection::addReportedRef(boost::shared_ptr<FormReportedRef>& reportedRef) { - reportedRefs_.push_back(reportedRef); +void FormSection::addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { + reportedRefs_.push_back(reportedRef); } -const std::vector<boost::shared_ptr<FormReportedRef> >& FormSection::getReportedRefs() const { - return reportedRefs_; +const std::vector<std::shared_ptr<FormReportedRef> >& FormSection::getReportedRefs() const { + return reportedRefs_; } -void FormSection::addChildSection(boost::shared_ptr<FormSection>& childSection) { - childSections_.push_back(childSection); +void FormSection::addChildSection(std::shared_ptr<FormSection> childSection) { + childSections_.push_back(childSection); } -const std::vector<boost::shared_ptr<FormSection> >& FormSection::getChildSections() const { - return childSections_; +const std::vector<std::shared_ptr<FormSection> >& FormSection::getChildSections() const { + return childSections_; } -void FormSection::addField(boost::shared_ptr<FormField>& field) { - fields_.push_back(field); +void FormSection::addField(std::shared_ptr<FormField> field) { + fields_.push_back(field); } -const std::vector<boost::shared_ptr<FormField> >& FormSection::getFields() const { - return fields_; +const std::vector<std::shared_ptr<FormField> >& FormSection::getFields() const { + return fields_; } void FormSection::addFieldRef(std::string ref) { - fieldRefs_.push_back(ref); + fieldRefs_.push_back(ref); } const std::vector<std::string> FormSection::getFieldRefs() const { - return fieldRefs_; + return fieldRefs_; } } diff --git a/Swiften/Elements/FormSection.h b/Swiften/Elements/FormSection.h index f799062..b1d60bc 100644 --- a/Swiften/Elements/FormSection.h +++ b/Swiften/Elements/FormSection.h @@ -1,13 +1,14 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> + #include <Swiften/Base/API.h> #include <Swiften/Elements/FormField.h> #include <Swiften/Elements/FormReportedRef.h> @@ -15,30 +16,30 @@ namespace Swift { - class SWIFTEN_API FormSection { - public: - typedef boost::shared_ptr<FormSection> section; - FormSection(); - ~FormSection(); - void setLabel(const std::string& label); - const std::string& getLabel() const; - void addTextElement(boost::shared_ptr<FormText>& textElement); - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const; - void addReportedRef(boost::shared_ptr<FormReportedRef>& reportedRef); - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const; - void addChildSection(boost::shared_ptr<FormSection>& childSection); - const std::vector<boost::shared_ptr<FormSection> >& getChildSections() const; - void addField(boost::shared_ptr<FormField>& field); - const std::vector<boost::shared_ptr<FormField> >& getFields() const; - void addFieldRef(std::string ref); - const std::vector<std::string> getFieldRefs() const; + class SWIFTEN_API FormSection { + public: + typedef std::shared_ptr<FormSection> section; + FormSection(); + ~FormSection(); + void setLabel(const std::string& label); + const std::string& getLabel() const; + void addTextElement(std::shared_ptr<FormText> textElement); + const std::vector<std::shared_ptr<FormText> >& getTextElements() const; + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef); + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const; + void addChildSection(std::shared_ptr<FormSection> childSection); + const std::vector<std::shared_ptr<FormSection> >& getChildSections() const; + void addField(std::shared_ptr<FormField> field); + const std::vector<std::shared_ptr<FormField> >& getFields() const; + void addFieldRef(std::string ref); + const std::vector<std::string> getFieldRefs() const; - private: - std::string label_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormReportedRef> > reportedRefs_; - std::vector<boost::shared_ptr<FormSection> > childSections_; - std::vector<boost::shared_ptr<FormField> > fields_; - std::vector<std::string> fieldRefs_; - }; + private: + std::string label_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormReportedRef> > reportedRefs_; + std::vector<std::shared_ptr<FormSection> > childSections_; + std::vector<std::shared_ptr<FormField> > fields_; + std::vector<std::string> fieldRefs_; + }; } diff --git a/Swiften/Elements/FormText.cpp b/Swiften/Elements/FormText.cpp index cbbfbe4..2180e13 100644 --- a/Swiften/Elements/FormText.cpp +++ b/Swiften/Elements/FormText.cpp @@ -14,11 +14,11 @@ FormText::~FormText() { } void FormText::setTextString(const std::string& text) { - text_ = text; + text_ = text; } const std::string& FormText::getTextString() const { - return text_; + return text_; } } diff --git a/Swiften/Elements/FormText.h b/Swiften/Elements/FormText.h index 501af11..a0c8d56 100644 --- a/Swiften/Elements/FormText.h +++ b/Swiften/Elements/FormText.h @@ -1,26 +1,27 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> + #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API FormText{ + class SWIFTEN_API FormText{ - public: - typedef boost::shared_ptr<FormText> text; - FormText(); - virtual ~FormText(); - void setTextString(const std::string& text); - const std::string& getTextString() const; + public: + typedef std::shared_ptr<FormText> text; + FormText(); + virtual ~FormText(); + void setTextString(const std::string& text); + const std::string& getTextString() const; - private: - std::string text_; - }; + private: + std::string text_; + }; } diff --git a/Swiften/Elements/Forwarded.h b/Swiften/Elements/Forwarded.h index 60f0e8c..a7eb492 100644 --- a/Swiften/Elements/Forwarded.h +++ b/Swiften/Elements/Forwarded.h @@ -1,32 +1,35 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> +#include <memory> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class Delay; - class Stanza; + class Delay; + class Stanza; + + class SWIFTEN_API Forwarded : public Payload { + public: + typedef std::shared_ptr<Forwarded> ref; - class SWIFTEN_API Forwarded : public Payload { - public: - virtual ~Forwarded(); + public: + virtual ~Forwarded(); - void setDelay(boost::shared_ptr<Delay> delay) { delay_ = delay; } - const boost::shared_ptr<Delay>& getDelay() const { return delay_; } + void setDelay(std::shared_ptr<Delay> delay) { delay_ = delay; } + const std::shared_ptr<Delay>& getDelay() const { return delay_; } - void setStanza(boost::shared_ptr<Stanza> stanza) { stanza_ = stanza; } - const boost::shared_ptr<Stanza>& getStanza() const { return stanza_; } + void setStanza(std::shared_ptr<Stanza> stanza) { stanza_ = stanza; } + const std::shared_ptr<Stanza>& getStanza() const { return stanza_; } - private: - boost::shared_ptr<Delay> delay_; - boost::shared_ptr<Stanza> stanza_; - }; + private: + std::shared_ptr<Delay> delay_; + std::shared_ptr<Stanza> stanza_; + }; } diff --git a/Swiften/Elements/HashElement.h b/Swiften/Elements/HashElement.h index cc5a0e4..bbe4d1c 100644 --- a/Swiften/Elements/HashElement.h +++ b/Swiften/Elements/HashElement.h @@ -12,34 +12,34 @@ #include <Swiften/Base/ByteArray.h> namespace Swift { - /* - * @brief This class represents a XEP-0300 <hash/> element. - */ - class SWIFTEN_API HashElement { - public: - HashElement(const std::string& algorithm, const ByteArray& hash) : algorithm_(algorithm), hash_(hash) { - } - - void setHashValue(const std::string& algorithm, const ByteArray& hash) { - algorithm_ = algorithm; - hash_ = hash; - } - - const std::string& getAlgorithm() const { - return algorithm_; - } - - const ByteArray& getHashValue() const { - return hash_; - } - - bool operator==(const HashElement& rhs) const { - return (algorithm_ == rhs.algorithm_) && (hash_ == rhs.hash_); - } - - - private: - std::string algorithm_; - ByteArray hash_; - }; + /* + * @brief This class represents a XEP-0300 <hash/> element. + */ + class SWIFTEN_API HashElement { + public: + HashElement(const std::string& algorithm, const ByteArray& hash) : algorithm_(algorithm), hash_(hash) { + } + + void setHashValue(const std::string& algorithm, const ByteArray& hash) { + algorithm_ = algorithm; + hash_ = hash; + } + + const std::string& getAlgorithm() const { + return algorithm_; + } + + const ByteArray& getHashValue() const { + return hash_; + } + + bool operator==(const HashElement& rhs) const { + return (algorithm_ == rhs.algorithm_) && (hash_ == rhs.hash_); + } + + + private: + std::string algorithm_; + ByteArray hash_; + }; } diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index 58194b9..bd0b661 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -1,108 +1,107 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API IBB : public Payload { - public: - typedef boost::shared_ptr<IBB> ref; - - enum Action { - Open, - Close, - Data - }; - enum StanzaType { - IQStanza, - MessageStanza - }; - - IBB(Action action = Open, const std::string& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { - } - - static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) { - IBB::ref result = boost::make_shared<IBB>(Open, streamID); - result->setBlockSize(blockSize); - return result; - } - - static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const std::vector<unsigned char>& data) { - IBB::ref result = boost::make_shared<IBB>(Data, streamID); - result->setSequenceNumber(sequenceNumber); - result->setData(data); - return result; - } - - static IBB::ref createIBBClose(const std::string& streamID) { - return boost::make_shared<IBB>(Close, streamID); - } - - void setAction(Action action) { - this->action = action; - } - - Action getAction() const { - return action; - } - - void setStanzaType(StanzaType stanzaType) { - this->stanzaType = stanzaType; - } - - StanzaType getStanzaType() const { - return stanzaType; - } - - void setStreamID(const std::string& id) { - streamID = id; - } - - const std::string& getStreamID() const { - return streamID; - } - - const std::vector<unsigned char>& getData() const { - return data; - } - - void setData(const std::vector<unsigned char>& data) { - this->data = data; - } - - int getBlockSize() const { - return blockSize; - } - - void setBlockSize(int blockSize) { - this->blockSize = blockSize; - } - - int getSequenceNumber() const { - return sequenceNumber; - } - - void setSequenceNumber(int i) { - sequenceNumber = i; - } - - private: - Action action; - std::string streamID; - std::vector<unsigned char> data; - StanzaType stanzaType; - int blockSize; - int sequenceNumber; - }; + class SWIFTEN_API IBB : public Payload { + public: + typedef std::shared_ptr<IBB> ref; + + enum Action { + Open, + Close, + Data + }; + enum StanzaType { + IQStanza, + MessageStanza + }; + + IBB(Action action = Open, const std::string& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { + } + + static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) { + IBB::ref result = std::make_shared<IBB>(Open, streamID); + result->setBlockSize(blockSize); + return result; + } + + static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const std::vector<unsigned char>& data) { + IBB::ref result = std::make_shared<IBB>(Data, streamID); + result->setSequenceNumber(sequenceNumber); + result->setData(data); + return result; + } + + static IBB::ref createIBBClose(const std::string& streamID) { + return std::make_shared<IBB>(Close, streamID); + } + + void setAction(Action action) { + this->action = action; + } + + Action getAction() const { + return action; + } + + void setStanzaType(StanzaType stanzaType) { + this->stanzaType = stanzaType; + } + + StanzaType getStanzaType() const { + return stanzaType; + } + + void setStreamID(const std::string& id) { + streamID = id; + } + + const std::string& getStreamID() const { + return streamID; + } + + const std::vector<unsigned char>& getData() const { + return data; + } + + void setData(const std::vector<unsigned char>& data) { + this->data = data; + } + + int getBlockSize() const { + return blockSize; + } + + void setBlockSize(int blockSize) { + this->blockSize = blockSize; + } + + int getSequenceNumber() const { + return sequenceNumber; + } + + void setSequenceNumber(int i) { + sequenceNumber = i; + } + + private: + Action action; + std::string streamID; + std::vector<unsigned char> data; + StanzaType stanzaType; + int blockSize; + int sequenceNumber; + }; } diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index 343a205..31a654f 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -1,68 +1,68 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/IQ.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { -boost::shared_ptr<IQ> IQ::createRequest( - Type type, const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(type); - if (to.isValid()) { - iq->setTo(to); - } - iq->setID(id); - if (payload) { - iq->addPayload(payload); - } - return iq; +std::shared_ptr<IQ> IQ::createRequest( + Type type, const JID& to, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(type); + if (to.isValid()) { + iq->setTo(to); + } + iq->setID(id); + if (payload) { + iq->addPayload(payload); + } + return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result); - iq->setTo(to); - iq->setID(id); - if (payload) { - iq->addPayload(payload); - } - return iq; +std::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(Result); + iq->setTo(to); + iq->setID(id); + if (payload) { + iq->addPayload(payload); + } + return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result); - iq->setTo(to); - iq->setFrom(from); - iq->setID(id); - if (payload) { - iq->addPayload(payload); - } - return iq; +std::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(Result); + iq->setTo(to); + iq->setFrom(from); + iq->setID(id); + if (payload) { + iq->addPayload(payload); + } + return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); - iq->setTo(to); - iq->setID(id); - boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); - errorPayload->setPayload(payload); - iq->addPayload(errorPayload); - return iq; +std::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(IQ::Error); + iq->setTo(to); + iq->setID(id); + std::shared_ptr<ErrorPayload> errorPayload = std::make_shared<Swift::ErrorPayload>(condition, type); + errorPayload->setPayload(payload); + iq->addPayload(errorPayload); + return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); - iq->setTo(to); - iq->setFrom(from); - iq->setID(id); - boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); - errorPayload->setPayload(payload); - iq->addPayload(errorPayload); - return iq; +std::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(IQ::Error); + iq->setTo(to); + iq->setFrom(from); + iq->setID(id); + std::shared_ptr<ErrorPayload> errorPayload = std::make_shared<Swift::ErrorPayload>(condition, type); + errorPayload->setPayload(payload); + iq->addPayload(errorPayload); + return iq; } } diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index a44f790..00ed848 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -1,58 +1,58 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Stanza.h> #include <Swiften/Elements/ErrorPayload.h> +#include <Swiften/Elements/Stanza.h> namespace Swift { - class SWIFTEN_API IQ : public Stanza { - public: - typedef boost::shared_ptr<IQ> ref; - - enum Type { Get, Set, Result, Error }; - - IQ(Type type = Get) : type_(type) { } - - Type getType() const { return type_; } - void setType(Type type) { type_ = type; } - - static boost::shared_ptr<IQ> createRequest( - Type type, - const JID& to, - const std::string& id, - boost::shared_ptr<Payload> payload); - static boost::shared_ptr<IQ> createResult( - const JID& to, - const std::string& id, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createResult( - const JID& to, - const JID& from, - const std::string& id, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createError( - const JID& to, - const std::string& id, - ErrorPayload::Condition condition = ErrorPayload::BadRequest, - ErrorPayload::Type type = ErrorPayload::Cancel, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createError( - const JID& to, - const JID& from, - const std::string& id, - ErrorPayload::Condition condition = ErrorPayload::BadRequest, - ErrorPayload::Type type = ErrorPayload::Cancel, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - - private: - Type type_; - }; + class SWIFTEN_API IQ : public Stanza { + public: + typedef std::shared_ptr<IQ> ref; + + enum Type { Get, Set, Result, Error }; + + IQ(Type type = Get) : type_(type) { } + + Type getType() const { return type_; } + void setType(Type type) { type_ = type; } + + static std::shared_ptr<IQ> createRequest( + Type type, + const JID& to, + const std::string& id, + std::shared_ptr<Payload> payload); + static std::shared_ptr<IQ> createResult( + const JID& to, + const std::string& id, + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createResult( + const JID& to, + const JID& from, + const std::string& id, + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createError( + const JID& to, + const std::string& id, + ErrorPayload::Condition condition = ErrorPayload::BadRequest, + ErrorPayload::Type type = ErrorPayload::Cancel, + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createError( + const JID& to, + const JID& from, + const std::string& id, + ErrorPayload::Condition condition = ErrorPayload::BadRequest, + ErrorPayload::Type type = ErrorPayload::Cancel, + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + + private: + Type type_; + }; } diff --git a/Swiften/Elements/Idle.h b/Swiften/Elements/Idle.h index d30120c..9f721aa 100644 --- a/Swiften/Elements/Idle.h +++ b/Swiften/Elements/Idle.h @@ -5,14 +5,15 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> + #include <boost/date_time/posix_time/posix_time_types.hpp> #include <Swiften/Base/API.h> @@ -20,25 +21,25 @@ namespace Swift { - class SWIFTEN_API Idle : public Payload { - public: - typedef boost::shared_ptr<Idle> ref; + class SWIFTEN_API Idle : public Payload { + public: + typedef std::shared_ptr<Idle> ref; - public: - Idle() {} - Idle(boost::posix_time::ptime since) : since_(since) { - } + public: + Idle() {} + Idle(boost::posix_time::ptime since) : since_(since) { + } - void setSince(boost::posix_time::ptime since) { - since_ = since; - } + void setSince(boost::posix_time::ptime since) { + since_ = since; + } - boost::posix_time::ptime getSince() const { - return since_; - } + boost::posix_time::ptime getSince() const { + return since_; + } - private: - boost::posix_time::ptime since_; - }; + private: + boost::posix_time::ptime since_; + }; } diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h index 4089bf7..4fad248 100644 --- a/Swiften/Elements/InBandRegistrationPayload.h +++ b/Swiften/Elements/InBandRegistrationPayload.h @@ -1,210 +1,211 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/optional.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API InBandRegistrationPayload : public Payload { - public: - typedef boost::shared_ptr<InBandRegistrationPayload> ref; + class SWIFTEN_API InBandRegistrationPayload : public Payload { + public: + typedef std::shared_ptr<InBandRegistrationPayload> ref; - InBandRegistrationPayload() : registered(false), remove(false) {} + InBandRegistrationPayload() : registered(false), remove(false) {} - Form::ref getForm() const { return form; } - void setForm(Form::ref f) { form = f; } + Form::ref getForm() const { return form; } + void setForm(Form::ref f) { form = f; } - bool isRegistered() const { - return registered; - } + bool isRegistered() const { + return registered; + } - void setRegistered(bool b) { - registered = b; - } + void setRegistered(bool b) { + registered = b; + } - bool isRemove() const { - return remove; - } + bool isRemove() const { + return remove; + } - void setRemove(bool b) { - remove = b; - } + void setRemove(bool b) { + remove = b; + } - const boost::optional<std::string>& getInstructions() const { - return instructions; - } + const boost::optional<std::string>& getInstructions() const { + return instructions; + } - const boost::optional<std::string>& getUsername() const { - return username; - } + const boost::optional<std::string>& getUsername() const { + return username; + } - const boost::optional<std::string>& getNick() const { - return nick; - } + const boost::optional<std::string>& getNick() const { + return nick; + } - const boost::optional<std::string>& getPassword() const { - return password; - } + const boost::optional<std::string>& getPassword() const { + return password; + } - const boost::optional<std::string>& getName() const { - return name; - } + const boost::optional<std::string>& getName() const { + return name; + } - const boost::optional<std::string>& getFirst() const { - return first; - } + const boost::optional<std::string>& getFirst() const { + return first; + } - const boost::optional<std::string>& getLast() const { - return last; - } + const boost::optional<std::string>& getLast() const { + return last; + } - const boost::optional<std::string>& getEMail() const { - return email; - } + const boost::optional<std::string>& getEMail() const { + return email; + } - const boost::optional<std::string>& getAddress() const { - return address; - } + const boost::optional<std::string>& getAddress() const { + return address; + } - const boost::optional<std::string>& getCity() const { - return city; - } + const boost::optional<std::string>& getCity() const { + return city; + } - const boost::optional<std::string>& getState() const { - return state; - } + const boost::optional<std::string>& getState() const { + return state; + } - const boost::optional<std::string>& getZip() const { - return zip; - } + const boost::optional<std::string>& getZip() const { + return zip; + } - const boost::optional<std::string>& getPhone() const { - return phone; - } - - const boost::optional<std::string>& getURL() const { - return url; - } - - const boost::optional<std::string>& getDate() const { - return date; - } - - const boost::optional<std::string>& getMisc() const { - return misc; - } - - const boost::optional<std::string>& getText() const { - return text; - } - - const boost::optional<std::string>& getKey() const { - return key; - } - - void setInstructions(const std::string& v) { - this->instructions = v; - } - - void setUsername(const std::string& v) { - this->username = v; - } - - void setNick(const std::string& v) { - this->nick = v; - } - - void setPassword(const std::string& v) { - this->password = v; - } - - void setName(const std::string& v) { - this->name = v; - } - - void setFirst(const std::string& v) { - this->first = v; - } - - void setLast(const std::string& v) { - this->last = v; - } - - void setEMail(const std::string& v) { - this->email = v; - } - - void setAddress(const std::string& v) { - this->address = v; - } - - void setCity(const std::string& v) { - this->city = v; - } - - void setState(const std::string& v) { - this->state = v; - } - - void setZip(const std::string& v) { - this->zip = v; - } - - void setPhone(const std::string& v) { - this->phone = v; - } - - void setURL(const std::string& v) { - this->url = v; - } - - void setDate(const std::string& v) { - this->date = v; - } - - void setMisc(const std::string& v) { - this->misc = v; - } - - void setText(const std::string& v) { - this->text = v; - } - - void setKey(const std::string& v) { - this->key = v; - } - - private: - Form::ref form; - bool registered; - bool remove; - boost::optional<std::string> instructions; - boost::optional<std::string> username; - boost::optional<std::string> nick; - boost::optional<std::string> password; - boost::optional<std::string> name; - boost::optional<std::string> first; - boost::optional<std::string> last; - boost::optional<std::string> email; - boost::optional<std::string> address; - boost::optional<std::string> city; - boost::optional<std::string> state; - boost::optional<std::string> zip; - boost::optional<std::string> phone; - boost::optional<std::string> url; - boost::optional<std::string> date; - boost::optional<std::string> misc; - boost::optional<std::string> text; - boost::optional<std::string> key; - }; + const boost::optional<std::string>& getPhone() const { + return phone; + } + + const boost::optional<std::string>& getURL() const { + return url; + } + + const boost::optional<std::string>& getDate() const { + return date; + } + + const boost::optional<std::string>& getMisc() const { + return misc; + } + + const boost::optional<std::string>& getText() const { + return text; + } + + const boost::optional<std::string>& getKey() const { + return key; + } + + void setInstructions(const std::string& v) { + this->instructions = v; + } + + void setUsername(const std::string& v) { + this->username = v; + } + + void setNick(const std::string& v) { + this->nick = v; + } + + void setPassword(const std::string& v) { + this->password = v; + } + + void setName(const std::string& v) { + this->name = v; + } + + void setFirst(const std::string& v) { + this->first = v; + } + + void setLast(const std::string& v) { + this->last = v; + } + + void setEMail(const std::string& v) { + this->email = v; + } + + void setAddress(const std::string& v) { + this->address = v; + } + + void setCity(const std::string& v) { + this->city = v; + } + + void setState(const std::string& v) { + this->state = v; + } + + void setZip(const std::string& v) { + this->zip = v; + } + + void setPhone(const std::string& v) { + this->phone = v; + } + + void setURL(const std::string& v) { + this->url = v; + } + + void setDate(const std::string& v) { + this->date = v; + } + + void setMisc(const std::string& v) { + this->misc = v; + } + + void setText(const std::string& v) { + this->text = v; + } + + void setKey(const std::string& v) { + this->key = v; + } + + private: + Form::ref form; + bool registered; + bool remove; + boost::optional<std::string> instructions; + boost::optional<std::string> username; + boost::optional<std::string> nick; + boost::optional<std::string> password; + boost::optional<std::string> name; + boost::optional<std::string> first; + boost::optional<std::string> last; + boost::optional<std::string> email; + boost::optional<std::string> address; + boost::optional<std::string> city; + boost::optional<std::string> state; + boost::optional<std::string> zip; + boost::optional<std::string> phone; + boost::optional<std::string> url; + boost::optional<std::string> date; + boost::optional<std::string> misc; + boost::optional<std::string> text; + boost::optional<std::string> key; + }; } diff --git a/Swiften/Elements/IsodeIQDelegation.h b/Swiften/Elements/IsodeIQDelegation.h index c1b2987..39655ce 100644 --- a/Swiften/Elements/IsodeIQDelegation.h +++ b/Swiften/Elements/IsodeIQDelegation.h @@ -1,36 +1,36 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Forwarded.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API IsodeIQDelegation : public Payload { - public: - - IsodeIQDelegation(); - - virtual ~IsodeIQDelegation(); + class SWIFTEN_API IsodeIQDelegation : public Payload { + public: + + IsodeIQDelegation(); + + virtual ~IsodeIQDelegation(); - boost::shared_ptr<Forwarded> getForward() const { - return forward; - } + std::shared_ptr<Forwarded> getForward() const { + return forward; + } - void setForward(boost::shared_ptr<Forwarded> value) { - this->forward = value ; - } + void setForward(std::shared_ptr<Forwarded> value) { + this->forward = value ; + } - private: - boost::shared_ptr<Forwarded> forward; - }; + private: + std::shared_ptr<Forwarded> forward; + }; } diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h index f908053..744ac09 100644 --- a/Swiften/Elements/JingleContentPayload.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -1,101 +1,102 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> #include <vector> + #include <boost/optional.hpp> -#include <string> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/JingleDescription.h> #include <Swiften/Elements/JingleTransportPayload.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API JingleContentPayload : public Payload { - public: - typedef boost::shared_ptr<JingleContentPayload> ref; - - enum Creator { - UnknownCreator, - InitiatorCreator, - ResponderCreator - }; - - JingleContentPayload() : creator(UnknownCreator) { - } - - /*enum Senders { - NoSenders, - InitiatorSender, - ResponderSender, - BothSenders, - };*/ - - Creator getCreator() const { - return creator; - } - - void setCreator(Creator creator) { - this->creator = creator; - } - - const std::string& getName() const { - return name; - } - - void setName(const std::string& name) { - this->name = name; - } - - const std::vector<JingleDescription::ref>& getDescriptions() const { - return descriptions; - } - - void addDescription(JingleDescription::ref description) { - descriptions.push_back(description); - } - - const std::vector<boost::shared_ptr<JingleTransportPayload> >& getTransports() const { - return transports; - } - - void addTransport(boost::shared_ptr<JingleTransportPayload> transport) { - transports.push_back(transport); - } - - template<typename T> - boost::shared_ptr<T> getDescription() const { - for (size_t i = 0; i < descriptions.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(descriptions[i])); - if (result) { - return result; - } - } - return boost::shared_ptr<T>(); - } - - template<typename T> - boost::shared_ptr<T> getTransport() const { - for (size_t i = 0; i < transports.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(transports[i])); - if (result) { - return result; - } - } - return boost::shared_ptr<T>(); - } - - private: - Creator creator; - std::string name; - //Senders senders; - std::vector<JingleDescription::ref> descriptions; - std::vector<boost::shared_ptr<JingleTransportPayload> > transports; - }; + class SWIFTEN_API JingleContentPayload : public Payload { + public: + typedef std::shared_ptr<JingleContentPayload> ref; + + enum Creator { + UnknownCreator, + InitiatorCreator, + ResponderCreator + }; + + JingleContentPayload() : creator(UnknownCreator) { + } + + /*enum Senders { + NoSenders, + InitiatorSender, + ResponderSender, + BothSenders, + };*/ + + Creator getCreator() const { + return creator; + } + + void setCreator(Creator creator) { + this->creator = creator; + } + + const std::string& getName() const { + return name; + } + + void setName(const std::string& name) { + this->name = name; + } + + const std::vector<JingleDescription::ref>& getDescriptions() const { + return descriptions; + } + + void addDescription(JingleDescription::ref description) { + descriptions.push_back(description); + } + + const std::vector<std::shared_ptr<JingleTransportPayload> >& getTransports() const { + return transports; + } + + void addTransport(std::shared_ptr<JingleTransportPayload> transport) { + transports.push_back(transport); + } + + template<typename T> + std::shared_ptr<T> getDescription() const { + for (const auto& description : descriptions) { + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(description)); + if (result) { + return result; + } + } + return std::shared_ptr<T>(); + } + + template<typename T> + std::shared_ptr<T> getTransport() const { + for (const auto& transport : transports) { + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(transport)); + if (result) { + return result; + } + } + return std::shared_ptr<T>(); + } + + private: + Creator creator; + std::string name; + //Senders senders; + std::vector<JingleDescription::ref> descriptions; + std::vector<std::shared_ptr<JingleTransportPayload> > transports; + }; } diff --git a/Swiften/Elements/JingleDescription.h b/Swiften/Elements/JingleDescription.h index 7577383..ee3dcae 100644 --- a/Swiften/Elements/JingleDescription.h +++ b/Swiften/Elements/JingleDescription.h @@ -1,19 +1,19 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API JingleDescription : public Payload { - public: - typedef boost::shared_ptr<JingleDescription> ref; - }; + class SWIFTEN_API JingleDescription : public Payload { + public: + typedef std::shared_ptr<JingleDescription> ref; + }; } diff --git a/Swiften/Elements/JingleFileTransferDescription.h b/Swiften/Elements/JingleFileTransferDescription.h index 39f10b9..2418f3b 100644 --- a/Swiften/Elements/JingleFileTransferDescription.h +++ b/Swiften/Elements/JingleFileTransferDescription.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <vector> #include <Swiften/Base/API.h> @@ -14,19 +14,19 @@ #include <Swiften/Elements/JingleFileTransferFileInfo.h> namespace Swift { - class SWIFTEN_API JingleFileTransferDescription : public JingleDescription { - public: - typedef boost::shared_ptr<JingleFileTransferDescription> ref; + class SWIFTEN_API JingleFileTransferDescription : public JingleDescription { + public: + typedef std::shared_ptr<JingleFileTransferDescription> ref; - void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { - fileInfo_ = fileInfo; - } + void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { + fileInfo_ = fileInfo; + } - const JingleFileTransferFileInfo& getFileInfo() { - return fileInfo_; - } + const JingleFileTransferFileInfo& getFileInfo() { + return fileInfo_; + } - private: - JingleFileTransferFileInfo fileInfo_; - }; + private: + JingleFileTransferFileInfo fileInfo_; + }; } diff --git a/Swiften/Elements/JingleFileTransferFileInfo.h b/Swiften/Elements/JingleFileTransferFileInfo.h index 92929a0..9fd8756 100644 --- a/Swiften/Elements/JingleFileTransferFileInfo.h +++ b/Swiften/Elements/JingleFileTransferFileInfo.h @@ -1,18 +1,18 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <map> +#include <memory> #include <string> #include <vector> -#include <map> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/HashElement.h> @@ -20,102 +20,102 @@ namespace Swift { - /** - * @brief This class represents the file info used in XEP-0234. - */ - class SWIFTEN_API JingleFileTransferFileInfo : public Payload { - typedef boost::shared_ptr<JingleFileTransferFileInfo> ref; - - public: - JingleFileTransferFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, const boost::posix_time::ptime &date = boost::posix_time::ptime()) : - name_(name), description_(description), size_(size), date_(date), supportsRangeRequests_(false), rangeOffset_(0) { - } - - public: - typedef std::map<std::string, ByteArray> HashElementMap; - - public: - void setName(const std::string& name) { - name_ = name;; - } - - const std::string& getName() const { - return name_; - } - - void setDescription(const std::string& description) { - description_ = description; - } - - const std::string& getDescription() const { - return description_; - } - - void setMediaType(const std::string& mediaType) { - mediaType_ = mediaType; - } - - const std::string& getMediaType() const { - return mediaType_; - } - - void setSize(const boost::uintmax_t size) { - size_ = size; - } - - boost::uintmax_t getSize() const { - return size_; - } - - void setDate(const boost::posix_time::ptime& date) { - date_ = date; - } - - const boost::posix_time::ptime& getDate() const { - return date_; - } - - void setSupportsRangeRequests(const bool supportsIt) { - supportsRangeRequests_ = supportsIt; - } - - bool getSupportsRangeRequests() const { - return supportsRangeRequests_; - } - - void setRangeOffset(const boost::uintmax_t offset) { - supportsRangeRequests_ = true; - rangeOffset_ = offset; - } - - boost::uintmax_t getRangeOffset() const { - return rangeOffset_; - } - - void addHash(const HashElement& hash) { - hashes_[hash.getAlgorithm()] = hash.getHashValue(); - } - - const std::map<std::string, ByteArray>& getHashes() const { - return hashes_; - } - - boost::optional<ByteArray> getHash(const std::string& algorithm) const { - boost::optional<ByteArray> ret; - if (hashes_.find(algorithm) != hashes_.end()) { - ret = boost::optional<ByteArray>(hashes_.find(algorithm)->second); - } - return ret; - } - - private: - std::string name_; - std::string description_; - std::string mediaType_; - boost::uintmax_t size_; - boost::posix_time::ptime date_; - bool supportsRangeRequests_; - boost::uintmax_t rangeOffset_; - HashElementMap hashes_; - }; + /** + * @brief This class represents the file info used in XEP-0234. + */ + class SWIFTEN_API JingleFileTransferFileInfo : public Payload { + typedef std::shared_ptr<JingleFileTransferFileInfo> ref; + + public: + JingleFileTransferFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, const boost::posix_time::ptime &date = boost::posix_time::ptime()) : + name_(name), description_(description), size_(size), date_(date), supportsRangeRequests_(false), rangeOffset_(0) { + } + + public: + typedef std::map<std::string, ByteArray> HashElementMap; + + public: + void setName(const std::string& name) { + name_ = name;; + } + + const std::string& getName() const { + return name_; + } + + void setDescription(const std::string& description) { + description_ = description; + } + + const std::string& getDescription() const { + return description_; + } + + void setMediaType(const std::string& mediaType) { + mediaType_ = mediaType; + } + + const std::string& getMediaType() const { + return mediaType_; + } + + void setSize(const boost::uintmax_t size) { + size_ = size; + } + + boost::uintmax_t getSize() const { + return size_; + } + + void setDate(const boost::posix_time::ptime& date) { + date_ = date; + } + + const boost::posix_time::ptime& getDate() const { + return date_; + } + + void setSupportsRangeRequests(const bool supportsIt) { + supportsRangeRequests_ = supportsIt; + } + + bool getSupportsRangeRequests() const { + return supportsRangeRequests_; + } + + void setRangeOffset(const boost::uintmax_t offset) { + supportsRangeRequests_ = true; + rangeOffset_ = offset; + } + + boost::uintmax_t getRangeOffset() const { + return rangeOffset_; + } + + void addHash(const HashElement& hash) { + hashes_[hash.getAlgorithm()] = hash.getHashValue(); + } + + const std::map<std::string, ByteArray>& getHashes() const { + return hashes_; + } + + boost::optional<ByteArray> getHash(const std::string& algorithm) const { + boost::optional<ByteArray> ret; + if (hashes_.find(algorithm) != hashes_.end()) { + ret = boost::optional<ByteArray>(hashes_.find(algorithm)->second); + } + return ret; + } + + private: + std::string name_; + std::string description_; + std::string mediaType_; + boost::uintmax_t size_; + boost::posix_time::ptime date_; + bool supportsRangeRequests_; + boost::uintmax_t rangeOffset_; + HashElementMap hashes_; + }; } diff --git a/Swiften/Elements/JingleFileTransferHash.h b/Swiften/Elements/JingleFileTransferHash.h index 3f3c3f0..4669e1c 100644 --- a/Swiften/Elements/JingleFileTransferHash.h +++ b/Swiften/Elements/JingleFileTransferHash.h @@ -5,15 +5,15 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> #include <map> +#include <memory> #include <string> #include <Swiften/Base/API.h> @@ -24,18 +24,18 @@ namespace Swift { class SWIFTEN_API JingleFileTransferHash : public Payload { public: - typedef boost::shared_ptr<JingleFileTransferHash> ref; + typedef std::shared_ptr<JingleFileTransferHash> ref; - void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { - fileInfo_ = fileInfo; - } + void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { + fileInfo_ = fileInfo; + } - JingleFileTransferFileInfo& getFileInfo() { - return fileInfo_; - } + JingleFileTransferFileInfo& getFileInfo() { + return fileInfo_; + } private: - JingleFileTransferFileInfo fileInfo_; + JingleFileTransferFileInfo fileInfo_; }; - + } diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h index d87570d..8f0a369 100644 --- a/Swiften/Elements/JingleIBBTransportPayload.h +++ b/Swiften/Elements/JingleIBBTransportPayload.h @@ -1,49 +1,50 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/optional.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleTransportPayload.h> namespace Swift { - class SWIFTEN_API JingleIBBTransportPayload : public JingleTransportPayload { - public: - typedef boost::shared_ptr<JingleIBBTransportPayload> ref; - - enum StanzaType { - IQStanza, - MessageStanza - }; - - JingleIBBTransportPayload() : stanzaType(IQStanza) { - } - - void setStanzaType(StanzaType stanzaType) { - this->stanzaType = stanzaType; - } - - StanzaType getStanzaType() const { - return stanzaType; - } - - boost::optional<unsigned int> getBlockSize() const { - return blockSize; - } - - void setBlockSize(unsigned int blockSize) { - this->blockSize = blockSize; - } - - private: - boost::optional<unsigned int> blockSize; - StanzaType stanzaType; - }; + class SWIFTEN_API JingleIBBTransportPayload : public JingleTransportPayload { + public: + typedef std::shared_ptr<JingleIBBTransportPayload> ref; + + enum StanzaType { + IQStanza, + MessageStanza + }; + + JingleIBBTransportPayload() : stanzaType(IQStanza) { + } + + void setStanzaType(StanzaType stanzaType) { + this->stanzaType = stanzaType; + } + + StanzaType getStanzaType() const { + return stanzaType; + } + + boost::optional<unsigned int> getBlockSize() const { + return blockSize; + } + + void setBlockSize(unsigned int blockSize) { + this->blockSize = blockSize; + } + + private: + boost::optional<unsigned int> blockSize; + StanzaType stanzaType; + }; } diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 86e3747..a1e8500 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -1,166 +1,167 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> +#include <string> #include <vector> -#include <boost/shared_ptr.hpp> + #include <boost/optional.hpp> -#include <string> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/JingleContentPayload.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API JinglePayload : public Payload { - public: - typedef boost::shared_ptr<JinglePayload> ref; - struct Reason : public Payload { - enum Type { - UnknownType, - AlternativeSession, - Busy, - Cancel, - ConnectivityError, - Decline, - Expired, - FailedApplication, - FailedTransport, - GeneralError, - Gone, - IncompatibleParameters, - MediaError, - SecurityError, - Success, - Timeout, - UnsupportedApplications, - UnsupportedTransports - }; - Reason() : type(UnknownType), text("") {} - Reason(Type type, const std::string& text = "") : type(type), text(text) {} - Type type; - std::string text; - }; - - enum Action { - UnknownAction, - ContentAccept, - ContentAdd, - ContentModify, - ContentReject, - ContentRemove, - DescriptionInfo, - SecurityInfo, - SessionAccept, - SessionInfo, - SessionInitiate, - SessionTerminate, - TransportAccept, - TransportInfo, - TransportReject, - TransportReplace - }; - JinglePayload() : action(SessionTerminate), sessionID("") { - } - - JinglePayload(Action action, const std::string& sessionID) : action(action), sessionID(sessionID) { - - } - - void setAction(Action action) { - this->action = action; - } - - Action getAction() const { - return action; - } - - void setInitiator(const JID& initiator) { - this->initiator = initiator; - } - - const JID& getInitiator() const { - return initiator; - } - - void setResponder(const JID& responder) { - this->responder = responder; - } - - const JID& getResponder() const { - return responder; - } - - void setSessionID(const std::string& id) { - sessionID = id; - } - - const std::string& getSessionID() const { - return sessionID; - } - - void addContent(JingleContentPayload::ref content) { - this->payloads.push_back(content); - } - - void addPayload(boost::shared_ptr<Payload> payload) { - this->payloads.push_back(payload); - } - - const std::vector<JingleContentPayload::ref> getContents() const { - return getPayloads<JingleContentPayload>(); - } - - const std::vector<boost::shared_ptr<Payload> > getPayloads() const { - return payloads; - } - - template<typename T> - const std::vector<boost::shared_ptr<T> > getPayloads() const { - std::vector<boost::shared_ptr<T> > matched_payloads; - for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { - boost::shared_ptr<T> result = boost::dynamic_pointer_cast<T>(*i); - if (result) { - matched_payloads.push_back(result); - } - } - - return matched_payloads; - - } - - template<typename T> - const boost::shared_ptr<T> getPayload() const { - boost::shared_ptr<T> result; - for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { - result = boost::dynamic_pointer_cast<T>(*i); - if (result) { - return result; - } - } - - return result; - } - - void setReason(const Reason& reason) { - this->reason = reason; - } - - const boost::optional<Reason>& getReason() const { - return reason; - } - - private: - Action action; - JID initiator; - JID responder; - std::string sessionID; - std::vector<boost::shared_ptr<Payload> > payloads; - boost::optional<Reason> reason; - }; + class SWIFTEN_API JinglePayload : public Payload { + public: + typedef std::shared_ptr<JinglePayload> ref; + struct Reason : public Payload { + enum Type { + UnknownType, + AlternativeSession, + Busy, + Cancel, + ConnectivityError, + Decline, + Expired, + FailedApplication, + FailedTransport, + GeneralError, + Gone, + IncompatibleParameters, + MediaError, + SecurityError, + Success, + Timeout, + UnsupportedApplications, + UnsupportedTransports + }; + Reason() : type(UnknownType), text("") {} + Reason(Type type, const std::string& text = "") : type(type), text(text) {} + Type type; + std::string text; + }; + + enum Action { + UnknownAction, + ContentAccept, + ContentAdd, + ContentModify, + ContentReject, + ContentRemove, + DescriptionInfo, + SecurityInfo, + SessionAccept, + SessionInfo, + SessionInitiate, + SessionTerminate, + TransportAccept, + TransportInfo, + TransportReject, + TransportReplace + }; + JinglePayload() : action(SessionTerminate), sessionID("") { + } + + JinglePayload(Action action, const std::string& sessionID) : action(action), sessionID(sessionID) { + + } + + void setAction(Action action) { + this->action = action; + } + + Action getAction() const { + return action; + } + + void setInitiator(const JID& initiator) { + this->initiator = initiator; + } + + const JID& getInitiator() const { + return initiator; + } + + void setResponder(const JID& responder) { + this->responder = responder; + } + + const JID& getResponder() const { + return responder; + } + + void setSessionID(const std::string& id) { + sessionID = id; + } + + const std::string& getSessionID() const { + return sessionID; + } + + void addContent(JingleContentPayload::ref content) { + this->payloads.push_back(content); + } + + void addPayload(std::shared_ptr<Payload> payload) { + this->payloads.push_back(payload); + } + + const std::vector<JingleContentPayload::ref> getContents() const { + return getPayloads<JingleContentPayload>(); + } + + const std::vector<std::shared_ptr<Payload> > getPayloads() const { + return payloads; + } + + template<typename T> + const std::vector<std::shared_ptr<T> > getPayloads() const { + std::vector<std::shared_ptr<T> > matched_payloads; + for (const auto& payload : payloads) { + std::shared_ptr<T> result = std::dynamic_pointer_cast<T>(payload); + if (result) { + matched_payloads.push_back(result); + } + } + + return matched_payloads; + + } + + template<typename T> + const std::shared_ptr<T> getPayload() const { + std::shared_ptr<T> result; + for (const auto& payload : payloads) { + result = std::dynamic_pointer_cast<T>(payload); + if (result) { + return result; + } + } + + return result; + } + + void setReason(const Reason& reason) { + this->reason = reason; + } + + const boost::optional<Reason>& getReason() const { + return reason; + } + + private: + Action action; + JID initiator; + JID responder; + std::string sessionID; + std::vector<std::shared_ptr<Payload> > payloads; + boost::optional<Reason> reason; + }; } diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h index 313e51a..5e16243 100644 --- a/Swiften/Elements/JingleS5BTransportPayload.h +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -1,122 +1,120 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> -#include <Swiften/Elements/JingleTransportPayload.h> #include <Swiften/Elements/Bytestreams.h> +#include <Swiften/Elements/JingleTransportPayload.h> #include <Swiften/Network/HostAddressPort.h> - namespace Swift { - class SWIFTEN_API JingleS5BTransportPayload : public JingleTransportPayload { - public: - enum Mode { - TCPMode, // default case - UDPMode - }; - - struct Candidate { - enum Type { - DirectType, // default case - AssistedType, - TunnelType, - ProxyType - }; - - Candidate() : priority(0), type(DirectType) {} - - std::string cid; - JID jid; - HostAddressPort hostPort; - int priority; - Type type; - }; - - struct CompareCandidate { - bool operator() (const JingleS5BTransportPayload::Candidate& c1, const JingleS5BTransportPayload::Candidate& c2) const { - if (c1.priority < c2.priority) return true; - return false; - } - }; - - public: - JingleS5BTransportPayload() : mode(TCPMode), candidateError(false), proxyError(false) {} - - Mode getMode() const { - return mode; - } - - void setMode(Mode mode) { - this->mode = mode; - } - - const std::vector<Candidate>& getCandidates() const { - return candidates; - } - - void addCandidate(const Candidate& candidate) { - candidates.push_back(candidate); - } - - void setCandidateUsed(const std::string& cid) { - candidateUsedCID = cid; - } - - const std::string& getCandidateUsed() const { - return candidateUsedCID; - } - - void setActivated(const std::string& cid) { - activatedCID = cid; - } - - const std::string& getActivated() const { - return activatedCID; - } - - void setDstAddr(const std::string& addr) { - dstAddr = addr; - } - - const std::string& getDstAddr() const { - return dstAddr; - } - - void setCandidateError(bool hasError) { - candidateError = hasError; - } - - bool hasCandidateError() const { - return candidateError; - } - - void setProxyError(bool hasError) { - proxyError = hasError; - } - - bool hasProxyError() const { - return proxyError; - } - public: - typedef boost::shared_ptr<JingleS5BTransportPayload> ref; - - private: - Mode mode; - std::vector<Candidate> candidates; - - std::string candidateUsedCID; - std::string activatedCID; - std::string dstAddr; - bool candidateError; - bool proxyError; - }; + class SWIFTEN_API JingleS5BTransportPayload : public JingleTransportPayload { + public: + enum Mode { + TCPMode, // default case + UDPMode + }; + + struct Candidate { + enum Type { + DirectType, // default case + AssistedType, + TunnelType, + ProxyType + }; + + Candidate() : priority(0), type(DirectType) {} + + std::string cid; + JID jid; + HostAddressPort hostPort; + int priority; + Type type; + }; + + struct CompareCandidate { + bool operator() (const JingleS5BTransportPayload::Candidate& c1, const JingleS5BTransportPayload::Candidate& c2) const { + if (c1.priority < c2.priority) return true; + return false; + } + }; + + public: + JingleS5BTransportPayload() : mode(TCPMode), candidateError(false), proxyError(false) {} + + Mode getMode() const { + return mode; + } + + void setMode(Mode mode) { + this->mode = mode; + } + + const std::vector<Candidate>& getCandidates() const { + return candidates; + } + + void addCandidate(const Candidate& candidate) { + candidates.push_back(candidate); + } + + void setCandidateUsed(const std::string& cid) { + candidateUsedCID = cid; + } + + const std::string& getCandidateUsed() const { + return candidateUsedCID; + } + + void setActivated(const std::string& cid) { + activatedCID = cid; + } + + const std::string& getActivated() const { + return activatedCID; + } + + void setDstAddr(const std::string& addr) { + dstAddr = addr; + } + + const std::string& getDstAddr() const { + return dstAddr; + } + + void setCandidateError(bool hasError) { + candidateError = hasError; + } + + bool hasCandidateError() const { + return candidateError; + } + + void setProxyError(bool hasError) { + proxyError = hasError; + } + + bool hasProxyError() const { + return proxyError; + } + public: + typedef std::shared_ptr<JingleS5BTransportPayload> ref; + + private: + Mode mode; + std::vector<Candidate> candidates; + + std::string candidateUsedCID; + std::string activatedCID; + std::string dstAddr; + bool candidateError; + bool proxyError; + }; } diff --git a/Swiften/Elements/JingleTransportPayload.h b/Swiften/Elements/JingleTransportPayload.h index 70f3d25..dfd9d22 100644 --- a/Swiften/Elements/JingleTransportPayload.h +++ b/Swiften/Elements/JingleTransportPayload.h @@ -1,31 +1,32 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API JingleTransportPayload : public Payload { - public: - void setSessionID(const std::string& id) { - sessionID = id; - } + class SWIFTEN_API JingleTransportPayload : public Payload { + public: + void setSessionID(const std::string& id) { + sessionID = id; + } - const std::string& getSessionID() const { - return sessionID; - } + const std::string& getSessionID() const { + return sessionID; + } - public: - typedef boost::shared_ptr<JingleTransportPayload> ref; + public: + typedef std::shared_ptr<JingleTransportPayload> ref; - private: - std::string sessionID; - }; + private: + std::string sessionID; + }; } diff --git a/Swiften/Elements/Last.h b/Swiften/Elements/Last.h index 68cf7a7..869dab4 100644 --- a/Swiften/Elements/Last.h +++ b/Swiften/Elements/Last.h @@ -10,14 +10,14 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Last : public Payload { - public: - Last(int seconds = 0) : seconds_(seconds) {} + class SWIFTEN_API Last : public Payload { + public: + Last(int seconds = 0) : seconds_(seconds) {} - int getSeconds() const {return seconds_;} - void setSeconds(int seconds) {seconds_ = seconds;} + int getSeconds() const {return seconds_;} + void setSeconds(int seconds) {seconds_ = seconds;} - private: - int seconds_; - }; + private: + int seconds_; + }; } diff --git a/Swiften/Elements/MAMFin.h b/Swiften/Elements/MAMFin.h index 30a3f05..e5e719b 100644 --- a/Swiften/Elements/MAMFin.h +++ b/Swiften/Elements/MAMFin.h @@ -1,14 +1,14 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/optional.hpp> #include <Swiften/Base/API.h> @@ -16,48 +16,48 @@ #include <Swiften/Elements/ResultSet.h> namespace Swift { - class SWIFTEN_API MAMFin : public Payload { - public: - MAMFin() : isComplete_(false), isStable_(true) {} - virtual ~MAMFin(); - - void setComplete(const bool isComplete) { - isComplete_ = isComplete; - } - - bool isComplete() const { - return isComplete_; - } - - void setStable(const bool isStable) { - isStable_ = isStable; - } - - bool isStable() const { - return isStable_; - } - - void setResultSet(boost::shared_ptr<ResultSet> resultSet) { - resultSet_ = resultSet; - } - - boost::shared_ptr<ResultSet> getResultSet() const { - return resultSet_; - } - - void setQueryID(const std::string& queryID) { - queryID_ = queryID; - } - - const boost::optional<std::string>& getQueryID() const { - return queryID_; - } - - - private: - bool isComplete_; - bool isStable_; - boost::shared_ptr<ResultSet> resultSet_; - boost::optional<std::string> queryID_; - }; + class SWIFTEN_API MAMFin : public Payload { + public: + MAMFin() : isComplete_(false), isStable_(true) {} + virtual ~MAMFin(); + + void setComplete(const bool isComplete) { + isComplete_ = isComplete; + } + + bool isComplete() const { + return isComplete_; + } + + void setStable(const bool isStable) { + isStable_ = isStable; + } + + bool isStable() const { + return isStable_; + } + + void setResultSet(std::shared_ptr<ResultSet> resultSet) { + resultSet_ = resultSet; + } + + std::shared_ptr<ResultSet> getResultSet() const { + return resultSet_; + } + + void setQueryID(const std::string& queryID) { + queryID_ = queryID; + } + + const boost::optional<std::string>& getQueryID() const { + return queryID_; + } + + + private: + bool isComplete_; + bool isStable_; + std::shared_ptr<ResultSet> resultSet_; + boost::optional<std::string> queryID_; + }; } diff --git a/Swiften/Elements/MAMQuery.h b/Swiften/Elements/MAMQuery.h index 33902ae..764c238 100644 --- a/Swiften/Elements/MAMQuery.h +++ b/Swiften/Elements/MAMQuery.h @@ -1,14 +1,14 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/optional.hpp> #include <Swiften/Base/API.h> @@ -17,26 +17,26 @@ #include <Swiften/Elements/ResultSet.h> namespace Swift { - class SWIFTEN_API MAMQuery : public Payload { - public: - virtual ~MAMQuery(); + class SWIFTEN_API MAMQuery : public Payload { + public: + virtual ~MAMQuery(); - void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } - const boost::optional<std::string>& getQueryID() const { return queryID_; } + void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } + const boost::optional<std::string>& getQueryID() const { return queryID_; } - void setNode(const boost::optional<std::string>& node) { node_ = node; } - const boost::optional<std::string>& getNode() const { return node_; } + void setNode(const boost::optional<std::string>& node) { node_ = node; } + const boost::optional<std::string>& getNode() const { return node_; } - void setForm(boost::shared_ptr<Form> form) { form_ = form; } - const boost::shared_ptr<Form>& getForm() const { return form_; } + void setForm(std::shared_ptr<Form> form) { form_ = form; } + const std::shared_ptr<Form>& getForm() const { return form_; } - void setResultSet(boost::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } - const boost::shared_ptr<ResultSet>& getResultSet() const { return resultSet_; } + void setResultSet(std::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } + const std::shared_ptr<ResultSet>& getResultSet() const { return resultSet_; } - private: - boost::optional<std::string> queryID_; - boost::optional<std::string> node_; - boost::shared_ptr<Form> form_; - boost::shared_ptr<ResultSet> resultSet_; - }; + private: + boost::optional<std::string> queryID_; + boost::optional<std::string> node_; + std::shared_ptr<Form> form_; + std::shared_ptr<ResultSet> resultSet_; + }; } diff --git a/Swiften/Elements/MAMResult.h b/Swiften/Elements/MAMResult.h index de69fba..88ec8f0 100644 --- a/Swiften/Elements/MAMResult.h +++ b/Swiften/Elements/MAMResult.h @@ -15,18 +15,18 @@ #include <Swiften/Elements/Forwarded.h> namespace Swift { - class SWIFTEN_API MAMResult : public ContainerPayload<Forwarded> { - public: - virtual ~MAMResult(); + class SWIFTEN_API MAMResult : public ContainerPayload<Forwarded> { + public: + virtual ~MAMResult(); - void setID(const std::string& id) { id_ = id; } - const std::string& getID() const { return id_; } + void setID(const std::string& id) { id_ = id; } + const std::string& getID() const { return id_; } - void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } - const boost::optional<std::string>& getQueryID() const { return queryID_; } + void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } + const boost::optional<std::string>& getQueryID() const { return queryID_; } - private: - std::string id_; - boost::optional<std::string> queryID_; - }; + private: + std::string id_; + boost::optional<std::string> queryID_; + }; } diff --git a/Swiften/Elements/MUCAdminPayload.h b/Swiften/Elements/MUCAdminPayload.h index b271f06..3f78cc8 100644 --- a/Swiften/Elements/MUCAdminPayload.h +++ b/Swiften/Elements/MUCAdminPayload.h @@ -1,36 +1,37 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> -#include <Swiften/Elements/Payload.h> -#include <Swiften/Elements/MUCOccupant.h> #include <Swiften/Elements/MUCItem.h> +#include <Swiften/Elements/MUCOccupant.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API MUCAdminPayload : public Payload { - public: - typedef boost::shared_ptr<MUCAdminPayload> ref; + class SWIFTEN_API MUCAdminPayload : public Payload { + public: + typedef std::shared_ptr<MUCAdminPayload> ref; - MUCAdminPayload() { - } + MUCAdminPayload() { + } - void addItem(const MUCItem& item) {items_.push_back(item);} + void addItem(const MUCItem& item) {items_.push_back(item);} - const std::vector<MUCItem>& getItems() const {return items_;} + const std::vector<MUCItem>& getItems() const {return items_;} - private: - std::vector<MUCItem> items_; - }; + private: + std::vector<MUCItem> items_; + }; } diff --git a/Swiften/Elements/MUCDestroyPayload.h b/Swiften/Elements/MUCDestroyPayload.h index b68f97c..ad1bda2 100644 --- a/Swiften/Elements/MUCDestroyPayload.h +++ b/Swiften/Elements/MUCDestroyPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,31 +13,31 @@ #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API MUCDestroyPayload : public Payload { - public: - typedef boost::shared_ptr<MUCDestroyPayload> ref; + class SWIFTEN_API MUCDestroyPayload : public Payload { + public: + typedef std::shared_ptr<MUCDestroyPayload> ref; - MUCDestroyPayload() { - } + MUCDestroyPayload() { + } - void setNewVenue(const JID& jid) { - newVenue_ = jid; - } + void setNewVenue(const JID& jid) { + newVenue_ = jid; + } - const JID& getNewVenue() const { - return newVenue_; - } + const JID& getNewVenue() const { + return newVenue_; + } - void setReason(const std::string& reason) { - reason_ = reason; - } + void setReason(const std::string& reason) { + reason_ = reason; + } - const std::string& getReason() const { - return reason_; - } + const std::string& getReason() const { + return reason_; + } - private: - JID newVenue_; - std::string reason_; - }; + private: + JID newVenue_; + std::string reason_; + }; } diff --git a/Swiften/Elements/MUCInvitationPayload.h b/Swiften/Elements/MUCInvitationPayload.h index fd92a83..545e60f 100644 --- a/Swiften/Elements/MUCInvitationPayload.h +++ b/Swiften/Elements/MUCInvitationPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,66 +13,66 @@ #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API MUCInvitationPayload : public Payload { - public: - typedef boost::shared_ptr<MUCInvitationPayload> ref; - MUCInvitationPayload() : continuation_(false), impromptu_(false) { - } - - void setIsContinuation(bool b) { - continuation_ = b; - } - - bool getIsContinuation() const { - return continuation_; - } - - void setIsImpromptu(bool b) { - impromptu_ = b; - } - - bool getIsImpromptu() const { - return impromptu_; - } - - void setJID(const JID& jid) { - jid_ = jid; - } - - const JID& getJID() const { - return jid_; - } - - void setPassword(const std::string& password) { - password_ = password; - } - - const std::string& getPassword() const { - return password_; - } - - void setReason(const std::string& text) { - reason_ = text; - } - - const std::string& getReason() const { - return reason_; - } - - void setThread(const std::string& thread) { - thread_ = thread; - } - - const std::string& getThread() const { - return thread_; - } - - private: - bool continuation_; - bool impromptu_; - JID jid_; - std::string password_; - std::string reason_; - std::string thread_; - }; + class SWIFTEN_API MUCInvitationPayload : public Payload { + public: + typedef std::shared_ptr<MUCInvitationPayload> ref; + MUCInvitationPayload() : continuation_(false), impromptu_(false) { + } + + void setIsContinuation(bool b) { + continuation_ = b; + } + + bool getIsContinuation() const { + return continuation_; + } + + void setIsImpromptu(bool b) { + impromptu_ = b; + } + + bool getIsImpromptu() const { + return impromptu_; + } + + void setJID(const JID& jid) { + jid_ = jid; + } + + const JID& getJID() const { + return jid_; + } + + void setPassword(const std::string& password) { + password_ = password; + } + + const std::string& getPassword() const { + return password_; + } + + void setReason(const std::string& text) { + reason_ = text; + } + + const std::string& getReason() const { + return reason_; + } + + void setThread(const std::string& thread) { + thread_ = thread; + } + + const std::string& getThread() const { + return thread_; + } + + private: + bool continuation_; + bool impromptu_; + JID jid_; + std::string password_; + std::string reason_; + std::string thread_; + }; } diff --git a/Swiften/Elements/MUCItem.h b/Swiften/Elements/MUCItem.h index 40f4572..3c89e68 100644 --- a/Swiften/Elements/MUCItem.h +++ b/Swiften/Elements/MUCItem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,14 +8,17 @@ #include <Swiften/Elements/MUCOccupant.h> #include <Swiften/JID/JID.h> + namespace Swift { struct MUCItem { - MUCItem() {} - boost::optional<JID> realJID; - boost::optional<std::string> nick; - boost::optional<MUCOccupant::Affiliation> affiliation; - boost::optional<MUCOccupant::Role> role; - boost::optional<JID> actor; - boost::optional<std::string> reason; + MUCItem() {} + MUCItem(MUCOccupant::Affiliation affiliation, const JID& jid, MUCOccupant::Role role) : realJID(jid), affiliation(affiliation), role(role) {} + MUCItem(MUCOccupant::Affiliation affiliation, MUCOccupant::Role role) : affiliation(affiliation), role(role) {} + boost::optional<JID> realJID; + boost::optional<std::string> nick; + boost::optional<MUCOccupant::Affiliation> affiliation; + boost::optional<MUCOccupant::Role> role; + boost::optional<JID> actor; + boost::optional<std::string> reason; }; } diff --git a/Swiften/Elements/MUCOccupant.cpp b/Swiften/Elements/MUCOccupant.cpp index c2d2f3d..65fb8c2 100644 --- a/Swiften/Elements/MUCOccupant.cpp +++ b/Swiften/Elements/MUCOccupant.cpp @@ -1,11 +1,13 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/MUCOccupant.h> +#include <utility> + namespace Swift { MUCOccupant::MUCOccupant(const std::string &nick, Role role, Affiliation affiliation) : nick_(nick), role_(role), affiliation_(affiliation) { @@ -18,29 +20,37 @@ MUCOccupant::MUCOccupant(const MUCOccupant& other) : nick_(other.getNick()), rol } +MUCOccupant& MUCOccupant::operator=(MUCOccupant other) { + std::swap(nick_, other.nick_); + std::swap(role_, other.role_); + std::swap(affiliation_, other.affiliation_); + std::swap(realJID_, other.realJID_); + return *this; +} + std::string MUCOccupant::getNick() const { - return nick_; + return nick_; } MUCOccupant::Role MUCOccupant::getRole() const { - return role_; + return role_; } MUCOccupant::Affiliation MUCOccupant::getAffiliation() const { - return affiliation_; + return affiliation_; } void MUCOccupant::setRealJID(const JID& realJID) { - realJID_ = realJID; + realJID_ = realJID; } void MUCOccupant::setNick(const std::string& nick) { - nick_ = nick; + nick_ = nick; } boost::optional<JID> MUCOccupant::getRealJID() const { - return realJID_; + return realJID_; } } diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h index 4526229..c345a49 100644 --- a/Swiften/Elements/MUCOccupant.h +++ b/Swiften/Elements/MUCOccupant.h @@ -1,42 +1,45 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> #include <string> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> namespace Swift { - class Client; - - class SWIFTEN_API MUCOccupant { - public: - enum Role {Moderator, Participant, Visitor, NoRole}; - enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation}; - - MUCOccupant(const std::string &nick, Role role, Affiliation affiliation); - MUCOccupant(const MUCOccupant& other); - ~MUCOccupant(); - - std::string getNick() const; - Role getRole() const; - Affiliation getAffiliation() const; - boost::optional<JID> getRealJID() const; - void setRealJID(const JID& jid); - void setNick(const std::string& nick); - - private: - std::string nick_; - Role role_; - Affiliation affiliation_; - boost::optional<JID> realJID_; - /* If you add a field, remember to update the const copy constructor */ - }; + class Client; + + class SWIFTEN_API MUCOccupant { + public: + enum Role {Moderator, Participant, Visitor, NoRole}; + enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation}; + + MUCOccupant(const std::string &nick, Role role, Affiliation affiliation); + MUCOccupant(const MUCOccupant& other); + ~MUCOccupant(); + + MUCOccupant& operator=(MUCOccupant other); + + std::string getNick() const; + Role getRole() const; + Affiliation getAffiliation() const; + boost::optional<JID> getRealJID() const; + void setRealJID(const JID& jid); + void setNick(const std::string& nick); + + private: + std::string nick_; + Role role_; + Affiliation affiliation_; + boost::optional<JID> realJID_; + /* If you add a field, remember to update the const copy constructor */ + }; } diff --git a/Swiften/Elements/MUCOwnerPayload.h b/Swiften/Elements/MUCOwnerPayload.h index 09166b6..5f3c633 100644 --- a/Swiften/Elements/MUCOwnerPayload.h +++ b/Swiften/Elements/MUCOwnerPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,30 +9,30 @@ #include <boost/optional.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API MUCOwnerPayload : public Payload { - public: - typedef boost::shared_ptr<MUCOwnerPayload> ref; + class SWIFTEN_API MUCOwnerPayload : public Payload { + public: + typedef std::shared_ptr<MUCOwnerPayload> ref; - MUCOwnerPayload() { - } + MUCOwnerPayload() { + } - boost::shared_ptr<Payload> getPayload() const { - return payload; - } + std::shared_ptr<Payload> getPayload() const { + return payload; + } - void setPayload(boost::shared_ptr<Payload> p) { - payload = p; - } + void setPayload(std::shared_ptr<Payload> p) { + payload = p; + } - Form::ref getForm() { - return boost::dynamic_pointer_cast<Form>(payload); - } + Form::ref getForm() { + return std::dynamic_pointer_cast<Form>(payload); + } - private: - boost::shared_ptr<Payload> payload; - }; + private: + std::shared_ptr<Payload> payload; + }; } diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h index dadfc6a..6e199e5 100644 --- a/Swiften/Elements/MUCPayload.h +++ b/Swiften/Elements/MUCPayload.h @@ -1,75 +1,76 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> +#include <string> + #include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/optional.hpp> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> -#include <string> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API MUCPayload : public Payload { - public: - typedef boost::shared_ptr<MUCPayload> ref; - - MUCPayload() { - maxChars_ = -1; - maxStanzas_ = -1; - seconds_ = -1; - } - - void setMaxChars(int maxChars) { - maxChars_ = maxChars; - } - - void setMaxStanzas(int maxStanzas) { - maxStanzas_ = maxStanzas; - } - - void setSeconds(int seconds) { - seconds_ = seconds; - } - - void setSince(boost::posix_time::ptime since) { - since_ = since; - } - - void setPassword(const std::string& password) { - password_ = password; - } - - int getMaxChars() const{ - return maxChars_; - } - - int getMaxStanzas() const{ - return maxStanzas_; - } - - int getSeconds() const { - return seconds_; - } - - const boost::optional<std::string>& getPassword() const { - return password_; - } - - const boost::posix_time::ptime& getSince() const { - return since_; - } - - private: - int maxChars_; - int maxStanzas_; - int seconds_; - boost::posix_time::ptime since_; - boost::optional<std::string> password_; - }; + class SWIFTEN_API MUCPayload : public Payload { + public: + typedef std::shared_ptr<MUCPayload> ref; + + MUCPayload() { + maxChars_ = -1; + maxStanzas_ = -1; + seconds_ = -1; + } + + void setMaxChars(int maxChars) { + maxChars_ = maxChars; + } + + void setMaxStanzas(int maxStanzas) { + maxStanzas_ = maxStanzas; + } + + void setSeconds(int seconds) { + seconds_ = seconds; + } + + void setSince(boost::posix_time::ptime since) { + since_ = since; + } + + void setPassword(const std::string& password) { + password_ = password; + } + + int getMaxChars() const{ + return maxChars_; + } + + int getMaxStanzas() const{ + return maxStanzas_; + } + + int getSeconds() const { + return seconds_; + } + + const boost::optional<std::string>& getPassword() const { + return password_; + } + + const boost::posix_time::ptime& getSince() const { + return since_; + } + + private: + int maxChars_; + int maxStanzas_; + int seconds_; + boost::posix_time::ptime since_; + boost::optional<std::string> password_; + }; } diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h index ed31816..dd57376 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -1,96 +1,97 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> -#include <Swiften/Elements/Payload.h> -#include <Swiften/Elements/MUCOccupant.h> #include <Swiften/Elements/MUCItem.h> +#include <Swiften/Elements/MUCOccupant.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API MUCUserPayload : public Payload { - public: - typedef boost::shared_ptr<MUCUserPayload> ref; + class SWIFTEN_API MUCUserPayload : public Payload { + public: + typedef std::shared_ptr<MUCUserPayload> ref; + + struct StatusCode { + StatusCode() : code(0) {} + StatusCode(int code) : code(code) {} + int code; + }; - struct StatusCode { - StatusCode() : code(0) {} - StatusCode(int code) : code(code) {} - int code; - }; + //struct Password { - //struct Password { + //} - //} + // struct History { - // struct History { + // } - // } + /** + * reason is optional. + * from and to are mutually exclusive. + * From is used for MUC sending to invited client. To is used sending to MUC from inviting client. + * from is the JID the MUC claims the invite is from. + * to is the JID to send the invite to. + */ + struct Invite { + std::string reason; + JID from; + JID to; + }; - /** - * reason is optional. - * from and to are mutually exclusive. - * From is used for MUC sending to invited client. To is used sending to MUC from inviting client. - * from is the JID the MUC claims the invite is from. - * to is the JID to send the invite to. - */ - struct Invite { - std::string reason; - JID from; - JID to; - }; + MUCUserPayload() { + } - MUCUserPayload() { - } + void addItem(const MUCItem& item) {items_.push_back(item);} - void addItem(const MUCItem& item) {items_.push_back(item);} - - void addStatusCode(StatusCode code) {statusCodes_.push_back(code);} + void addStatusCode(StatusCode code) {statusCodes_.push_back(code);} - const std::vector<MUCItem>& getItems() const {return items_;} + const std::vector<MUCItem>& getItems() const {return items_;} - const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} + const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} - boost::shared_ptr<Payload> getPayload() const { - return payload_; - } + std::shared_ptr<Payload> getPayload() const { + return payload_; + } - void setPayload(boost::shared_ptr<Payload> p) { - payload_ = p; - } + void setPayload(std::shared_ptr<Payload> p) { + payload_ = p; + } - const boost::optional<std::string>& getPassword() const { - return password_; - } + const boost::optional<std::string>& getPassword() const { + return password_; + } - void setPassword(const std::string& password) { - password_ = password; - } + void setPassword(const std::string& password) { + password_ = password; + } - const boost::optional<Invite>& getInvite() const { - return invite_; - } + const boost::optional<Invite>& getInvite() const { + return invite_; + } - void setInvite(const Invite& invite) { - invite_ = invite; - } + void setInvite(const Invite& invite) { + invite_ = invite; + } - private: - std::vector<MUCItem> items_; - std::vector<StatusCode> statusCodes_; - boost::shared_ptr<Payload> payload_; - boost::optional<std::string> password_; - boost::optional<Invite> invite_; - }; + private: + std::vector<MUCItem> items_; + std::vector<StatusCode> statusCodes_; + std::shared_ptr<Payload> payload_; + boost::optional<std::string> password_; + boost::optional<Invite> invite_; + }; } diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index 0f0d380..c357cd4 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Body.h> @@ -20,63 +19,61 @@ #include <Swiften/Elements/Subject.h> namespace Swift { - class SWIFTEN_API Message : public Stanza { - public: - typedef boost::shared_ptr<Message> ref; - - enum Type { Normal, Chat, Error, Groupchat, Headline }; - - Message() : type_(Chat) { } - - std::string getSubject() const { - boost::shared_ptr<Subject> subject(getPayload<Subject>()); - if (subject) { - return subject->getText(); - } - return ""; - } - - void setSubject(const std::string& subject) { - updatePayload(boost::make_shared<Subject>(subject)); - } - - // Explicitly convert to bool. In C++11, it would be cleaner to - // compare to nullptr. - bool hasSubject() { - return static_cast<bool>(getPayload<Subject>()); - } - - boost::optional<std::string> getBody() const { - boost::shared_ptr<Body> body(getPayload<Body>()); - boost::optional<std::string> bodyData; - if (body) { - bodyData = body->getText(); - } - return bodyData; - } - - void setBody(const std::string& body) { - setBody(boost::optional<std::string>(body)); - } - - void setBody(const boost::optional<std::string>& body) { - if (body) { - updatePayload(boost::make_shared<Body>(body.get())); - } - else { - removePayloadOfSameType(boost::make_shared<Body>()); - } - } - - bool isError() { - boost::shared_ptr<Swift::ErrorPayload> error(getPayload<Swift::ErrorPayload>()); - return getType() == Message::Error || error; - } - - Type getType() const { return type_; } - void setType(Type type) { type_ = type; } - - private: - Type type_; - }; + class SWIFTEN_API Message : public Stanza { + public: + typedef std::shared_ptr<Message> ref; + + enum Type { Normal, Chat, Error, Groupchat, Headline }; + + Message() : type_(Chat) { } + + std::string getSubject() const { + std::shared_ptr<Subject> subject(getPayload<Subject>()); + if (subject) { + return subject->getText(); + } + return ""; + } + + void setSubject(const std::string& subject) { + updatePayload(std::make_shared<Subject>(subject)); + } + + bool hasSubject() { + return getPayload<Subject>() != nullptr; + } + + boost::optional<std::string> getBody() const { + std::shared_ptr<Body> body(getPayload<Body>()); + boost::optional<std::string> bodyData; + if (body) { + bodyData = body->getText(); + } + return bodyData; + } + + void setBody(const std::string& body) { + setBody(boost::optional<std::string>(body)); + } + + void setBody(const boost::optional<std::string>& body) { + if (body) { + updatePayload(std::make_shared<Body>(body.get())); + } + else { + removePayloadOfSameType(std::make_shared<Body>()); + } + } + + bool isError() { + std::shared_ptr<Swift::ErrorPayload> error(getPayload<Swift::ErrorPayload>()); + return getType() == Message::Error || error; + } + + Type getType() const { return type_; } + void setType(Type type) { type_ = type; } + + private: + Type type_; + }; } diff --git a/Swiften/Elements/Nickname.h b/Swiften/Elements/Nickname.h index 2c62720..123c156 100644 --- a/Swiften/Elements/Nickname.h +++ b/Swiften/Elements/Nickname.h @@ -1,30 +1,31 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> -#include <string> namespace Swift { - class SWIFTEN_API Nickname : public Payload { - public: - Nickname(const std::string& nickname = "") : nickname(nickname) { - } + class SWIFTEN_API Nickname : public Payload { + public: + Nickname(const std::string& nickname = "") : nickname(nickname) { + } - void setNickname(const std::string& nickname) { - this->nickname = nickname; - } + void setNickname(const std::string& nickname) { + this->nickname = nickname; + } - const std::string& getNickname() const { - return nickname; - } + const std::string& getNickname() const { + return nickname; + } - private: - std::string nickname; - }; + private: + std::string nickname; + }; } diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h index dfa74b2..9923f0b 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -1,25 +1,25 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Element.h> namespace Swift { - class SWIFTEN_API Payload : public Element { - public: - typedef boost::shared_ptr<Payload> ref; - public: - Payload() {} - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload) - virtual ~Payload(); + class SWIFTEN_API Payload : public Element { + public: + typedef std::shared_ptr<Payload> ref; + public: + Payload() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload) + virtual ~Payload(); - SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Payload) - }; + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Payload) + }; } diff --git a/Swiften/Elements/Presence.cpp b/Swiften/Elements/Presence.cpp index cf1f0d8..f75f3be 100644 --- a/Swiften/Elements/Presence.cpp +++ b/Swiften/Elements/Presence.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,31 +15,31 @@ Presence::Presence() : type_(Available) /*, showType_(Online)*/ { } Presence::Presence(const std::string& status) : type_(Available) { - setStatus(status); + setStatus(status); } Presence::~Presence() { } int Presence::getPriority() const { - boost::shared_ptr<Priority> priority(getPayload<Priority>()); - return (priority ? priority->getPriority() : 0); + std::shared_ptr<Priority> priority(getPayload<Priority>()); + return (priority ? priority->getPriority() : 0); } void Presence::setPriority(int priority) { - updatePayload(boost::make_shared<Priority>(priority)); + updatePayload(std::make_shared<Priority>(priority)); } -std::string Presence::getStatus() const { - boost::shared_ptr<Status> status(getPayload<Status>()); - if (status) { - return status->getText(); - } - return ""; +std::string Presence::getStatus() const { + std::shared_ptr<Status> status(getPayload<Status>()); + if (status) { + return status->getText(); + } + return ""; } -void Presence::setStatus(const std::string& status) { - updatePayload(boost::make_shared<Status>(status)); +void Presence::setStatus(const std::string& status) { + updatePayload(std::make_shared<Status>(status)); } } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 53b77cf..e658606 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -1,72 +1,71 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Elements/StatusShow.h> - namespace Swift { - class SWIFTEN_API Presence : public Stanza { - public: - typedef boost::shared_ptr<Presence> ref; + class SWIFTEN_API Presence : public Stanza { + public: + typedef std::shared_ptr<Presence> ref; - enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed }; + enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed }; - Presence(); - Presence(const std::string& status); - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Presence) - virtual ~Presence(); + Presence(); + Presence(const std::string& status); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Presence) + virtual ~Presence(); - static ref create() { - return boost::make_shared<Presence>(); - } + static ref create() { + return std::make_shared<Presence>(); + } - static ref create(const std::string& status) { - return boost::make_shared<Presence>(status); - } + static ref create(const std::string& status) { + return std::make_shared<Presence>(status); + } - static ref create(Presence::ref presence) { - return boost::make_shared<Presence>(*presence); - } + static ref create(Presence::ref presence) { + return std::make_shared<Presence>(*presence); + } - Type getType() const { return type_; } - void setType(Type type) { type_ = type; } + Type getType() const { return type_; } + void setType(Type type) { type_ = type; } - StatusShow::Type getShow() const { - boost::shared_ptr<StatusShow> show(getPayload<StatusShow>()); - if (show) { - return show->getType(); - } - return type_ == Available ? StatusShow::Online : StatusShow::None; - } + StatusShow::Type getShow() const { + std::shared_ptr<StatusShow> show(getPayload<StatusShow>()); + if (show) { + return show->getType(); + } + return type_ == Available ? StatusShow::Online : StatusShow::None; + } - void setShow(const StatusShow::Type &show) { - updatePayload(boost::make_shared<StatusShow>(show)); - } + void setShow(const StatusShow::Type &show) { + updatePayload(std::make_shared<StatusShow>(show)); + } - std::string getStatus() const; - void setStatus(const std::string& status); + std::string getStatus() const; + void setStatus(const std::string& status); - int getPriority() const; - void setPriority(int priority); + int getPriority() const; + void setPriority(int priority); - boost::shared_ptr<Presence> clone() const { - return boost::make_shared<Presence>(*this); - } + std::shared_ptr<Presence> clone() const { + return std::make_shared<Presence>(*this); + } - bool isAvailable() const { - return type_ == Available; - } + bool isAvailable() const { + return type_ == Available; + } - private: - Presence::Type type_; - }; + private: + Presence::Type type_; + }; } diff --git a/Swiften/Elements/Priority.h b/Swiften/Elements/Priority.h index 6de42b4..56e493c 100644 --- a/Swiften/Elements/Priority.h +++ b/Swiften/Elements/Priority.h @@ -10,20 +10,20 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Priority : public Payload { - public: - Priority(int priority = 0) : priority_(priority) { - } + class SWIFTEN_API Priority : public Payload { + public: + Priority(int priority = 0) : priority_(priority) { + } - void setPriority(int priority) { - priority_ = priority; - } + void setPriority(int priority) { + priority_ = priority; + } - int getPriority() const { - return priority_; - } + int getPriority() const { + return priority_; + } - private: - int priority_; - }; + private: + int priority_; + }; } diff --git a/Swiften/Elements/PrivateStorage.h b/Swiften/Elements/PrivateStorage.h index 15455b8..dfae34c 100644 --- a/Swiften/Elements/PrivateStorage.h +++ b/Swiften/Elements/PrivateStorage.h @@ -1,31 +1,31 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PrivateStorage : public Payload { - public: - PrivateStorage(boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()) : payload(payload) { - } + class SWIFTEN_API PrivateStorage : public Payload { + public: + PrivateStorage(std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()) : payload(payload) { + } - boost::shared_ptr<Payload> getPayload() const { - return payload; - } + std::shared_ptr<Payload> getPayload() const { + return payload; + } - void setPayload(boost::shared_ptr<Payload> p) { - payload = p; - } + void setPayload(std::shared_ptr<Payload> p) { + payload = p; + } - private: - boost::shared_ptr<Payload> payload; - }; + private: + std::shared_ptr<Payload> payload; + }; } diff --git a/Swiften/Elements/ProtocolHeader.h b/Swiften/Elements/ProtocolHeader.h index a38f806..4ae545a 100644 --- a/Swiften/Elements/ProtocolHeader.h +++ b/Swiften/Elements/ProtocolHeader.h @@ -11,34 +11,34 @@ #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API ProtocolHeader { - public: - ProtocolHeader() : version("1.0") {} - - const std::string& getTo() const { return to; } - void setTo(const std::string& a) { - to = a; - } - - const std::string& getFrom() const { return from; } - void setFrom(const std::string& a) { - from = a; - } - - const std::string& getVersion() const { return version; } - void setVersion(const std::string& a) { - version = a; - } - - const std::string& getID() const { return id; } - void setID(const std::string& a) { - id = a; - } - - private: - std::string to; - std::string from; - std::string id; - std::string version; - }; + class SWIFTEN_API ProtocolHeader { + public: + ProtocolHeader() : version("1.0") {} + + const std::string& getTo() const { return to; } + void setTo(const std::string& a) { + to = a; + } + + const std::string& getFrom() const { return from; } + void setFrom(const std::string& a) { + from = a; + } + + const std::string& getVersion() const { return version; } + void setVersion(const std::string& a) { + version = a; + } + + const std::string& getID() const { return id; } + void setID(const std::string& a) { + id = a; + } + + private: + std::string to; + std::string from; + std::string id; + std::string version; + }; } diff --git a/Swiften/Elements/PubSub.h b/Swiften/Elements/PubSub.h index a1b2075..d62c54e 100644 --- a/Swiften/Elements/PubSub.h +++ b/Swiften/Elements/PubSub.h @@ -1,21 +1,20 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/ContainerPayload.h> - #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSub : public ContainerPayload<PubSubPayload> { - public: - PubSub(); - virtual ~PubSub(); - }; + class SWIFTEN_API PubSub : public ContainerPayload<PubSubPayload> { + public: + PubSub(); + virtual ~PubSub(); + }; } diff --git a/Swiften/Elements/PubSubAffiliation.h b/Swiften/Elements/PubSubAffiliation.h index fb96160..b19e84b 100644 --- a/Swiften/Elements/PubSubAffiliation.h +++ b/Swiften/Elements/PubSubAffiliation.h @@ -1,53 +1,52 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <string> - +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubAffiliation : public Payload { - public: - enum Type { - None, - Member, - Outcast, - Owner, - Publisher, - PublishOnly - }; - - PubSubAffiliation(); - PubSubAffiliation(const std::string& node) : node(node), type(None) {} - virtual ~PubSubAffiliation(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - Type getType() const { - return type; - } - - void setType(Type value) { - this->type = value ; - } - - - private: - std::string node; - Type type; - }; + class SWIFTEN_API PubSubAffiliation : public Payload { + public: + enum Type { + None, + Member, + Outcast, + Owner, + Publisher, + PublishOnly + }; + + PubSubAffiliation(); + PubSubAffiliation(const std::string& node) : node(node), type(None) {} + virtual ~PubSubAffiliation(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + std::string node; + Type type; + }; } diff --git a/Swiften/Elements/PubSubAffiliations.h b/Swiften/Elements/PubSubAffiliations.h index 4fe6896..c7e22ce 100644 --- a/Swiften/Elements/PubSubAffiliations.h +++ b/Swiften/Elements/PubSubAffiliations.h @@ -1,53 +1,54 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubAffiliation.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubAffiliations : public PubSubPayload { - public: - - PubSubAffiliations(); - - virtual ~PubSubAffiliations(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubAffiliation> >& getAffiliations() const { - return affiliations; - } - - void setAffiliations(const std::vector< boost::shared_ptr<PubSubAffiliation> >& value) { - this->affiliations = value ; - } - - void addAffiliation(boost::shared_ptr<PubSubAffiliation> value) { - this->affiliations.push_back(value); - } - - - private: - boost::optional< std::string > node; - std::vector< boost::shared_ptr<PubSubAffiliation> > affiliations; - }; + class SWIFTEN_API PubSubAffiliations : public PubSubPayload { + public: + + PubSubAffiliations(); + + virtual ~PubSubAffiliations(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubAffiliation> >& getAffiliations() const { + return affiliations; + } + + void setAffiliations(const std::vector< std::shared_ptr<PubSubAffiliation> >& value) { + this->affiliations = value ; + } + + void addAffiliation(std::shared_ptr<PubSubAffiliation> value) { + this->affiliations.push_back(value); + } + + + private: + boost::optional< std::string > node; + std::vector< std::shared_ptr<PubSubAffiliation> > affiliations; + }; } diff --git a/Swiften/Elements/PubSubConfigure.h b/Swiften/Elements/PubSubConfigure.h index 125ef60..8442198 100644 --- a/Swiften/Elements/PubSubConfigure.h +++ b/Swiften/Elements/PubSubConfigure.h @@ -1,36 +1,36 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubConfigure : public Payload { - public: - - PubSubConfigure(); - - virtual ~PubSubConfigure(); + class SWIFTEN_API PubSubConfigure : public Payload { + public: + + PubSubConfigure(); + + virtual ~PubSubConfigure(); - boost::shared_ptr<Form> getData() const { - return data; - } + std::shared_ptr<Form> getData() const { + return data; + } - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } + void setData(std::shared_ptr<Form> value) { + this->data = value ; + } - private: - boost::shared_ptr<Form> data; - }; + private: + std::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubCreate.h b/Swiften/Elements/PubSubCreate.h index 4c9ac76..5ece36e 100644 --- a/Swiften/Elements/PubSubCreate.h +++ b/Swiften/Elements/PubSubCreate.h @@ -1,47 +1,47 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubConfigure.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubCreate : public PubSubPayload { - public: - - PubSubCreate(); - PubSubCreate(const std::string& node) : node(node) {} - virtual ~PubSubCreate(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - boost::shared_ptr<PubSubConfigure> getConfigure() const { - return configure; - } - - void setConfigure(boost::shared_ptr<PubSubConfigure> value) { - this->configure = value ; - } - - - private: - std::string node; - boost::shared_ptr<PubSubConfigure> configure; - }; + class SWIFTEN_API PubSubCreate : public PubSubPayload { + public: + + PubSubCreate(); + PubSubCreate(const std::string& node) : node(node) {} + virtual ~PubSubCreate(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + std::shared_ptr<PubSubConfigure> getConfigure() const { + return configure; + } + + void setConfigure(std::shared_ptr<PubSubConfigure> value) { + this->configure = value ; + } + + + private: + std::string node; + std::shared_ptr<PubSubConfigure> configure; + }; } diff --git a/Swiften/Elements/PubSubDefault.h b/Swiften/Elements/PubSubDefault.h index b63ae72..08482b4 100644 --- a/Swiften/Elements/PubSubDefault.h +++ b/Swiften/Elements/PubSubDefault.h @@ -1,51 +1,52 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubDefault : public PubSubPayload { - public: - enum Type { - None, - Collection, - Leaf - }; - - PubSubDefault(); - - virtual ~PubSubDefault(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - Type getType() const { - return type; - } - - void setType(Type value) { - this->type = value ; - } - - - private: - boost::optional< std::string > node; - Type type; - }; + class SWIFTEN_API PubSubDefault : public PubSubPayload { + public: + enum Type { + None, + Collection, + Leaf + }; + + PubSubDefault(); + + virtual ~PubSubDefault(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + boost::optional< std::string > node; + Type type; + }; } diff --git a/Swiften/Elements/PubSubError.h b/Swiften/Elements/PubSubError.h index 8fc957c..2d4452a 100644 --- a/Swiften/Elements/PubSubError.h +++ b/Swiften/Elements/PubSubError.h @@ -9,103 +9,103 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubError : public Payload { - public: - enum Type { - UnknownType = 0, - ClosedNode, - ConfigurationRequired, - InvalidJID, - InvalidOptions, - InvalidPayload, - InvalidSubscriptionID, - ItemForbidden, - ItemRequired, - JIDRequired, - MaximumItemsExceeded, - MaximumNodesExceeded, - NodeIDRequired, - NotInRosterGroup, - NotSubscribed, - PayloadTooBig, - PayloadRequired, - PendingSubscription, - PresenceSubscriptionRequired, - SubscriptionIDRequired, - TooManySubscriptions, - Unsupported, - UnsupportedAccessModel - }; + class SWIFTEN_API PubSubError : public Payload { + public: + enum Type { + UnknownType = 0, + ClosedNode, + ConfigurationRequired, + InvalidJID, + InvalidOptions, + InvalidPayload, + InvalidSubscriptionID, + ItemForbidden, + ItemRequired, + JIDRequired, + MaximumItemsExceeded, + MaximumNodesExceeded, + NodeIDRequired, + NotInRosterGroup, + NotSubscribed, + PayloadTooBig, + PayloadRequired, + PendingSubscription, + PresenceSubscriptionRequired, + SubscriptionIDRequired, + TooManySubscriptions, + Unsupported, + UnsupportedAccessModel + }; - enum UnsupportedFeatureType { - UnknownUnsupportedFeatureType = 0, - AccessAuthorize, - AccessOpen, - AccessPresence, - AccessRoster, - AccessWhitelist, - AutoCreate, - AutoSubscribe, - Collections, - ConfigNode, - CreateAndConfigure, - CreateNodes, - DeleteItems, - DeleteNodes, - FilteredNotifications, - GetPending, - InstantNodes, - ItemIDs, - LastPublished, - LeasedSubscription, - ManageSubscriptions, - MemberAffiliation, - MetaData, - ModifyAffiliations, - MultiCollection, - MultiSubscribe, - OutcastAffiliation, - PersistentItems, - PresenceNotifications, - PresenceSubscribe, - Publish, - PublishOptions, - PublishOnlyAffiliation, - PublisherAffiliation, - PurgeNodes, - RetractItems, - RetrieveAffiliations, - RetrieveDefault, - RetrieveItems, - RetrieveSubscriptions, - Subscribe, - SubscriptionOptions, - SubscriptionNotifications - }; + enum UnsupportedFeatureType { + UnknownUnsupportedFeatureType = 0, + AccessAuthorize, + AccessOpen, + AccessPresence, + AccessRoster, + AccessWhitelist, + AutoCreate, + AutoSubscribe, + Collections, + ConfigNode, + CreateAndConfigure, + CreateNodes, + DeleteItems, + DeleteNodes, + FilteredNotifications, + GetPending, + InstantNodes, + ItemIDs, + LastPublished, + LeasedSubscription, + ManageSubscriptions, + MemberAffiliation, + MetaData, + ModifyAffiliations, + MultiCollection, + MultiSubscribe, + OutcastAffiliation, + PersistentItems, + PresenceNotifications, + PresenceSubscribe, + Publish, + PublishOptions, + PublishOnlyAffiliation, + PublisherAffiliation, + PurgeNodes, + RetractItems, + RetrieveAffiliations, + RetrieveDefault, + RetrieveItems, + RetrieveSubscriptions, + Subscribe, + SubscriptionOptions, + SubscriptionNotifications + }; - PubSubError(Type type = UnknownType) : type(type), unsupportedType(UnknownUnsupportedFeatureType) { - } + PubSubError(Type type = UnknownType) : type(type), unsupportedType(UnknownUnsupportedFeatureType) { + } - virtual ~PubSubError(); + virtual ~PubSubError(); - Type getType() const { - return type; - } + Type getType() const { + return type; + } - void setType(Type type) { - this->type = type; - } + void setType(Type type) { + this->type = type; + } - UnsupportedFeatureType getUnsupportedFeatureType() const { - return unsupportedType; - } + UnsupportedFeatureType getUnsupportedFeatureType() const { + return unsupportedType; + } - void setUnsupportedFeatureType(UnsupportedFeatureType unsupportedType) { - this->unsupportedType = unsupportedType; - } + void setUnsupportedFeatureType(UnsupportedFeatureType unsupportedType) { + this->unsupportedType = unsupportedType; + } - private: - Type type; - UnsupportedFeatureType unsupportedType; - }; + private: + Type type; + UnsupportedFeatureType unsupportedType; + }; } diff --git a/Swiften/Elements/PubSubEvent.h b/Swiften/Elements/PubSubEvent.h index 1bb8a15..8f02258 100644 --- a/Swiften/Elements/PubSubEvent.h +++ b/Swiften/Elements/PubSubEvent.h @@ -1,23 +1,23 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/ContainerPayload.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventPayload.h> namespace Swift { - class SWIFTEN_API PubSubEvent : public ContainerPayload<PubSubEventPayload> { - public: - PubSubEvent(); - virtual ~PubSubEvent(); - }; + class SWIFTEN_API PubSubEvent : public ContainerPayload<PubSubEventPayload> { + public: + PubSubEvent(); + virtual ~PubSubEvent(); + }; } diff --git a/Swiften/Elements/PubSubEventAssociate.h b/Swiften/Elements/PubSubEventAssociate.h index f521d86..5d963a0 100644 --- a/Swiften/Elements/PubSubEventAssociate.h +++ b/Swiften/Elements/PubSubEventAssociate.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <string> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <string> +namespace Swift { + class SWIFTEN_API PubSubEventAssociate : public Payload { + public: + PubSubEventAssociate(); -namespace Swift { - class SWIFTEN_API PubSubEventAssociate : public Payload { - public: - - PubSubEventAssociate(); - - virtual ~PubSubEventAssociate(); + virtual ~PubSubEventAssociate(); - const std::string& getNode() const { - return node; - } + const std::string& getNode() const { + return node; + } - void setNode(const std::string& value) { - this->node = value ; - } + void setNode(const std::string& value) { + this->node = value ; + } - private: - std::string node; - }; + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventCollection.h b/Swiften/Elements/PubSubEventCollection.h index cbdb959..61056e2 100644 --- a/Swiften/Elements/PubSubEventCollection.h +++ b/Swiften/Elements/PubSubEventCollection.h @@ -1,58 +1,59 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventAssociate.h> #include <Swiften/Elements/PubSubEventDisassociate.h> #include <Swiften/Elements/PubSubEventPayload.h> namespace Swift { - class SWIFTEN_API PubSubEventCollection : public PubSubEventPayload { - public: - - PubSubEventCollection(); - - virtual ~PubSubEventCollection(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - boost::shared_ptr<PubSubEventDisassociate> getDisassociate() const { - return disassociate; - } - - void setDisassociate(boost::shared_ptr<PubSubEventDisassociate> value) { - this->disassociate = value ; - } - - boost::shared_ptr<PubSubEventAssociate> getAssociate() const { - return associate; - } - - void setAssociate(boost::shared_ptr<PubSubEventAssociate> value) { - this->associate = value ; - } - - - private: - boost::optional< std::string > node; - boost::shared_ptr<PubSubEventDisassociate> disassociate; - boost::shared_ptr<PubSubEventAssociate> associate; - }; + class SWIFTEN_API PubSubEventCollection : public PubSubEventPayload { + public: + + PubSubEventCollection(); + + virtual ~PubSubEventCollection(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + std::shared_ptr<PubSubEventDisassociate> getDisassociate() const { + return disassociate; + } + + void setDisassociate(std::shared_ptr<PubSubEventDisassociate> value) { + this->disassociate = value ; + } + + std::shared_ptr<PubSubEventAssociate> getAssociate() const { + return associate; + } + + void setAssociate(std::shared_ptr<PubSubEventAssociate> value) { + this->associate = value ; + } + + + private: + boost::optional< std::string > node; + std::shared_ptr<PubSubEventDisassociate> disassociate; + std::shared_ptr<PubSubEventAssociate> associate; + }; } diff --git a/Swiften/Elements/PubSubEventConfiguration.h b/Swiften/Elements/PubSubEventConfiguration.h index 0ac0b23..6c5305d 100644 --- a/Swiften/Elements/PubSubEventConfiguration.h +++ b/Swiften/Elements/PubSubEventConfiguration.h @@ -1,47 +1,47 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventPayload.h> namespace Swift { - class SWIFTEN_API PubSubEventConfiguration : public PubSubEventPayload { - public: - - PubSubEventConfiguration(); - - virtual ~PubSubEventConfiguration(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - boost::shared_ptr<Form> getData() const { - return data; - } - - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } - - - private: - std::string node; - boost::shared_ptr<Form> data; - }; + class SWIFTEN_API PubSubEventConfiguration : public PubSubEventPayload { + public: + + PubSubEventConfiguration(); + + virtual ~PubSubEventConfiguration(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + std::shared_ptr<Form> getData() const { + return data; + } + + void setData(std::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + std::string node; + std::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubEventDelete.h b/Swiften/Elements/PubSubEventDelete.h index 71a972c..787dce0 100644 --- a/Swiften/Elements/PubSubEventDelete.h +++ b/Swiften/Elements/PubSubEventDelete.h @@ -1,47 +1,47 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventPayload.h> #include <Swiften/Elements/PubSubEventRedirect.h> namespace Swift { - class SWIFTEN_API PubSubEventDelete : public PubSubEventPayload { - public: - - PubSubEventDelete(); - - virtual ~PubSubEventDelete(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - boost::shared_ptr<PubSubEventRedirect> getRedirects() const { - return redirects; - } - - void setRedirects(boost::shared_ptr<PubSubEventRedirect> value) { - this->redirects = value ; - } - - - private: - std::string node; - boost::shared_ptr<PubSubEventRedirect> redirects; - }; + class SWIFTEN_API PubSubEventDelete : public PubSubEventPayload { + public: + + PubSubEventDelete(); + + virtual ~PubSubEventDelete(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + std::shared_ptr<PubSubEventRedirect> getRedirects() const { + return redirects; + } + + void setRedirects(std::shared_ptr<PubSubEventRedirect> value) { + this->redirects = value ; + } + + + private: + std::string node; + std::shared_ptr<PubSubEventRedirect> redirects; + }; } diff --git a/Swiften/Elements/PubSubEventDisassociate.h b/Swiften/Elements/PubSubEventDisassociate.h index 0377c23..826b1f4 100644 --- a/Swiften/Elements/PubSubEventDisassociate.h +++ b/Swiften/Elements/PubSubEventDisassociate.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <string> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <string> +namespace Swift { + class SWIFTEN_API PubSubEventDisassociate : public Payload { + public: + PubSubEventDisassociate(); -namespace Swift { - class SWIFTEN_API PubSubEventDisassociate : public Payload { - public: - - PubSubEventDisassociate(); - - virtual ~PubSubEventDisassociate(); + virtual ~PubSubEventDisassociate(); - const std::string& getNode() const { - return node; - } + const std::string& getNode() const { + return node; + } - void setNode(const std::string& value) { - this->node = value ; - } + void setNode(const std::string& value) { + this->node = value ; + } - private: - std::string node; - }; + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventItem.h b/Swiften/Elements/PubSubEventItem.h index 17c3a52..50e8757 100644 --- a/Swiften/Elements/PubSubEventItem.h +++ b/Swiften/Elements/PubSubEventItem.h @@ -1,70 +1,70 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventItem : public Payload { - public: - - PubSubEventItem(); - - virtual ~PubSubEventItem(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const boost::optional< std::string >& getPublisher() const { - return publisher; - } - - void setPublisher(const boost::optional< std::string >& value) { - this->publisher = value ; - } - - const std::vector< boost::shared_ptr<Payload> >& getData() const { - return data; - } - - void setData(const std::vector< boost::shared_ptr<Payload> >& value) { - this->data = value ; - } - - void addData(boost::shared_ptr<Payload> value) { - this->data.push_back(value); - } - - const boost::optional< std::string >& getID() const { - return id; - } - - void setID(const boost::optional< std::string >& value) { - this->id = value ; - } - - - private: - boost::optional< std::string > node; - boost::optional< std::string > publisher; - std::vector< boost::shared_ptr<Payload> > data; - boost::optional< std::string > id; - }; + class SWIFTEN_API PubSubEventItem : public Payload { + public: + + PubSubEventItem(); + + virtual ~PubSubEventItem(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const boost::optional< std::string >& getPublisher() const { + return publisher; + } + + void setPublisher(const boost::optional< std::string >& value) { + this->publisher = value ; + } + + const std::vector< std::shared_ptr<Payload> >& getData() const { + return data; + } + + void setData(const std::vector< std::shared_ptr<Payload> >& value) { + this->data = value ; + } + + void addData(std::shared_ptr<Payload> value) { + this->data.push_back(value); + } + + const boost::optional< std::string >& getID() const { + return id; + } + + void setID(const boost::optional< std::string >& value) { + this->id = value ; + } + + + private: + boost::optional< std::string > node; + boost::optional< std::string > publisher; + std::vector< std::shared_ptr<Payload> > data; + boost::optional< std::string > id; + }; } diff --git a/Swiften/Elements/PubSubEventItems.h b/Swiften/Elements/PubSubEventItems.h index e1d1269..48fd340 100644 --- a/Swiften/Elements/PubSubEventItems.h +++ b/Swiften/Elements/PubSubEventItems.h @@ -1,66 +1,66 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventItem.h> #include <Swiften/Elements/PubSubEventPayload.h> #include <Swiften/Elements/PubSubEventRetract.h> namespace Swift { - class SWIFTEN_API PubSubEventItems : public PubSubEventPayload { - public: - - PubSubEventItems(); - - virtual ~PubSubEventItems(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubEventItem> >& getItems() const { - return items; - } - - void setItems(const std::vector< boost::shared_ptr<PubSubEventItem> >& value) { - this->items = value ; - } - - void addItem(boost::shared_ptr<PubSubEventItem> value) { - this->items.push_back(value); - } - - const std::vector< boost::shared_ptr<PubSubEventRetract> >& getRetracts() const { - return retracts; - } - - void setRetracts(const std::vector< boost::shared_ptr<PubSubEventRetract> >& value) { - this->retracts = value ; - } - - void addRetract(boost::shared_ptr<PubSubEventRetract> value) { - this->retracts.push_back(value); - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubEventItem> > items; - std::vector< boost::shared_ptr<PubSubEventRetract> > retracts; - }; + class SWIFTEN_API PubSubEventItems : public PubSubEventPayload { + public: + + PubSubEventItems(); + + virtual ~PubSubEventItems(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubEventItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< std::shared_ptr<PubSubEventItem> >& value) { + this->items = value ; + } + + void addItem(std::shared_ptr<PubSubEventItem> value) { + this->items.push_back(value); + } + + const std::vector< std::shared_ptr<PubSubEventRetract> >& getRetracts() const { + return retracts; + } + + void setRetracts(const std::vector< std::shared_ptr<PubSubEventRetract> >& value) { + this->retracts = value ; + } + + void addRetract(std::shared_ptr<PubSubEventRetract> value) { + this->retracts.push_back(value); + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubEventItem> > items; + std::vector< std::shared_ptr<PubSubEventRetract> > retracts; + }; } diff --git a/Swiften/Elements/PubSubEventPayload.h b/Swiften/Elements/PubSubEventPayload.h index f1e3890..f4abc06 100644 --- a/Swiften/Elements/PubSubEventPayload.h +++ b/Swiften/Elements/PubSubEventPayload.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventPayload : public Payload { - public: - virtual ~PubSubEventPayload(); - }; + class SWIFTEN_API PubSubEventPayload : public Payload { + public: + virtual ~PubSubEventPayload(); + }; } diff --git a/Swiften/Elements/PubSubEventPurge.h b/Swiften/Elements/PubSubEventPurge.h index b878934..743cc25 100644 --- a/Swiften/Elements/PubSubEventPurge.h +++ b/Swiften/Elements/PubSubEventPurge.h @@ -1,36 +1,36 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventPayload.h> namespace Swift { - class SWIFTEN_API PubSubEventPurge : public PubSubEventPayload { - public: - - PubSubEventPurge(); - - virtual ~PubSubEventPurge(); + class SWIFTEN_API PubSubEventPurge : public PubSubEventPayload { + public: + + PubSubEventPurge(); + + virtual ~PubSubEventPurge(); - const std::string& getNode() const { - return node; - } + const std::string& getNode() const { + return node; + } - void setNode(const std::string& value) { - this->node = value ; - } + void setNode(const std::string& value) { + this->node = value ; + } - private: - std::string node; - }; + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventRedirect.h b/Swiften/Elements/PubSubEventRedirect.h index 9d10c6e..e0e351f 100644 --- a/Swiften/Elements/PubSubEventRedirect.h +++ b/Swiften/Elements/PubSubEventRedirect.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <string> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <string> +namespace Swift { + class SWIFTEN_API PubSubEventRedirect : public Payload { + public: + PubSubEventRedirect(); -namespace Swift { - class SWIFTEN_API PubSubEventRedirect : public Payload { - public: - - PubSubEventRedirect(); - - virtual ~PubSubEventRedirect(); + virtual ~PubSubEventRedirect(); - const std::string& getURI() const { - return uri; - } + const std::string& getURI() const { + return uri; + } - void setURI(const std::string& value) { - this->uri = value ; - } + void setURI(const std::string& value) { + this->uri = value ; + } - private: - std::string uri; - }; + private: + std::string uri; + }; } diff --git a/Swiften/Elements/PubSubEventRetract.h b/Swiften/Elements/PubSubEventRetract.h index 45c9a1f..b0aea96 100644 --- a/Swiften/Elements/PubSubEventRetract.h +++ b/Swiften/Elements/PubSubEventRetract.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <string> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <string> +namespace Swift { + class SWIFTEN_API PubSubEventRetract : public Payload { + public: + PubSubEventRetract(); -namespace Swift { - class SWIFTEN_API PubSubEventRetract : public Payload { - public: - - PubSubEventRetract(); - - virtual ~PubSubEventRetract(); + virtual ~PubSubEventRetract(); - const std::string& getID() const { - return id; - } + const std::string& getID() const { + return id; + } - void setID(const std::string& value) { - this->id = value ; - } + void setID(const std::string& value) { + this->id = value ; + } - private: - std::string id; - }; + private: + std::string id; + }; } diff --git a/Swiften/Elements/PubSubEventSubscription.h b/Swiften/Elements/PubSubEventSubscription.h index 80710f0..0b8297c 100644 --- a/Swiften/Elements/PubSubEventSubscription.h +++ b/Swiften/Elements/PubSubEventSubscription.h @@ -1,81 +1,82 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> +#include <string> + #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/optional.hpp> -#include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubEventPayload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubEventSubscription : public PubSubEventPayload { - public: - enum SubscriptionType { - None, - Pending, - Subscribed, - Unconfigured - }; - - PubSubEventSubscription(); - - virtual ~PubSubEventSubscription(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - SubscriptionType getSubscription() const { - return subscription; - } - - void setSubscription(SubscriptionType value) { - this->subscription = value ; - } - - const boost::optional< std::string >& getSubscriptionID() const { - return subscriptionID; - } - - void setSubscriptionID(const boost::optional< std::string >& value) { - this->subscriptionID = value ; - } - - const boost::posix_time::ptime& getExpiry() const { - return expiry; - } - - void setExpiry(const boost::posix_time::ptime& value) { - this->expiry = value ; - } - - - private: - std::string node; - JID jid; - SubscriptionType subscription; - boost::optional< std::string > subscriptionID; - boost::posix_time::ptime expiry; - }; + class SWIFTEN_API PubSubEventSubscription : public PubSubEventPayload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubEventSubscription(); + + virtual ~PubSubEventSubscription(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + const boost::posix_time::ptime& getExpiry() const { + return expiry; + } + + void setExpiry(const boost::posix_time::ptime& value) { + this->expiry = value ; + } + + + private: + std::string node; + JID jid; + SubscriptionType subscription; + boost::optional< std::string > subscriptionID; + boost::posix_time::ptime expiry; + }; } diff --git a/Swiften/Elements/PubSubItem.h b/Swiften/Elements/PubSubItem.h index 38e2560..d424ae4 100644 --- a/Swiften/Elements/PubSubItem.h +++ b/Swiften/Elements/PubSubItem.h @@ -1,51 +1,50 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubItem : public Payload { - public: - - PubSubItem(); - - virtual ~PubSubItem(); - - const std::vector< boost::shared_ptr<Payload> >& getData() const { - return data; - } - - void setData(const std::vector< boost::shared_ptr<Payload> >& value) { - this->data = value ; - } - - void addData(boost::shared_ptr<Payload> value) { - this->data.push_back(value); - } - - const std::string& getID() const { - return id; - } - - void setID(const std::string& value) { - this->id = value ; - } - - - private: - std::vector< boost::shared_ptr<Payload> > data; - std::string id; - }; + class SWIFTEN_API PubSubItem : public Payload { + public: + + PubSubItem(); + + virtual ~PubSubItem(); + + const std::vector< std::shared_ptr<Payload> >& getData() const { + return data; + } + + void setData(const std::vector< std::shared_ptr<Payload> >& value) { + this->data = value ; + } + + void addData(std::shared_ptr<Payload> value) { + this->data.push_back(value); + } + + const std::string& getID() const { + return id; + } + + void setID(const std::string& value) { + this->id = value ; + } + + + private: + std::vector< std::shared_ptr<Payload> > data; + std::string id; + }; } diff --git a/Swiften/Elements/PubSubItems.h b/Swiften/Elements/PubSubItems.h index d1200d2..9903075 100644 --- a/Swiften/Elements/PubSubItems.h +++ b/Swiften/Elements/PubSubItems.h @@ -1,71 +1,72 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubItem.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubItems : public PubSubPayload { - public: - - PubSubItems(); - PubSubItems(const std::string& node) : node(node) {} - virtual ~PubSubItems(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { - return items; - } - - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { - this->items = value ; - } - - void addItem(boost::shared_ptr<PubSubItem> value) { - this->items.push_back(value); - } - - const boost::optional< unsigned int >& getMaximumItems() const { - return maximumItems; - } - - void setMaximumItems(const boost::optional< unsigned int >& value) { - this->maximumItems = value ; - } - - const boost::optional< std::string >& getSubscriptionID() const { - return subscriptionID; - } - - void setSubscriptionID(const boost::optional< std::string >& value) { - this->subscriptionID = value ; - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; - boost::optional< unsigned int > maximumItems; - boost::optional< std::string > subscriptionID; - }; + class SWIFTEN_API PubSubItems : public PubSubPayload { + public: + + PubSubItems(); + PubSubItems(const std::string& node) : node(node) {} + virtual ~PubSubItems(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(std::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + const boost::optional< unsigned int >& getMaximumItems() const { + return maximumItems; + } + + void setMaximumItems(const boost::optional< unsigned int >& value) { + this->maximumItems = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubItem> > items; + boost::optional< unsigned int > maximumItems; + boost::optional< std::string > subscriptionID; + }; } diff --git a/Swiften/Elements/PubSubOptions.h b/Swiften/Elements/PubSubOptions.h index 0b0ff77..2b312a7 100644 --- a/Swiften/Elements/PubSubOptions.h +++ b/Swiften/Elements/PubSubOptions.h @@ -1,67 +1,68 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubPayload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubOptions : public PubSubPayload { - public: - - PubSubOptions(); - - virtual ~PubSubOptions(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - boost::shared_ptr<Form> getData() const { - return data; - } - - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } - - const boost::optional< std::string >& getSubscriptionID() const { - return subscriptionID; - } - - void setSubscriptionID(const boost::optional< std::string >& value) { - this->subscriptionID = value ; - } - - - private: - std::string node; - JID jid; - boost::shared_ptr<Form> data; - boost::optional< std::string > subscriptionID; - }; + class SWIFTEN_API PubSubOptions : public PubSubPayload { + public: + + PubSubOptions(); + + virtual ~PubSubOptions(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + std::shared_ptr<Form> getData() const { + return data; + } + + void setData(std::shared_ptr<Form> value) { + this->data = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + std::string node; + JID jid; + std::shared_ptr<Form> data; + boost::optional< std::string > subscriptionID; + }; } diff --git a/Swiften/Elements/PubSubOwnerAffiliation.h b/Swiften/Elements/PubSubOwnerAffiliation.h index 59060c5..a8c1d91 100644 --- a/Swiften/Elements/PubSubOwnerAffiliation.h +++ b/Swiften/Elements/PubSubOwnerAffiliation.h @@ -1,53 +1,51 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> - - #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubOwnerAffiliation : public Payload { - public: - enum Type { - None, - Member, - Outcast, - Owner, - Publisher, - PublishOnly - }; - - PubSubOwnerAffiliation(); - - virtual ~PubSubOwnerAffiliation(); - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - Type getType() const { - return type; - } - - void setType(Type value) { - this->type = value ; - } - - - private: - JID jid; - Type type; - }; + class SWIFTEN_API PubSubOwnerAffiliation : public Payload { + public: + enum Type { + None, + Member, + Outcast, + Owner, + Publisher, + PublishOnly + }; + + PubSubOwnerAffiliation(); + + virtual ~PubSubOwnerAffiliation(); + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + JID jid; + Type type; + }; } diff --git a/Swiften/Elements/PubSubOwnerAffiliations.h b/Swiften/Elements/PubSubOwnerAffiliations.h index 5e1b400..f1085bb 100644 --- a/Swiften/Elements/PubSubOwnerAffiliations.h +++ b/Swiften/Elements/PubSubOwnerAffiliations.h @@ -1,52 +1,52 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerAffiliation.h> #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerAffiliations : public PubSubOwnerPayload { - public: - - PubSubOwnerAffiliations(); - - virtual ~PubSubOwnerAffiliations(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& getAffiliations() const { - return affiliations; - } - - void setAffiliations(const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& value) { - this->affiliations = value ; - } - - void addAffiliation(boost::shared_ptr<PubSubOwnerAffiliation> value) { - this->affiliations.push_back(value); - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubOwnerAffiliation> > affiliations; - }; + class SWIFTEN_API PubSubOwnerAffiliations : public PubSubOwnerPayload { + public: + + PubSubOwnerAffiliations(); + + virtual ~PubSubOwnerAffiliations(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubOwnerAffiliation> >& getAffiliations() const { + return affiliations; + } + + void setAffiliations(const std::vector< std::shared_ptr<PubSubOwnerAffiliation> >& value) { + this->affiliations = value ; + } + + void addAffiliation(std::shared_ptr<PubSubOwnerAffiliation> value) { + this->affiliations.push_back(value); + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubOwnerAffiliation> > affiliations; + }; } diff --git a/Swiften/Elements/PubSubOwnerConfigure.h b/Swiften/Elements/PubSubOwnerConfigure.h index 34d4590..7dcf792 100644 --- a/Swiften/Elements/PubSubOwnerConfigure.h +++ b/Swiften/Elements/PubSubOwnerConfigure.h @@ -1,48 +1,49 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerConfigure : public PubSubOwnerPayload { - public: - - PubSubOwnerConfigure(); - PubSubOwnerConfigure(const std::string& node) : node(node) {} - virtual ~PubSubOwnerConfigure(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - boost::shared_ptr<Form> getData() const { - return data; - } - - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } - - - private: - boost::optional< std::string > node; - boost::shared_ptr<Form> data; - }; + class SWIFTEN_API PubSubOwnerConfigure : public PubSubOwnerPayload { + public: + + PubSubOwnerConfigure(); + PubSubOwnerConfigure(const std::string& node) : node(node) {} + virtual ~PubSubOwnerConfigure(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + std::shared_ptr<Form> getData() const { + return data; + } + + void setData(std::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::optional< std::string > node; + std::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubOwnerDefault.h b/Swiften/Elements/PubSubOwnerDefault.h index dd306cc..322f47a 100644 --- a/Swiften/Elements/PubSubOwnerDefault.h +++ b/Swiften/Elements/PubSubOwnerDefault.h @@ -1,37 +1,37 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerDefault : public PubSubOwnerPayload { - public: - - PubSubOwnerDefault(); - - virtual ~PubSubOwnerDefault(); + class SWIFTEN_API PubSubOwnerDefault : public PubSubOwnerPayload { + public: + + PubSubOwnerDefault(); + + virtual ~PubSubOwnerDefault(); - boost::shared_ptr<Form> getData() const { - return data; - } + std::shared_ptr<Form> getData() const { + return data; + } - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } + void setData(std::shared_ptr<Form> value) { + this->data = value ; + } - private: - boost::shared_ptr<Form> data; - }; + private: + std::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubOwnerDelete.h b/Swiften/Elements/PubSubOwnerDelete.h index 850f25a..7cc5d79 100644 --- a/Swiften/Elements/PubSubOwnerDelete.h +++ b/Swiften/Elements/PubSubOwnerDelete.h @@ -1,47 +1,47 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerPayload.h> #include <Swiften/Elements/PubSubOwnerRedirect.h> namespace Swift { - class SWIFTEN_API PubSubOwnerDelete : public PubSubOwnerPayload { - public: - - PubSubOwnerDelete(); - PubSubOwnerDelete(const std::string& node) : node(node) {} - virtual ~PubSubOwnerDelete(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - boost::shared_ptr<PubSubOwnerRedirect> getRedirect() const { - return redirect; - } - - void setRedirect(boost::shared_ptr<PubSubOwnerRedirect> value) { - this->redirect = value ; - } - - - private: - std::string node; - boost::shared_ptr<PubSubOwnerRedirect> redirect; - }; + class SWIFTEN_API PubSubOwnerDelete : public PubSubOwnerPayload { + public: + + PubSubOwnerDelete(); + PubSubOwnerDelete(const std::string& node) : node(node) {} + virtual ~PubSubOwnerDelete(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + std::shared_ptr<PubSubOwnerRedirect> getRedirect() const { + return redirect; + } + + void setRedirect(std::shared_ptr<PubSubOwnerRedirect> value) { + this->redirect = value ; + } + + + private: + std::string node; + std::shared_ptr<PubSubOwnerRedirect> redirect; + }; } diff --git a/Swiften/Elements/PubSubOwnerPayload.h b/Swiften/Elements/PubSubOwnerPayload.h index 3a90d8e..8381a17 100644 --- a/Swiften/Elements/PubSubOwnerPayload.h +++ b/Swiften/Elements/PubSubOwnerPayload.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerPayload : public Payload { - public: - virtual ~PubSubOwnerPayload(); - }; + class SWIFTEN_API PubSubOwnerPayload : public Payload { + public: + virtual ~PubSubOwnerPayload(); + }; } diff --git a/Swiften/Elements/PubSubOwnerPubSub.h b/Swiften/Elements/PubSubOwnerPubSub.h index 790437a..f3474cf 100644 --- a/Swiften/Elements/PubSubOwnerPubSub.h +++ b/Swiften/Elements/PubSubOwnerPubSub.h @@ -1,21 +1,20 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/ContainerPayload.h> - #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerPubSub : public ContainerPayload<PubSubOwnerPayload> { - public: - PubSubOwnerPubSub(); - virtual ~PubSubOwnerPubSub(); - }; + class SWIFTEN_API PubSubOwnerPubSub : public ContainerPayload<PubSubOwnerPayload> { + public: + PubSubOwnerPubSub(); + virtual ~PubSubOwnerPubSub(); + }; } diff --git a/Swiften/Elements/PubSubOwnerPurge.h b/Swiften/Elements/PubSubOwnerPurge.h index 182a5c7..aca48e1 100644 --- a/Swiften/Elements/PubSubOwnerPurge.h +++ b/Swiften/Elements/PubSubOwnerPurge.h @@ -1,36 +1,36 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerPurge : public PubSubOwnerPayload { - public: - - PubSubOwnerPurge(); - - virtual ~PubSubOwnerPurge(); + class SWIFTEN_API PubSubOwnerPurge : public PubSubOwnerPayload { + public: + + PubSubOwnerPurge(); + + virtual ~PubSubOwnerPurge(); - const std::string& getNode() const { - return node; - } + const std::string& getNode() const { + return node; + } - void setNode(const std::string& value) { - this->node = value ; - } + void setNode(const std::string& value) { + this->node = value ; + } - private: - std::string node; - }; + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubOwnerRedirect.h b/Swiften/Elements/PubSubOwnerRedirect.h index 042954e..c481f98 100644 --- a/Swiften/Elements/PubSubOwnerRedirect.h +++ b/Swiften/Elements/PubSubOwnerRedirect.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> +#include <string> + #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> -#include <string> +namespace Swift { + class SWIFTEN_API PubSubOwnerRedirect : public Payload { + public: + PubSubOwnerRedirect(); -namespace Swift { - class SWIFTEN_API PubSubOwnerRedirect : public Payload { - public: - - PubSubOwnerRedirect(); - - virtual ~PubSubOwnerRedirect(); + virtual ~PubSubOwnerRedirect(); - const std::string& getURI() const { - return uri; - } + const std::string& getURI() const { + return uri; + } - void setURI(const std::string& value) { - this->uri = value ; - } + void setURI(const std::string& value) { + this->uri = value ; + } - private: - std::string uri; - }; + private: + std::string uri; + }; } diff --git a/Swiften/Elements/PubSubOwnerSubscription.h b/Swiften/Elements/PubSubOwnerSubscription.h index 3af94f4..6a3fcc1 100644 --- a/Swiften/Elements/PubSubOwnerSubscription.h +++ b/Swiften/Elements/PubSubOwnerSubscription.h @@ -1,51 +1,49 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> - - #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubOwnerSubscription : public Payload { - public: - enum SubscriptionType { - None, - Pending, - Subscribed, - Unconfigured - }; - - PubSubOwnerSubscription(); - - virtual ~PubSubOwnerSubscription(); - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - SubscriptionType getSubscription() const { - return subscription; - } - - void setSubscription(SubscriptionType value) { - this->subscription = value ; - } - - - private: - JID jid; - SubscriptionType subscription; - }; + class SWIFTEN_API PubSubOwnerSubscription : public Payload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubOwnerSubscription(); + + virtual ~PubSubOwnerSubscription(); + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + + private: + JID jid; + SubscriptionType subscription; + }; } diff --git a/Swiften/Elements/PubSubOwnerSubscriptions.h b/Swiften/Elements/PubSubOwnerSubscriptions.h index f4ab174..ec5aa17 100644 --- a/Swiften/Elements/PubSubOwnerSubscriptions.h +++ b/Swiften/Elements/PubSubOwnerSubscriptions.h @@ -1,52 +1,52 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOwnerPayload.h> #include <Swiften/Elements/PubSubOwnerSubscription.h> namespace Swift { - class SWIFTEN_API PubSubOwnerSubscriptions : public PubSubOwnerPayload { - public: - - PubSubOwnerSubscriptions(); - - virtual ~PubSubOwnerSubscriptions(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& getSubscriptions() const { - return subscriptions; - } - - void setSubscriptions(const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& value) { - this->subscriptions = value ; - } - - void addSubscription(boost::shared_ptr<PubSubOwnerSubscription> value) { - this->subscriptions.push_back(value); - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubOwnerSubscription> > subscriptions; - }; + class SWIFTEN_API PubSubOwnerSubscriptions : public PubSubOwnerPayload { + public: + + PubSubOwnerSubscriptions(); + + virtual ~PubSubOwnerSubscriptions(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubOwnerSubscription> >& getSubscriptions() const { + return subscriptions; + } + + void setSubscriptions(const std::vector< std::shared_ptr<PubSubOwnerSubscription> >& value) { + this->subscriptions = value ; + } + + void addSubscription(std::shared_ptr<PubSubOwnerSubscription> value) { + this->subscriptions.push_back(value); + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubOwnerSubscription> > subscriptions; + }; } diff --git a/Swiften/Elements/PubSubPayload.h b/Swiften/Elements/PubSubPayload.h index c0fb905..7fc1882 100644 --- a/Swiften/Elements/PubSubPayload.h +++ b/Swiften/Elements/PubSubPayload.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubPayload : public Payload { - public: - virtual ~PubSubPayload(); - }; + class SWIFTEN_API PubSubPayload : public Payload { + public: + virtual ~PubSubPayload(); + }; } diff --git a/Swiften/Elements/PubSubPublish.h b/Swiften/Elements/PubSubPublish.h index e4aec02..dff099b 100644 --- a/Swiften/Elements/PubSubPublish.h +++ b/Swiften/Elements/PubSubPublish.h @@ -1,52 +1,52 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubItem.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubPublish : public PubSubPayload { - public: - - PubSubPublish(); - - virtual ~PubSubPublish(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { - return items; - } - - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { - this->items = value ; - } - - void addItem(boost::shared_ptr<PubSubItem> value) { - this->items.push_back(value); - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; - }; + class SWIFTEN_API PubSubPublish : public PubSubPayload { + public: + + PubSubPublish(); + + virtual ~PubSubPublish(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(std::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubItem> > items; + }; } diff --git a/Swiften/Elements/PubSubRetract.cpp b/Swiften/Elements/PubSubRetract.cpp index 90a63e6..1b188ee 100644 --- a/Swiften/Elements/PubSubRetract.cpp +++ b/Swiften/Elements/PubSubRetract.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ using namespace Swift; -PubSubRetract::PubSubRetract() : notify(false) { +PubSubRetract::PubSubRetract() { } PubSubRetract::~PubSubRetract() { diff --git a/Swiften/Elements/PubSubRetract.h b/Swiften/Elements/PubSubRetract.h index 15ecd00..2629c16 100644 --- a/Swiften/Elements/PubSubRetract.h +++ b/Swiften/Elements/PubSubRetract.h @@ -1,61 +1,62 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubItem.h> #include <Swiften/Elements/PubSubPayload.h> namespace Swift { - class SWIFTEN_API PubSubRetract : public PubSubPayload { - public: - - PubSubRetract(); - - virtual ~PubSubRetract(); - - const std::string& getNode() const { - return node; - } - - void setNode(const std::string& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { - return items; - } - - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { - this->items = value ; - } - - void addItem(boost::shared_ptr<PubSubItem> value) { - this->items.push_back(value); - } - - bool isNotify() const { - return notify; - } - - void setNotify(bool value) { - this->notify = value ; - } - - - private: - std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; - bool notify; - }; + class SWIFTEN_API PubSubRetract : public PubSubPayload { + public: + + PubSubRetract(); + + virtual ~PubSubRetract(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(std::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + boost::optional<bool> isNotify() const { + return notify; + } + + void setNotify(const boost::optional<bool>& value) { + this->notify = value ; + } + + + private: + std::string node; + std::vector< std::shared_ptr<PubSubItem> > items; + boost::optional<bool> notify; + }; } diff --git a/Swiften/Elements/PubSubSubscribe.h b/Swiften/Elements/PubSubSubscribe.h index 2b703da..a4c0b68 100644 --- a/Swiften/Elements/PubSubSubscribe.h +++ b/Swiften/Elements/PubSubSubscribe.h @@ -1,58 +1,59 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubOptions.h> #include <Swiften/Elements/PubSubPayload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubSubscribe : public PubSubPayload { - public: - - PubSubSubscribe(); - - virtual ~PubSubSubscribe(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - boost::shared_ptr<PubSubOptions> getOptions() const { - return options; - } - - void setOptions(boost::shared_ptr<PubSubOptions> value) { - this->options = value ; - } - - - private: - boost::optional< std::string > node; - JID jid; - boost::shared_ptr<PubSubOptions> options; - }; + class SWIFTEN_API PubSubSubscribe : public PubSubPayload { + public: + + PubSubSubscribe(); + + virtual ~PubSubSubscribe(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + std::shared_ptr<PubSubOptions> getOptions() const { + return options; + } + + void setOptions(std::shared_ptr<PubSubOptions> value) { + this->options = value ; + } + + + private: + boost::optional< std::string > node; + JID jid; + std::shared_ptr<PubSubOptions> options; + }; } diff --git a/Swiften/Elements/PubSubSubscribeOptions.h b/Swiften/Elements/PubSubSubscribeOptions.h index 70baa56..c837787 100644 --- a/Swiften/Elements/PubSubSubscribeOptions.h +++ b/Swiften/Elements/PubSubSubscribeOptions.h @@ -1,36 +1,33 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> #include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> +namespace Swift { + class SWIFTEN_API PubSubSubscribeOptions : public Payload { + public: + PubSubSubscribeOptions(); + virtual ~PubSubSubscribeOptions(); -namespace Swift { - class SWIFTEN_API PubSubSubscribeOptions : public Payload { - public: - - PubSubSubscribeOptions(); - - virtual ~PubSubSubscribeOptions(); - - bool isRequired() const { - return required; - } + bool isRequired() const { + return required; + } - void setRequired(bool value) { - this->required = value ; - } + void setRequired(bool value) { + this->required = value ; + } - private: - bool required; - }; + private: + bool required; + }; } diff --git a/Swiften/Elements/PubSubSubscription.h b/Swiften/Elements/PubSubSubscription.h index 5ebb791..e2b527f 100644 --- a/Swiften/Elements/PubSubSubscription.h +++ b/Swiften/Elements/PubSubSubscription.h @@ -1,82 +1,83 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubPayload.h> #include <Swiften/Elements/PubSubSubscribeOptions.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubSubscription : public PubSubPayload { - public: - enum SubscriptionType { - None, - Pending, - Subscribed, - Unconfigured - }; - - PubSubSubscription(); - - virtual ~PubSubSubscription(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const boost::optional< std::string >& getSubscriptionID() const { - return subscriptionID; - } - - void setSubscriptionID(const boost::optional< std::string >& value) { - this->subscriptionID = value ; - } - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - boost::shared_ptr<PubSubSubscribeOptions> getOptions() const { - return options; - } - - void setOptions(boost::shared_ptr<PubSubSubscribeOptions> value) { - this->options = value ; - } - - SubscriptionType getSubscription() const { - return subscription; - } - - void setSubscription(SubscriptionType value) { - this->subscription = value ; - } - - - private: - boost::optional< std::string > node; - boost::optional< std::string > subscriptionID; - JID jid; - boost::shared_ptr<PubSubSubscribeOptions> options; - SubscriptionType subscription; - }; + class SWIFTEN_API PubSubSubscription : public PubSubPayload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubSubscription(); + + virtual ~PubSubSubscription(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + std::shared_ptr<PubSubSubscribeOptions> getOptions() const { + return options; + } + + void setOptions(std::shared_ptr<PubSubSubscribeOptions> value) { + this->options = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + + private: + boost::optional< std::string > node; + boost::optional< std::string > subscriptionID; + JID jid; + std::shared_ptr<PubSubSubscribeOptions> options; + SubscriptionType subscription; + }; } diff --git a/Swiften/Elements/PubSubSubscriptions.h b/Swiften/Elements/PubSubSubscriptions.h index 9c1db6d..441e6c1 100644 --- a/Swiften/Elements/PubSubSubscriptions.h +++ b/Swiften/Elements/PubSubSubscriptions.h @@ -1,53 +1,54 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubPayload.h> #include <Swiften/Elements/PubSubSubscription.h> namespace Swift { - class SWIFTEN_API PubSubSubscriptions : public PubSubPayload { - public: - - PubSubSubscriptions(); - PubSubSubscriptions(const std::string& node) : node(node) {} - virtual ~PubSubSubscriptions(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const std::vector< boost::shared_ptr<PubSubSubscription> >& getSubscriptions() const { - return subscriptions; - } - - void setSubscriptions(const std::vector< boost::shared_ptr<PubSubSubscription> >& value) { - this->subscriptions = value ; - } - - void addSubscription(boost::shared_ptr<PubSubSubscription> value) { - this->subscriptions.push_back(value); - } - - - private: - boost::optional< std::string > node; - std::vector< boost::shared_ptr<PubSubSubscription> > subscriptions; - }; + class SWIFTEN_API PubSubSubscriptions : public PubSubPayload { + public: + + PubSubSubscriptions(); + PubSubSubscriptions(const std::string& node) : node(node) {} + virtual ~PubSubSubscriptions(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const std::vector< std::shared_ptr<PubSubSubscription> >& getSubscriptions() const { + return subscriptions; + } + + void setSubscriptions(const std::vector< std::shared_ptr<PubSubSubscription> >& value) { + this->subscriptions = value ; + } + + void addSubscription(std::shared_ptr<PubSubSubscription> value) { + this->subscriptions.push_back(value); + } + + + private: + boost::optional< std::string > node; + std::vector< std::shared_ptr<PubSubSubscription> > subscriptions; + }; } diff --git a/Swiften/Elements/PubSubUnsubscribe.h b/Swiften/Elements/PubSubUnsubscribe.h index 9c7bb0e..305af9a 100644 --- a/Swiften/Elements/PubSubUnsubscribe.h +++ b/Swiften/Elements/PubSubUnsubscribe.h @@ -1,56 +1,57 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> #include <string> +#include <boost/optional.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/PubSubPayload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API PubSubUnsubscribe : public PubSubPayload { - public: - - PubSubUnsubscribe(); - - virtual ~PubSubUnsubscribe(); - - const boost::optional< std::string >& getNode() const { - return node; - } - - void setNode(const boost::optional< std::string >& value) { - this->node = value ; - } - - const JID& getJID() const { - return jid; - } - - void setJID(const JID& value) { - this->jid = value ; - } - - const boost::optional< std::string >& getSubscriptionID() const { - return subscriptionID; - } - - void setSubscriptionID(const boost::optional< std::string >& value) { - this->subscriptionID = value ; - } - - - private: - boost::optional< std::string > node; - JID jid; - boost::optional< std::string > subscriptionID; - }; + class SWIFTEN_API PubSubUnsubscribe : public PubSubPayload { + public: + + PubSubUnsubscribe(); + + virtual ~PubSubUnsubscribe(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + boost::optional< std::string > node; + JID jid; + boost::optional< std::string > subscriptionID; + }; } diff --git a/Swiften/Elements/RawXMLPayload.h b/Swiften/Elements/RawXMLPayload.h index d1b104d..65901bc 100644 --- a/Swiften/Elements/RawXMLPayload.h +++ b/Swiften/Elements/RawXMLPayload.h @@ -12,19 +12,19 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API RawXMLPayload : public Payload { - public: - RawXMLPayload(const std::string& data = "") : rawXML_(data) {} + class SWIFTEN_API RawXMLPayload : public Payload { + public: + RawXMLPayload(const std::string& data = "") : rawXML_(data) {} - void setRawXML(const std::string& data) { - rawXML_ = data; - } + void setRawXML(const std::string& data) { + rawXML_ = data; + } - const std::string& getRawXML() const { - return rawXML_; - } + const std::string& getRawXML() const { + return rawXML_; + } - private: - std::string rawXML_; - }; + private: + std::string rawXML_; + }; } diff --git a/Swiften/Elements/Replace.h b/Swiften/Elements/Replace.h index eadc8fd..d51981d 100644 --- a/Swiften/Elements/Replace.h +++ b/Swiften/Elements/Replace.h @@ -5,31 +5,31 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Replace : public Payload { - public: - typedef boost::shared_ptr<Replace> ref; - Replace(const std::string& id = std::string()) : replaceID_(id) {} - const std::string& getID() const { - return replaceID_; - } - void setID(const std::string& id) { - replaceID_ = id; - } - private: - std::string replaceID_; - }; + class SWIFTEN_API Replace : public Payload { + public: + typedef std::shared_ptr<Replace> ref; + Replace(const std::string& id = std::string()) : replaceID_(id) {} + const std::string& getID() const { + return replaceID_; + } + void setID(const std::string& id) { + replaceID_ = id; + } + private: + std::string replaceID_; + }; } diff --git a/Swiften/Elements/ResourceBind.h b/Swiften/Elements/ResourceBind.h index 01d7e8b..fd6d4c7 100644 --- a/Swiften/Elements/ResourceBind.h +++ b/Swiften/Elements/ResourceBind.h @@ -8,33 +8,33 @@ #include <string> -#include <Swiften/Base/API.h> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API ResourceBind : public Payload { - public: - ResourceBind() {} - - void setJID(const JID& jid) { - jid_ = jid; - } - - const JID& getJID() const { - return jid_; - } - - void setResource(const std::string& resource) { - resource_ = resource; - } - - const std::string& getResource() const { - return resource_; - } - - private: - JID jid_; - std::string resource_; - }; + class SWIFTEN_API ResourceBind : public Payload { + public: + ResourceBind() {} + + void setJID(const JID& jid) { + jid_ = jid; + } + + const JID& getJID() const { + return jid_; + } + + void setResource(const std::string& resource) { + resource_ = resource; + } + + const std::string& getResource() const { + return resource_; + } + + private: + JID jid_; + std::string resource_; + }; } diff --git a/Swiften/Elements/ResultSet.h b/Swiften/Elements/ResultSet.h index e9bb6bd..c8e59d4 100644 --- a/Swiften/Elements/ResultSet.h +++ b/Swiften/Elements/ResultSet.h @@ -1,53 +1,56 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> + #include <boost/optional.hpp> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API ResultSet : public Payload { - public: - virtual ~ResultSet(); + class SWIFTEN_API ResultSet : public Payload { + public: + virtual ~ResultSet(); - void setMaxItems(const boost::optional<int>& maxItems) { maxItems_ = maxItems; } - const boost::optional<int>& getMaxItems() const { return maxItems_; } + void setMaxItems(const boost::optional<int>& maxItems) { maxItems_ = maxItems; } + const boost::optional<int>& getMaxItems() const { return maxItems_; } - void setCount(const boost::optional<int>& count) { count_ = count; } - const boost::optional<int>& getCount() const { return count_; } + void setCount(const boost::optional<int>& count) { count_ = count; } + const boost::optional<int>& getCount() const { return count_; } - void setIndex(const boost::optional<int>& index) { index_ = index; } - const boost::optional<int>& getIndex() const { return index_; } + void setIndex(const boost::optional<int>& index) { index_ = index; } + const boost::optional<int>& getIndex() const { return index_; } - void setFirstIDIndex(const boost::optional<int>& firstIndex) { firstIndex_ = firstIndex; } - const boost::optional<int>& getFirstIDIndex() const { return firstIndex_; } + void setFirstIDIndex(const boost::optional<int>& firstIndex) { firstIndex_ = firstIndex; } + const boost::optional<int>& getFirstIDIndex() const { return firstIndex_; } - void setFirstID(const boost::optional<std::string>& firstID) { firstID_ = firstID; } - const boost::optional<std::string>& getFirstID() const { return firstID_; } + void setFirstID(const boost::optional<std::string>& firstID) { firstID_ = firstID; } + const boost::optional<std::string>& getFirstID() const { return firstID_; } - void setLastID(const boost::optional<std::string>& lastID) { lastID_ = lastID; } - const boost::optional<std::string>& getLastID() const { return lastID_; } + void setLastID(const boost::optional<std::string>& lastID) { lastID_ = lastID; } + const boost::optional<std::string>& getLastID() const { return lastID_; } - void setBefore(const boost::optional<std::string>& before) { before_ = before; } - const boost::optional<std::string>& getBefore() const { return before_; } + void setBefore(const boost::optional<std::string>& before) { before_ = before; } + const boost::optional<std::string>& getBefore() const { return before_; } - void setAfter(const boost::optional<std::string>& after) { after_ = after; } - const boost::optional<std::string>& getAfter() const { return after_; } + void setAfter(const boost::optional<std::string>& after) { after_ = after; } + const boost::optional<std::string>& getAfter() const { return after_; } - private: - boost::optional<int> maxItems_; - boost::optional<int> count_; - boost::optional<int> index_; - boost::optional<int> firstIndex_; - boost::optional<std::string> firstID_; - boost::optional<std::string> lastID_; - boost::optional<std::string> before_; - boost::optional<std::string> after_; - }; + private: + boost::optional<int> maxItems_; + boost::optional<int> count_; + boost::optional<int> index_; + boost::optional<int> firstIndex_; + boost::optional<std::string> firstID_; + boost::optional<std::string> lastID_; + boost::optional<std::string> before_; + boost::optional<std::string> after_; + }; } diff --git a/Swiften/Elements/RosterItemExchangePayload.cpp b/Swiften/Elements/RosterItemExchangePayload.cpp index abd5296..79d0371 100644 --- a/Swiften/Elements/RosterItemExchangePayload.cpp +++ b/Swiften/Elements/RosterItemExchangePayload.cpp @@ -4,8 +4,13 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <Swiften/Elements/RosterItemExchangePayload.h> -#include <Swiften/Base/foreach.h> namespace Swift { diff --git a/Swiften/Elements/RosterItemExchangePayload.h b/Swiften/Elements/RosterItemExchangePayload.h index 622c775..fc61f3d 100644 --- a/Swiften/Elements/RosterItemExchangePayload.h +++ b/Swiften/Elements/RosterItemExchangePayload.h @@ -4,84 +4,90 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <vector> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> +#include <vector> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API RosterItemExchangePayload : public Payload { - public: - typedef boost::shared_ptr<RosterItemExchangePayload> ref; + class SWIFTEN_API RosterItemExchangePayload : public Payload { + public: + typedef std::shared_ptr<RosterItemExchangePayload> ref; - class SWIFTEN_API Item { - public: - enum Action { Add, Modify, Delete }; + class SWIFTEN_API Item { + public: + enum Action { Add, Modify, Delete }; - Item(Action action = Add); + Item(Action action = Add); - Action getAction() const { - return action; - } + Action getAction() const { + return action; + } - void setAction(Action action) { - this->action = action; - } + void setAction(Action action) { + this->action = action; + } - const JID& getJID() const { - return jid; - } + const JID& getJID() const { + return jid; + } - void setJID(const JID& jid) { - this->jid = jid; - } + void setJID(const JID& jid) { + this->jid = jid; + } - const std::string& getName() const { - return name; - } + const std::string& getName() const { + return name; + } - void setName(const std::string& name) { - this->name = name; - } + void setName(const std::string& name) { + this->name = name; + } - const std::vector<std::string>& getGroups() const { - return groups; - } + const std::vector<std::string>& getGroups() const { + return groups; + } - void setGroups(const std::vector<std::string> &groups) { - this->groups = groups; - } + void setGroups(const std::vector<std::string> &groups) { + this->groups = groups; + } - void addGroup(const std::string& group) { - groups.push_back(group); - } + void addGroup(const std::string& group) { + groups.push_back(group); + } - private: - Action action; - JID jid; - std::string name; - std::vector<std::string> groups; - }; + private: + Action action; + JID jid; + std::string name; + std::vector<std::string> groups; + }; - typedef std::vector<RosterItemExchangePayload::Item> RosterItemExchangePayloadItems; + typedef std::vector<RosterItemExchangePayload::Item> RosterItemExchangePayloadItems; - public: - RosterItemExchangePayload(); + public: + RosterItemExchangePayload(); - void addItem(const RosterItemExchangePayload::Item& item) { - items_.push_back(item); - } + void addItem(const RosterItemExchangePayload::Item& item) { + items_.push_back(item); + } - const RosterItemExchangePayloadItems& getItems() const { - return items_; - } + const RosterItemExchangePayloadItems& getItems() const { + return items_; + } - private: - RosterItemExchangePayloadItems items_; - }; + private: + RosterItemExchangePayloadItems items_; + }; } diff --git a/Swiften/Elements/RosterItemPayload.h b/Swiften/Elements/RosterItemPayload.h index 2228529..ea19fa5 100644 --- a/Swiften/Elements/RosterItemPayload.h +++ b/Swiften/Elements/RosterItemPayload.h @@ -1,52 +1,52 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> #include <string> +#include <vector> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API RosterItemPayload { - public: - enum Subscription { None, To, From, Both, Remove }; - - RosterItemPayload() : subscription_(None), ask_(false) {} - RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription, const std::vector<std::string>& groups = std::vector<std::string>()) : jid_(jid), name_(name), subscription_(subscription), groups_(groups), ask_(false) { } - - void setJID(const JID& jid) { jid_ = jid; } - const JID& getJID() const { return jid_; } - - void setName(const std::string& name) { name_ = name; } - const std::string& getName() const { return name_; } - - void setSubscription(Subscription subscription) { subscription_ = subscription; } - const Subscription& getSubscription() const { return subscription_; } - - void addGroup(const std::string& group) { groups_.push_back(group); } - void setGroups(const std::vector<std::string>& groups) { groups_ = groups; } - const std::vector<std::string>& getGroups() const { return groups_; } - - void setSubscriptionRequested() { ask_ = true; } - bool getSubscriptionRequested() const { return ask_; } - - const std::string& getUnknownContent() const { return unknownContent_; } - void addUnknownContent(const std::string& c) { - unknownContent_ += c; - } - - private: - JID jid_; - std::string name_; - Subscription subscription_; - std::vector<std::string> groups_; - bool ask_; - std::string unknownContent_; - }; + class SWIFTEN_API RosterItemPayload { + public: + enum Subscription { None, To, From, Both, Remove }; + + RosterItemPayload() : subscription_(None), ask_(false) {} + RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription, const std::vector<std::string>& groups = std::vector<std::string>()) : jid_(jid), name_(name), subscription_(subscription), groups_(groups), ask_(false) { } + + void setJID(const JID& jid) { jid_ = jid; } + const JID& getJID() const { return jid_; } + + void setName(const std::string& name) { name_ = name; } + const std::string& getName() const { return name_; } + + void setSubscription(Subscription subscription) { subscription_ = subscription; } + const Subscription& getSubscription() const { return subscription_; } + + void addGroup(const std::string& group) { groups_.push_back(group); } + void setGroups(const std::vector<std::string>& groups) { groups_ = groups; } + const std::vector<std::string>& getGroups() const { return groups_; } + + void setSubscriptionRequested() { ask_ = true; } + bool getSubscriptionRequested() const { return ask_; } + + const std::string& getUnknownContent() const { return unknownContent_; } + void addUnknownContent(const std::string& c) { + unknownContent_ += c; + } + + private: + JID jid_; + std::string name_; + Subscription subscription_; + std::vector<std::string> groups_; + bool ask_; + std::string unknownContent_; + }; } diff --git a/Swiften/Elements/RosterPayload.cpp b/Swiften/Elements/RosterPayload.cpp index a41f039..d745357 100644 --- a/Swiften/Elements/RosterPayload.cpp +++ b/Swiften/Elements/RosterPayload.cpp @@ -1,23 +1,22 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/RosterPayload.h> -#include <Swiften/Base/foreach.h> namespace Swift { boost::optional<RosterItemPayload> RosterPayload::getItem(const JID& jid) const { - foreach(const RosterItemPayload& item, items_) { - // FIXME: MSVC rejects this. Find out why. - //if (item.getJID() == jid) { - if (item.getJID().equals(jid, JID::WithResource)) { - return boost::optional<RosterItemPayload>(item); - } - } - return boost::optional<RosterItemPayload>(); + for (const auto& item : items_) { + // FIXME: MSVC rejects this. Find out why. + //if (item.getJID() == jid) { + if (item.getJID().equals(jid, JID::WithResource)) { + return boost::optional<RosterItemPayload>(item); + } + } + return boost::optional<RosterItemPayload>(); } } diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h index dba8ded..5fc6bd1 100644 --- a/Swiften/Elements/RosterPayload.h +++ b/Swiften/Elements/RosterPayload.h @@ -1,49 +1,49 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <vector> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/RosterItemPayload.h> #include <Swiften/Elements/Payload.h> - +#include <Swiften/Elements/RosterItemPayload.h> namespace Swift { - class SWIFTEN_API RosterPayload : public Payload { - public: - typedef boost::shared_ptr<RosterPayload> ref; - typedef std::vector<RosterItemPayload> RosterItemPayloads; + class SWIFTEN_API RosterPayload : public Payload { + public: + typedef std::shared_ptr<RosterPayload> ref; + typedef std::vector<RosterItemPayload> RosterItemPayloads; - public: - RosterPayload() {} + public: + RosterPayload() {} - boost::optional<RosterItemPayload> getItem(const JID& jid) const; + boost::optional<RosterItemPayload> getItem(const JID& jid) const; - void addItem(const RosterItemPayload& item) { - items_.push_back(item); - } + void addItem(const RosterItemPayload& item) { + items_.push_back(item); + } - const RosterItemPayloads& getItems() const { - return items_; - } + const RosterItemPayloads& getItems() const { + return items_; + } - const boost::optional<std::string>& getVersion() const { - return version_; - } + const boost::optional<std::string>& getVersion() const { + return version_; + } - void setVersion(const std::string& version) { - version_ = version; - } + void setVersion(const std::string& version) { + version_ = version; + } - private: - RosterItemPayloads items_; - boost::optional<std::string> version_; - }; + private: + RosterItemPayloads items_; + boost::optional<std::string> version_; + }; } diff --git a/Swiften/Elements/S5BProxyRequest.h b/Swiften/Elements/S5BProxyRequest.h index 2732f18..e3f5206 100644 --- a/Swiften/Elements/S5BProxyRequest.h +++ b/Swiften/Elements/S5BProxyRequest.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,45 +25,45 @@ namespace Swift { class SWIFTEN_API S5BProxyRequest : public Payload { public: - typedef boost::shared_ptr<S5BProxyRequest> ref; + typedef std::shared_ptr<S5BProxyRequest> ref; public: - struct StreamHost { - std::string host; - int port; - JID jid; - }; + struct StreamHost { + std::string host; + int port; + JID jid; + }; public: - const boost::optional<StreamHost>& getStreamHost() const { - return streamHost; - } + const boost::optional<StreamHost>& getStreamHost() const { + return streamHost; + } - void setStreamHost(const StreamHost& streamHost) { - this->streamHost = boost::optional<StreamHost>(streamHost); - } + void setStreamHost(const StreamHost& streamHost) { + this->streamHost = boost::optional<StreamHost>(streamHost); + } - const std::string& getSID() const { - return sid; - } + const std::string& getSID() const { + return sid; + } - void setSID(const std::string& sid) { - this->sid = sid; - } + void setSID(const std::string& sid) { + this->sid = sid; + } - const boost::optional<JID>& getActivate() const { - return activate; - } + const boost::optional<JID>& getActivate() const { + return activate; + } - void setActivate(const JID& activate) { - this->activate = activate; - } + void setActivate(const JID& activate) { + this->activate = activate; + } private: - boost::optional<StreamHost> streamHost; + boost::optional<StreamHost> streamHost; - std::string sid; - boost::optional<JID> activate; + std::string sid; + boost::optional<JID> activate; }; } diff --git a/Swiften/Elements/SearchPayload.h b/Swiften/Elements/SearchPayload.h index 1b1df0f..0fcb2b1 100644 --- a/Swiften/Elements/SearchPayload.h +++ b/Swiften/Elements/SearchPayload.h @@ -1,95 +1,96 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> -#include <string> +#include <Swiften/Elements/Payload.h> namespace Swift { - /** - * XEP-0055 search payload. - */ - class SWIFTEN_API SearchPayload : public Payload { - public: - typedef boost::shared_ptr<SearchPayload> ref; - - struct Item { - std::string first; - std::string last; - std::string nick; - std::string email; - JID jid; - }; - - SearchPayload() {} - - Form::ref getForm() const { return form; } - void setForm(Form::ref f) { form = f; } - - const boost::optional<std::string>& getInstructions() const { - return instructions; - } - - const boost::optional<std::string>& getNick() const { - return nick; - } - - const boost::optional<std::string>& getFirst() const { - return first; - } - - const boost::optional<std::string>& getLast() const { - return last; - } - - const boost::optional<std::string>& getEMail() const { - return email; - } - - void setInstructions(const std::string& v) { - this->instructions = v; - } - - void setNick(const std::string& v) { - this->nick = v; - } - - void setFirst(const std::string& v) { - this->first = v; - } - - void setLast(const std::string& v) { - this->last = v; - } - - void setEMail(const std::string& v) { - this->email = v; - } - - const std::vector<Item>& getItems() const { - return items; - } - - void addItem(const Item& item) { - items.push_back(item); - } - - private: - Form::ref form; - boost::optional<std::string> instructions; - boost::optional<std::string> nick; - boost::optional<std::string> first; - boost::optional<std::string> last; - boost::optional<std::string> email; - std::vector<Item> items; - }; + /** + * XEP-0055 search payload. + */ + class SWIFTEN_API SearchPayload : public Payload { + public: + typedef std::shared_ptr<SearchPayload> ref; + + struct Item { + std::string first; + std::string last; + std::string nick; + std::string email; + JID jid; + }; + + SearchPayload() {} + + Form::ref getForm() const { return form; } + void setForm(Form::ref f) { form = f; } + + const boost::optional<std::string>& getInstructions() const { + return instructions; + } + + const boost::optional<std::string>& getNick() const { + return nick; + } + + const boost::optional<std::string>& getFirst() const { + return first; + } + + const boost::optional<std::string>& getLast() const { + return last; + } + + const boost::optional<std::string>& getEMail() const { + return email; + } + + void setInstructions(const std::string& v) { + this->instructions = v; + } + + void setNick(const std::string& v) { + this->nick = v; + } + + void setFirst(const std::string& v) { + this->first = v; + } + + void setLast(const std::string& v) { + this->last = v; + } + + void setEMail(const std::string& v) { + this->email = v; + } + + const std::vector<Item>& getItems() const { + return items; + } + + void addItem(const Item& item) { + items.push_back(item); + } + + private: + Form::ref form; + boost::optional<std::string> instructions; + boost::optional<std::string> nick; + boost::optional<std::string> first; + boost::optional<std::string> last; + boost::optional<std::string> email; + std::vector<Item> items; + }; } diff --git a/Swiften/Elements/SecurityLabel.h b/Swiften/Elements/SecurityLabel.h index 401ff7a..748c65e 100644 --- a/Swiften/Elements/SecurityLabel.h +++ b/Swiften/Elements/SecurityLabel.h @@ -1,77 +1,76 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> #include <string> #include <vector> - +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API SecurityLabel : public Payload { - public: - - SecurityLabel(); - - virtual ~SecurityLabel(); - - const std::vector< std::string >& getEquivalentLabels() const { - return equivalentLabels; - } - - void setEquivalentLabels(const std::vector< std::string >& value) { - this->equivalentLabels = value ; - } - - void addEquivalentLabel(const std::string& value) { - this->equivalentLabels.push_back(value); - } - - const std::string& getForegroundColor() const { - return foregroundColor; - } - - void setForegroundColor(const std::string& value) { - this->foregroundColor = value ; - } - - const std::string& getDisplayMarking() const { - return displayMarking; - } - - void setDisplayMarking(const std::string& value) { - this->displayMarking = value ; - } - - const std::string& getBackgroundColor() const { - return backgroundColor; - } - - void setBackgroundColor(const std::string& value) { - this->backgroundColor = value ; - } - - const std::string& getLabel() const { - return label; - } - - void setLabel(const std::string& value) { - this->label = value ; - } - - - private: - std::vector< std::string > equivalentLabels; - std::string foregroundColor; - std::string displayMarking; - std::string backgroundColor; - std::string label; - }; + class SWIFTEN_API SecurityLabel : public Payload { + public: + + SecurityLabel(); + + virtual ~SecurityLabel(); + + const std::vector< std::string >& getEquivalentLabels() const { + return equivalentLabels; + } + + void setEquivalentLabels(const std::vector< std::string >& value) { + this->equivalentLabels = value ; + } + + void addEquivalentLabel(const std::string& value) { + this->equivalentLabels.push_back(value); + } + + const std::string& getForegroundColor() const { + return foregroundColor; + } + + void setForegroundColor(const std::string& value) { + this->foregroundColor = value ; + } + + const std::string& getDisplayMarking() const { + return displayMarking; + } + + void setDisplayMarking(const std::string& value) { + this->displayMarking = value ; + } + + const std::string& getBackgroundColor() const { + return backgroundColor; + } + + void setBackgroundColor(const std::string& value) { + this->backgroundColor = value ; + } + + const std::string& getLabel() const { + return label; + } + + void setLabel(const std::string& value) { + this->label = value ; + } + + + private: + std::vector< std::string > equivalentLabels; + std::string foregroundColor; + std::string displayMarking; + std::string backgroundColor; + std::string label; + }; } diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h index 3161c16..ba4d294 100644 --- a/Swiften/Elements/SecurityLabelsCatalog.h +++ b/Swiften/Elements/SecurityLabelsCatalog.h @@ -1,89 +1,89 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> +#include <vector> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/SecurityLabel.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API SecurityLabelsCatalog : public Payload { - public: - typedef boost::shared_ptr<SecurityLabelsCatalog> ref; - class Item { - public: - Item() : default_(false) {} - boost::shared_ptr<SecurityLabel> getLabel() const { - return label_; - } - - void setLabel(boost::shared_ptr<SecurityLabel> label) { - label_ = label; - } - - const std::string& getSelector() const { return selector_; } - - void setSelector(const std::string& selector) { - selector_ = selector; - } - - bool getIsDefault() const { return default_; } - - void setIsDefault(bool isDefault) { - default_ = isDefault; - } - private: - boost::shared_ptr<SecurityLabel> label_; - std::string selector_; - bool default_; - }; - SecurityLabelsCatalog(const JID& to = JID()) : to_(to) {} - - const std::vector<Item>& getItems() const { - return items_; - } - - void addItem(const Item& item) { - items_.push_back(item); - } - - const JID& getTo() const { - return to_; - } - - void setTo(const JID& to) { - to_ = to; - } - - const std::string& getName() const { - return name_; - } - - void setName(const std::string& name) { - name_ = name; - } - - const std::string& getDescription() const { - return description_; - } - - void setDescription(const std::string& description) { - description_ = description; - } - - private: - JID to_; - std::string name_; - std::string description_; - std::vector<Item> items_; - }; + class SWIFTEN_API SecurityLabelsCatalog : public Payload { + public: + typedef std::shared_ptr<SecurityLabelsCatalog> ref; + class Item { + public: + Item() : default_(false) {} + std::shared_ptr<SecurityLabel> getLabel() const { + return label_; + } + + void setLabel(std::shared_ptr<SecurityLabel> label) { + label_ = label; + } + + const std::string& getSelector() const { return selector_; } + + void setSelector(const std::string& selector) { + selector_ = selector; + } + + bool getIsDefault() const { return default_; } + + void setIsDefault(bool isDefault) { + default_ = isDefault; + } + private: + std::shared_ptr<SecurityLabel> label_; + std::string selector_; + bool default_; + }; + SecurityLabelsCatalog(const JID& to = JID()) : to_(to) {} + + const std::vector<Item>& getItems() const { + return items_; + } + + void addItem(const Item& item) { + items_.push_back(item); + } + + const JID& getTo() const { + return to_; + } + + void setTo(const JID& to) { + to_ = to; + } + + const std::string& getName() const { + return name_; + } + + void setName(const std::string& name) { + name_ = name; + } + + const std::string& getDescription() const { + return description_; + } + + void setDescription(const std::string& description) { + description_ = description; + } + + private: + JID to_; + std::string name_; + std::string description_; + std::vector<Item> items_; + }; } diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h index 6ad5ea5..2bf582e 100644 --- a/Swiften/Elements/SoftwareVersion.h +++ b/Swiften/Elements/SoftwareVersion.h @@ -1,55 +1,55 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API SoftwareVersion : public Payload { - public: - typedef boost::shared_ptr<SoftwareVersion> ref; - - SoftwareVersion( - const std::string& name = "", - const std::string& version = "", - const std::string& os = "") : - name_(name), version_(version), os_(os) {} - - const std::string& getName() const { - return name_; - } - - void setName(const std::string& name) { - name_ = name; - } - - const std::string& getVersion() const { - return version_; - } - - void setVersion(const std::string& version) { - version_ = version; - } - - const std::string& getOS() const { - return os_; - } - - void setOS(const std::string& os) { - os_ = os; - } - - private: - std::string name_; - std::string version_; - std::string os_; - }; + class SWIFTEN_API SoftwareVersion : public Payload { + public: + typedef std::shared_ptr<SoftwareVersion> ref; + + SoftwareVersion( + const std::string& name = "", + const std::string& version = "", + const std::string& os = "") : + name_(name), version_(version), os_(os) {} + + const std::string& getName() const { + return name_; + } + + void setName(const std::string& name) { + name_ = name; + } + + const std::string& getVersion() const { + return version_; + } + + void setVersion(const std::string& version) { + version_ = version; + } + + const std::string& getOS() const { + return os_; + } + + void setOS(const std::string& os) { + os_ = os; + } + + private: + std::string name_; + std::string version_; + std::string os_; + }; } diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp index f385e1c..0ff6b3c 100644 --- a/Swiften/Elements/Stanza.cpp +++ b/Swiften/Elements/Stanza.cpp @@ -10,60 +10,59 @@ #include <boost/bind.hpp> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/Delay.h> namespace Swift { Stanza::Stanza() { } - + Stanza::~Stanza() { - payloads_.clear(); + payloads_.clear(); } -void Stanza::updatePayload(boost::shared_ptr<Payload> payload) { - foreach (boost::shared_ptr<Payload>& i, payloads_) { - if (typeid(*i.get()) == typeid(*payload.get())) { - i = payload; - return; - } - } - addPayload(payload); +void Stanza::updatePayload(std::shared_ptr<Payload> payload) { + for (auto&& i : payloads_) { + if (typeid(*i.get()) == typeid(*payload.get())) { + i = payload; + return; + } + } + addPayload(payload); } -static bool sameType(boost::shared_ptr<Payload> a, boost::shared_ptr<Payload> b) { - return typeid(*a.get()) == typeid(*b.get()); +static bool sameType(std::shared_ptr<Payload> a, std::shared_ptr<Payload> b) { + return typeid(*a.get()) == typeid(*b.get()); } -void Stanza::removePayloadOfSameType(boost::shared_ptr<Payload> payload) { - payloads_.erase(std::remove_if(payloads_.begin(), payloads_.end(), - boost::bind<bool>(&sameType, payload, _1)), - payloads_.end()); +void Stanza::removePayloadOfSameType(std::shared_ptr<Payload> payload) { + payloads_.erase(std::remove_if(payloads_.begin(), payloads_.end(), + boost::bind<bool>(&sameType, payload, _1)), + payloads_.end()); } -boost::shared_ptr<Payload> Stanza::getPayloadOfSameType(boost::shared_ptr<Payload> payload) const { - foreach (const boost::shared_ptr<Payload>& i, payloads_) { - if (typeid(*i.get()) == typeid(*payload.get())) { - return i; - } - } - return boost::shared_ptr<Payload>(); +std::shared_ptr<Payload> Stanza::getPayloadOfSameType(std::shared_ptr<Payload> payload) const { + for (const auto& i : payloads_) { + if (typeid(*i.get()) == typeid(*payload.get())) { + return i; + } + } + return std::shared_ptr<Payload>(); } boost::optional<boost::posix_time::ptime> Stanza::getTimestamp() const { - boost::shared_ptr<Delay> delay = getPayload<Delay>(); - return delay ? delay->getStamp() : boost::optional<boost::posix_time::ptime>(); + std::shared_ptr<Delay> delay = getPayload<Delay>(); + return delay ? delay->getStamp() : boost::optional<boost::posix_time::ptime>(); } boost::optional<boost::posix_time::ptime> Stanza::getTimestampFrom(const JID& jid) const { - std::vector< boost::shared_ptr<Delay> > delays = getPayloads<Delay>(); - for (size_t i = 0; i < delays.size(); ++i) { - if (delays[i]->getFrom() == jid) { - return delays[i]->getStamp(); - } - } - return getTimestamp(); + std::vector< std::shared_ptr<Delay> > delays = getPayloads<Delay>(); + 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 212ce10..8b4916e 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -6,91 +6,96 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/date_time/posix_time/ptime.hpp> #include <boost/optional/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> #include <Swiften/JID/JID.h> namespace Swift { - class Payload; - - class SWIFTEN_API Stanza : public ToplevelElement { - 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); - } - - template<typename InputIterator> - void addPayloads(InputIterator begin, InputIterator end) { - payloads_.insert(payloads_.end(), begin, end); - } - - void updatePayload(boost::shared_ptr<Payload> payload); - - void removePayloadOfSameType(boost::shared_ptr<Payload>); - boost::shared_ptr<Payload> getPayloadOfSameType(boost::shared_ptr<Payload>) const; - - const JID& getFrom() const { return from_; } - void setFrom(const JID& from) { from_ = from; } - - const JID& getTo() const { return to_; } - void setTo(const JID& to) { to_ = to; } - - const std::string& getID() const { return id_; } - void setID(const std::string& id) { id_ = id; } - - boost::optional<boost::posix_time::ptime> getTimestamp() const; - - // Falls back to any timestamp if no specific timestamp for the given JID is found. - boost::optional<boost::posix_time::ptime> getTimestampFrom(const JID& jid) const; - - private: - std::string id_; - JID from_; - JID to_; - std::vector< boost::shared_ptr<Payload> > payloads_; - }; + class Payload; + + class SWIFTEN_API Stanza : public ToplevelElement { + public: + typedef std::shared_ptr<Stanza> ref; + + protected: + Stanza(); + + public: + virtual ~Stanza(); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza) + + template<typename T> + std::shared_ptr<T> getPayload() const { + for (const auto& payload : payloads_) { + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payload)); + if (result) { + return result; + } + } + return std::shared_ptr<T>(); + } + + template<typename T> + std::vector< std::shared_ptr<T> > getPayloads() const { + std::vector< std::shared_ptr<T> > results; + for (const auto& payload : payloads_) { + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payload)); + if (result) { + results.push_back(result); + } + } + return results; + } + + + const std::vector< std::shared_ptr<Payload> >& getPayloads() const { + return payloads_; + } + + void addPayload(std::shared_ptr<Payload> payload) { + payloads_.push_back(payload); + } + + template<typename InputIterator> + void addPayloads(InputIterator begin, InputIterator end) { + payloads_.insert(payloads_.end(), begin, end); + } + + template<typename Container> + void addPayloads(const Container& container) { + payloads_.insert(payloads_.end(), std::begin(container), std::end(container)); + } + + void updatePayload(std::shared_ptr<Payload> payload); + + void removePayloadOfSameType(std::shared_ptr<Payload>); + std::shared_ptr<Payload> getPayloadOfSameType(std::shared_ptr<Payload>) const; + + const JID& getFrom() const { return from_; } + void setFrom(const JID& from) { from_ = from; } + + const JID& getTo() const { return to_; } + void setTo(const JID& to) { to_ = to; } + + const std::string& getID() const { return id_; } + void setID(const std::string& id) { id_ = id; } + + boost::optional<boost::posix_time::ptime> getTimestamp() const; + + // Falls back to any timestamp if no specific timestamp for the given JID is found. + boost::optional<boost::posix_time::ptime> getTimestampFrom(const JID& jid) const; + + private: + std::string id_; + JID from_; + JID to_; + std::vector< std::shared_ptr<Payload> > payloads_; + }; } diff --git a/Swiften/Elements/StanzaAck.cpp b/Swiften/Elements/StanzaAck.cpp index 2dbff41..bd0b78d 100644 --- a/Swiften/Elements/StanzaAck.cpp +++ b/Swiften/Elements/StanzaAck.cpp @@ -14,6 +14,6 @@ StanzaAck::~StanzaAck() { } void StanzaAck::setHandledStanzasCount(int i) { - handledStanzasCount = boost::numeric_cast<unsigned int>(i); - valid = true; + handledStanzasCount = boost::numeric_cast<unsigned int>(i); + valid = true; } diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h index d976802..68f0a2f 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -1,37 +1,37 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StanzaAck : public ToplevelElement { - public: - typedef boost::shared_ptr<StanzaAck> ref; + class SWIFTEN_API StanzaAck : public ToplevelElement { + public: + typedef std::shared_ptr<StanzaAck> ref; - StanzaAck() : valid(false), handledStanzasCount(0) {} - StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {} - virtual ~StanzaAck(); + StanzaAck() : valid(false), handledStanzasCount(0) {} + StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {} + virtual ~StanzaAck(); - unsigned int getHandledStanzasCount() const { - return handledStanzasCount; - } + unsigned int getHandledStanzasCount() const { + return handledStanzasCount; + } - void setHandledStanzasCount(int i); + void setHandledStanzasCount(int i); - bool isValid() const { - return valid; - } + bool isValid() const { + return valid; + } - private: - bool valid; - unsigned int handledStanzasCount; - }; + private: + bool valid; + unsigned int handledStanzasCount; + }; } diff --git a/Swiften/Elements/StanzaAckRequest.h b/Swiften/Elements/StanzaAckRequest.h index dc3bf32..e9b95b5 100644 --- a/Swiften/Elements/StanzaAckRequest.h +++ b/Swiften/Elements/StanzaAckRequest.h @@ -10,6 +10,6 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StanzaAckRequest : public ToplevelElement { - }; + class SWIFTEN_API StanzaAckRequest : public ToplevelElement { + }; } diff --git a/Swiften/Elements/StartSession.h b/Swiften/Elements/StartSession.h index 9191ea9..a40865e 100644 --- a/Swiften/Elements/StartSession.h +++ b/Swiften/Elements/StartSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,12 +7,13 @@ #pragma once #include <string> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API StartSession : public Payload { - public: - StartSession() {} - }; + class SWIFTEN_API StartSession : public Payload { + public: + StartSession() {} + }; } diff --git a/Swiften/Elements/StartTLSFailure.h b/Swiften/Elements/StartTLSFailure.h index 1477962..5867e3f 100644 --- a/Swiften/Elements/StartTLSFailure.h +++ b/Swiften/Elements/StartTLSFailure.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StartTLSFailure : public ToplevelElement { - public: - StartTLSFailure() {} - }; + class SWIFTEN_API StartTLSFailure : public ToplevelElement { + public: + StartTLSFailure() {} + }; } diff --git a/Swiften/Elements/StartTLSRequest.h b/Swiften/Elements/StartTLSRequest.h index 648eef7..f47a21d 100644 --- a/Swiften/Elements/StartTLSRequest.h +++ b/Swiften/Elements/StartTLSRequest.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StartTLSRequest : public ToplevelElement { - public: - StartTLSRequest() {} - }; + class SWIFTEN_API StartTLSRequest : public ToplevelElement { + public: + StartTLSRequest() {} + }; } diff --git a/Swiften/Elements/Status.h b/Swiften/Elements/Status.h index a7620e4..2fd2eff 100644 --- a/Swiften/Elements/Status.h +++ b/Swiften/Elements/Status.h @@ -1,30 +1,31 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> -#include <string> namespace Swift { - class SWIFTEN_API Status : public Payload { - public: - Status(const std::string& text = "") : text_(text) { - } + class SWIFTEN_API Status : public Payload { + public: + Status(const std::string& text = "") : text_(text) { + } - void setText(const std::string& text) { - text_ = text; - } + void setText(const std::string& text) { + text_ = text; + } - const std::string& getText() const { - return text_; - } + const std::string& getText() const { + return text_; + } - private: - std::string text_; - }; + private: + std::string text_; + }; } diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h index 9f07c65..b339fa1 100644 --- a/Swiften/Elements/StatusShow.h +++ b/Swiften/Elements/StatusShow.h @@ -1,48 +1,49 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <cassert> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> -#include <cassert> namespace Swift { - class SWIFTEN_API StatusShow : public Payload { - public: - enum Type { Online, Away, FFC, XA, DND, None }; - - StatusShow(const Type& type = Online); - - void setType(const Type& type) { - type_ = type; - } - - const Type& getType() const { - return type_; - } - - /** - * Can be used for rough ordering of Types. - * Greater magnitude = more available. - */ - static int typeToAvailabilityOrdering(Type type) { - switch (type) { - case Online: return 4; - case FFC: return 5; - case Away: return 2; - case XA: return 1; - case DND: return 3; - case None: return 0; - } - assert(false); - return 0; - } - - private: - Type type_; - }; + class SWIFTEN_API StatusShow : public Payload { + public: + enum Type { Online, Away, FFC, XA, DND, None }; + + StatusShow(const Type& type = Online); + + void setType(const Type& type) { + type_ = type; + } + + const Type& getType() const { + return type_; + } + + /** + * Can be used for rough ordering of Types. + * Greater magnitude = more available. + */ + static int typeToAvailabilityOrdering(Type type) { + switch (type) { + case Online: return 4; + case FFC: return 5; + case Away: return 2; + case XA: return 1; + case DND: return 3; + case None: return 0; + } + assert(false); + return 0; + } + + private: + Type type_; + }; } diff --git a/Swiften/Elements/Storage.h b/Swiften/Elements/Storage.h index 8bbbc55..87cfb39 100644 --- a/Swiften/Elements/Storage.h +++ b/Swiften/Elements/Storage.h @@ -1,67 +1,67 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> #include <vector> #include <boost/optional.hpp> -#include <Swiften/Elements/Payload.h> -#include <string> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Base/SafeString.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API Storage : public Payload { - public: - struct Room { - Room() : autoJoin(false) {} - - std::string name; - JID jid; - bool autoJoin; - std::string nick; - boost::optional<std::string> password; - }; - - struct URL { - URL() {} - - std::string name; - std::string url; - }; - - Storage() { - } - - - void clearRooms() { - rooms.clear(); - } - - const std::vector<Room>& getRooms() const { - return rooms; - } - - void addRoom(const Room& room) { - rooms.push_back(room); - } - - const std::vector<URL>& getURLs() const { - return urls; - } - - void addURL(const URL& url) { - urls.push_back(url); - } - - private: - std::vector<Room> rooms; - std::vector<URL> urls; - }; + class SWIFTEN_API Storage : public Payload { + public: + struct Room { + Room() : autoJoin(false) {} + + std::string name; + JID jid; + bool autoJoin; + std::string nick; + boost::optional<std::string> password; + }; + + struct URL { + URL() {} + + std::string name; + std::string url; + }; + + Storage() { + } + + + void clearRooms() { + rooms.clear(); + } + + const std::vector<Room>& getRooms() const { + return rooms; + } + + void addRoom(const Room& room) { + rooms.push_back(room); + } + + const std::vector<URL>& getURLs() const { + return urls; + } + + void addURL(const URL& url) { + urls.push_back(url); + } + + private: + std::vector<Room> rooms; + std::vector<URL> urls; + }; } diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index 5a15f40..aa294fd 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -1,70 +1,70 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> -#include <string> namespace Swift { - class SWIFTEN_API StreamError : public ToplevelElement { - public: - typedef boost::shared_ptr<StreamError> ref; + class SWIFTEN_API StreamError : public ToplevelElement { + public: + typedef std::shared_ptr<StreamError> ref; - enum Type { - BadFormat, - BadNamespacePrefix, - Conflict, - ConnectionTimeout, - HostGone, - HostUnknown, - ImproperAddressing, - InternalServerError, - InvalidFrom, - InvalidID, - InvalidNamespace, - InvalidXML, - NotAuthorized, - NotWellFormed, - PolicyViolation, - RemoteConnectionFailed, - Reset, - ResourceConstraint, - RestrictedXML, - SeeOtherHost, - SystemShutdown, - UndefinedCondition, - UnsupportedEncoding, - UnsupportedStanzaType, - UnsupportedVersion - }; + enum Type { + BadFormat, + BadNamespacePrefix, + Conflict, + ConnectionTimeout, + HostGone, + HostUnknown, + ImproperAddressing, + InternalServerError, + InvalidFrom, + InvalidID, + InvalidNamespace, + InvalidXML, + NotAuthorized, + NotWellFormed, + PolicyViolation, + RemoteConnectionFailed, + Reset, + ResourceConstraint, + RestrictedXML, + SeeOtherHost, + SystemShutdown, + UndefinedCondition, + UnsupportedEncoding, + UnsupportedStanzaType, + UnsupportedVersion + }; - StreamError(Type type = UndefinedCondition, const std::string& text = std::string()) : type_(type), text_(text) { } + StreamError(Type type = UndefinedCondition, const std::string& text = std::string()) : type_(type), text_(text) { } - Type getType() const { - return type_; - } + Type getType() const { + return type_; + } - void setType(Type type) { - type_ = type; - } + void setType(Type type) { + type_ = type; + } - void setText(const std::string& text) { - text_ = text; - } + void setText(const std::string& text) { + text_ = text; + } - const std::string& getText() const { - return text_; - } + const std::string& getText() const { + return text_; + } - private: - Type type_; - std::string text_; - }; + private: + Type type_; + std::string text_; + }; } diff --git a/Swiften/Elements/StreamFeatures.cpp b/Swiften/Elements/StreamFeatures.cpp index 0acc417..77bafac 100644 --- a/Swiften/Elements/StreamFeatures.cpp +++ b/Swiften/Elements/StreamFeatures.cpp @@ -11,11 +11,11 @@ namespace Swift { bool StreamFeatures::hasCompressionMethod(const std::string& mechanism) const { - return std::find(compressionMethods_.begin(), compressionMethods_.end(), mechanism) != compressionMethods_.end(); + return std::find(compressionMethods_.begin(), compressionMethods_.end(), mechanism) != compressionMethods_.end(); } bool StreamFeatures::hasAuthenticationMechanism(const std::string& mechanism) const { - return std::find(authenticationMechanisms_.begin(), authenticationMechanisms_.end(), mechanism) != authenticationMechanisms_.end(); + return std::find(authenticationMechanisms_.begin(), authenticationMechanisms_.end(), mechanism) != authenticationMechanisms_.end(); } } diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index 10563a9..5832a24 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -1,106 +1,107 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <vector> +#include <memory> #include <string> +#include <vector> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamFeatures : public ToplevelElement { - public: - typedef boost::shared_ptr<StreamFeatures> ref; - - StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {} - - void setHasStartTLS() { - hasStartTLS_ = true; - } - - bool hasStartTLS() const { - return hasStartTLS_; - } - - void setHasSession() { - hasSession_ = true; - } - - bool hasSession() const { - return hasSession_; - } - - void setHasResourceBind() { - hasResourceBind_ = true; - } - - bool hasResourceBind() const { - return hasResourceBind_; - } - - const std::vector<std::string>& getCompressionMethods() const { - return compressionMethods_; - } - - void addCompressionMethod(const std::string& mechanism) { - compressionMethods_.push_back(mechanism); - } - - bool hasCompressionMethod(const std::string& mechanism) const; - - const std::vector<std::string>& getAuthenticationMechanisms() const { - return authenticationMechanisms_; - } - - void addAuthenticationMechanism(const std::string& mechanism) { - authenticationMechanisms_.push_back(mechanism); - } - - bool hasAuthenticationMechanism(const std::string& mechanism) const; - - bool hasAuthenticationMechanisms() const { - return !authenticationMechanisms_.empty(); - } - - const boost::optional<std::string> getAuthenticationHostname() const { - return authenticationHostname_; - } - - void setAuthenticationHostname(const boost::optional<std::string> authenticationHostname) { - authenticationHostname_ = authenticationHostname; - } - - bool hasStreamManagement() const { - return hasStreamManagement_; - } - - void setHasStreamManagement() { - hasStreamManagement_ = true; - } - - bool hasRosterVersioning() const { - return hasRosterVersioning_; - } - - void setHasRosterVersioning() { - hasRosterVersioning_ = true; - } - - private: - bool hasStartTLS_; - std::vector<std::string> compressionMethods_; - std::vector<std::string> authenticationMechanisms_; - bool hasResourceBind_; - bool hasSession_; - bool hasStreamManagement_; - bool hasRosterVersioning_; - boost::optional<std::string> authenticationHostname_; - }; + class SWIFTEN_API StreamFeatures : public ToplevelElement { + public: + typedef std::shared_ptr<StreamFeatures> ref; + + StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {} + + void setHasStartTLS() { + hasStartTLS_ = true; + } + + bool hasStartTLS() const { + return hasStartTLS_; + } + + void setHasSession() { + hasSession_ = true; + } + + bool hasSession() const { + return hasSession_; + } + + void setHasResourceBind() { + hasResourceBind_ = true; + } + + bool hasResourceBind() const { + return hasResourceBind_; + } + + const std::vector<std::string>& getCompressionMethods() const { + return compressionMethods_; + } + + void addCompressionMethod(const std::string& mechanism) { + compressionMethods_.push_back(mechanism); + } + + bool hasCompressionMethod(const std::string& mechanism) const; + + const std::vector<std::string>& getAuthenticationMechanisms() const { + return authenticationMechanisms_; + } + + void addAuthenticationMechanism(const std::string& mechanism) { + authenticationMechanisms_.push_back(mechanism); + } + + bool hasAuthenticationMechanism(const std::string& mechanism) const; + + bool hasAuthenticationMechanisms() const { + return !authenticationMechanisms_.empty(); + } + + const boost::optional<std::string> getAuthenticationHostname() const { + return authenticationHostname_; + } + + void setAuthenticationHostname(const boost::optional<std::string> authenticationHostname) { + authenticationHostname_ = authenticationHostname; + } + + bool hasStreamManagement() const { + return hasStreamManagement_; + } + + void setHasStreamManagement() { + hasStreamManagement_ = true; + } + + bool hasRosterVersioning() const { + return hasRosterVersioning_; + } + + void setHasRosterVersioning() { + hasRosterVersioning_ = true; + } + + private: + bool hasStartTLS_; + std::vector<std::string> compressionMethods_; + std::vector<std::string> authenticationMechanisms_; + bool hasResourceBind_; + bool hasSession_; + bool hasStreamManagement_; + bool hasRosterVersioning_; + boost::optional<std::string> authenticationHostname_; + }; } diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h index 53c8f11..2bb9a0e 100644 --- a/Swiften/Elements/StreamInitiation.h +++ b/Swiften/Elements/StreamInitiation.h @@ -1,72 +1,73 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> +#include <string> #include <vector> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <string> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/StreamInitiationFileInfo.h> namespace Swift { - class SWIFTEN_API StreamInitiation : public Payload { - public: - typedef boost::shared_ptr<StreamInitiation> ref; - - StreamInitiation() : isFileTransfer(true) {} - - const std::string& getID() const { - return id; - } - - void setID(const std::string& id) { - this->id = id; - } - - const boost::optional<StreamInitiationFileInfo>& getFileInfo() const { - return fileInfo; - } - - void setFileInfo(const StreamInitiationFileInfo& info) { - fileInfo = info; - } - - const std::vector<std::string>& getProvidedMethods() const { - return providedMethods; - } - - void addProvidedMethod(const std::string& method) { - providedMethods.push_back(method); - } - - void setRequestedMethod(const std::string& method) { - requestedMethod = method; - } - - const std::string& getRequestedMethod() const { - return requestedMethod; - } - - bool getIsFileTransfer() const { - return isFileTransfer; - } - - void setIsFileTransfer(bool b) { - isFileTransfer = b; - } - - private: - bool isFileTransfer; - std::string id; - boost::optional<StreamInitiationFileInfo> fileInfo; - std::vector<std::string> providedMethods; - std::string requestedMethod; - }; + class SWIFTEN_API StreamInitiation : public Payload { + public: + typedef std::shared_ptr<StreamInitiation> ref; + + StreamInitiation() : isFileTransfer(true) {} + + const std::string& getID() const { + return id; + } + + void setID(const std::string& id) { + this->id = id; + } + + const boost::optional<StreamInitiationFileInfo>& getFileInfo() const { + return fileInfo; + } + + void setFileInfo(const StreamInitiationFileInfo& info) { + fileInfo = info; + } + + const std::vector<std::string>& getProvidedMethods() const { + return providedMethods; + } + + void addProvidedMethod(const std::string& method) { + providedMethods.push_back(method); + } + + void setRequestedMethod(const std::string& method) { + requestedMethod = method; + } + + const std::string& getRequestedMethod() const { + return requestedMethod; + } + + bool getIsFileTransfer() const { + return isFileTransfer; + } + + void setIsFileTransfer(bool b) { + isFileTransfer = b; + } + + private: + bool isFileTransfer; + std::string id; + boost::optional<StreamInitiationFileInfo> fileInfo; + std::vector<std::string> providedMethods; + std::string requestedMethod; + }; } diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index bd920a0..f2dc5b9 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -1,103 +1,104 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> + #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <string> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API StreamInitiationFileInfo : public Payload { public: - typedef boost::shared_ptr<StreamInitiationFileInfo> ref; - + typedef std::shared_ptr<StreamInitiationFileInfo> ref; + public: - StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, - const std::string& hash = "", const boost::posix_time::ptime &date = boost::posix_time::ptime(), const std::string& algo="md5") : - name(name), description(description), size(size), hash(hash), date(date), algo(algo), supportsRangeRequests(false), rangeOffset(0) {} - - void setName(const std::string& name) { - this->name = name;; - } - - const std::string& getName() const { - return this->name; - } - - void setDescription(const std::string& description) { - this->description = description; - } - - const std::string& getDescription() const { - return this->description; - } - - void setSize(const unsigned long long size) { - this->size = size; - } - - unsigned long long getSize() const { - return this->size; - } - - void setHash(const std::string& hash) { - this->hash = hash; - } - - const std::string& getHash() const { - return this->hash; - } - - void setDate(const boost::posix_time::ptime& date) { - this->date = date; - } - - const boost::posix_time::ptime& getDate() const { - return this->date; - } - - void setAlgo(const std::string& algo) { - this->algo = algo; - } - - const std::string& getAlgo() const { - return this->algo; - } - - void setSupportsRangeRequests(const bool supportsIt) { - supportsRangeRequests = supportsIt; - } - - bool getSupportsRangeRequests() const { - return supportsRangeRequests; - } - - void setRangeOffset(unsigned long long offset) { - supportsRangeRequests = true; - rangeOffset = offset; - } - - unsigned long long getRangeOffset() const { - return rangeOffset; - } + StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, + const std::string& hash = "", const boost::posix_time::ptime &date = boost::posix_time::ptime(), const std::string& algo="md5") : + name(name), description(description), size(size), hash(hash), date(date), algo(algo), supportsRangeRequests(false), rangeOffset(0) {} + + void setName(const std::string& name) { + this->name = name;; + } + + const std::string& getName() const { + return this->name; + } + + void setDescription(const std::string& description) { + this->description = description; + } + + const std::string& getDescription() const { + return this->description; + } + + void setSize(const unsigned long long size) { + this->size = size; + } + + unsigned long long getSize() const { + return this->size; + } + + void setHash(const std::string& hash) { + this->hash = hash; + } + + const std::string& getHash() const { + return this->hash; + } + + void setDate(const boost::posix_time::ptime& date) { + this->date = date; + } + + const boost::posix_time::ptime& getDate() const { + return this->date; + } + + void setAlgo(const std::string& algo) { + this->algo = algo; + } + + const std::string& getAlgo() const { + return this->algo; + } + + void setSupportsRangeRequests(const bool supportsIt) { + supportsRangeRequests = supportsIt; + } + + bool getSupportsRangeRequests() const { + return supportsRangeRequests; + } + + void setRangeOffset(unsigned long long offset) { + supportsRangeRequests = true; + rangeOffset = offset; + } + + unsigned long long getRangeOffset() const { + return rangeOffset; + } private: - std::string name; - std::string description; - unsigned long long size; - std::string hash; - boost::posix_time::ptime date; - std::string algo; - bool supportsRangeRequests; - unsigned long long rangeOffset; + std::string name; + std::string description; + unsigned long long size; + std::string hash; + boost::posix_time::ptime date; + std::string algo; + bool supportsRangeRequests; + unsigned long long rangeOffset; }; } diff --git a/Swiften/Elements/StreamManagementEnabled.h b/Swiften/Elements/StreamManagementEnabled.h index eaae189..7cb640d 100644 --- a/Swiften/Elements/StreamManagementEnabled.h +++ b/Swiften/Elements/StreamManagementEnabled.h @@ -12,29 +12,29 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamManagementEnabled : public ToplevelElement { - public: - StreamManagementEnabled(); - ~StreamManagementEnabled(); - - void setResumeSupported() { - resumeSupported = true; - } - - bool getResumeSupported() const { - return resumeSupported; - } - - void setResumeID(const std::string& id) { - resumeID = id; - } - - const std::string& getResumeID() const { - return resumeID; - } - - private: - bool resumeSupported; - std::string resumeID; - }; + class SWIFTEN_API StreamManagementEnabled : public ToplevelElement { + public: + StreamManagementEnabled(); + ~StreamManagementEnabled(); + + void setResumeSupported() { + resumeSupported = true; + } + + bool getResumeSupported() const { + return resumeSupported; + } + + void setResumeID(const std::string& id) { + resumeID = id; + } + + const std::string& getResumeID() const { + return resumeID; + } + + private: + bool resumeSupported; + std::string resumeID; + }; } diff --git a/Swiften/Elements/StreamManagementFailed.h b/Swiften/Elements/StreamManagementFailed.h index 70781d7..062d9bd 100644 --- a/Swiften/Elements/StreamManagementFailed.h +++ b/Swiften/Elements/StreamManagementFailed.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamManagementFailed : public ToplevelElement { - public: - StreamManagementFailed() {} - }; + class SWIFTEN_API StreamManagementFailed : public ToplevelElement { + public: + StreamManagementFailed() {} + }; } diff --git a/Swiften/Elements/StreamResume.h b/Swiften/Elements/StreamResume.h index ca08546..0ded077 100644 --- a/Swiften/Elements/StreamResume.h +++ b/Swiften/Elements/StreamResume.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,35 +7,36 @@ #pragma once #include <string> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamResume : public ToplevelElement { - public: - StreamResume(); - ~StreamResume(); - - void setResumeID(const std::string& id) { - resumeID = id; - } - - const std::string& getResumeID() const { - return resumeID; - } - - const boost::optional<unsigned int> getHandledStanzasCount() const { - return handledStanzasCount; - } - - void setHandledStanzasCount(unsigned int i) { - handledStanzasCount = i; - } - - private: - std::string resumeID; - boost::optional<unsigned int> handledStanzasCount; - }; + class SWIFTEN_API StreamResume : public ToplevelElement { + public: + StreamResume(); + ~StreamResume(); + + void setResumeID(const std::string& id) { + resumeID = id; + } + + const std::string& getResumeID() const { + return resumeID; + } + + const boost::optional<unsigned int> getHandledStanzasCount() const { + return handledStanzasCount; + } + + void setHandledStanzasCount(unsigned int i) { + handledStanzasCount = i; + } + + private: + std::string resumeID; + boost::optional<unsigned int> handledStanzasCount; + }; } diff --git a/Swiften/Elements/StreamResumed.h b/Swiften/Elements/StreamResumed.h index 68e0688..e1c80d9 100644 --- a/Swiften/Elements/StreamResumed.h +++ b/Swiften/Elements/StreamResumed.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,35 +7,36 @@ #pragma once #include <string> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamResumed : public ToplevelElement { - public: - StreamResumed(); - ~StreamResumed(); - - void setResumeID(const std::string& id) { - resumeID = id; - } - - const std::string& getResumeID() const { - return resumeID; - } - - const boost::optional<unsigned int> getHandledStanzasCount() const { - return handledStanzasCount; - } - - void setHandledStanzasCount(unsigned int i) { - handledStanzasCount = i; - } - - private: - std::string resumeID; - boost::optional<unsigned int> handledStanzasCount; - }; + class SWIFTEN_API StreamResumed : public ToplevelElement { + public: + StreamResumed(); + ~StreamResumed(); + + void setResumeID(const std::string& id) { + resumeID = id; + } + + const std::string& getResumeID() const { + return resumeID; + } + + const boost::optional<unsigned int> getHandledStanzasCount() const { + return handledStanzasCount; + } + + void setHandledStanzasCount(unsigned int i) { + handledStanzasCount = i; + } + + private: + std::string resumeID; + boost::optional<unsigned int> handledStanzasCount; + }; } diff --git a/Swiften/Elements/StreamType.h b/Swiften/Elements/StreamType.h index 0cd4133..d6b820e 100644 --- a/Swiften/Elements/StreamType.h +++ b/Swiften/Elements/StreamType.h @@ -7,9 +7,9 @@ #pragma once namespace Swift { - enum StreamType { - ClientStreamType, - ServerStreamType, - ComponentStreamType - }; + enum StreamType { + ClientStreamType, + ServerStreamType, + ComponentStreamType + }; } diff --git a/Swiften/Elements/Subject.h b/Swiften/Elements/Subject.h index b25c31d..4f9444a 100644 --- a/Swiften/Elements/Subject.h +++ b/Swiften/Elements/Subject.h @@ -1,30 +1,31 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <string> + #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> -#include <string> namespace Swift { - class SWIFTEN_API Subject : public Payload { - public: - Subject(const std::string& text = "") : text_(text) { - } + class SWIFTEN_API Subject : public Payload { + public: + Subject(const std::string& text = "") : text_(text) { + } - void setText(const std::string& text) { - text_ = text; - } + void setText(const std::string& text) { + text_ = text; + } - const std::string& getText() const { - return text_; - } + const std::string& getText() const { + return text_; + } - private: - std::string text_; - }; + private: + std::string text_; + }; } diff --git a/Swiften/Elements/TLSProceed.h b/Swiften/Elements/TLSProceed.h index 4e05511..3cd5360 100644 --- a/Swiften/Elements/TLSProceed.h +++ b/Swiften/Elements/TLSProceed.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API TLSProceed : public ToplevelElement { - public: - TLSProceed() {} - }; + class SWIFTEN_API TLSProceed : public ToplevelElement { + public: + TLSProceed() {} + }; } diff --git a/Swiften/Elements/Thread.cpp b/Swiften/Elements/Thread.cpp index dfd9029..5ac371b 100644 --- a/Swiften/Elements/Thread.cpp +++ b/Swiften/Elements/Thread.cpp @@ -8,27 +8,27 @@ namespace Swift { - Thread::Thread(const std::string& text, const std::string& parent) : text_(text), parent_(parent) { - - } + Thread::Thread(const std::string& text, const std::string& parent) : text_(text), parent_(parent) { - Thread::~Thread() { + } - } + Thread::~Thread() { - void Thread::setText(const std::string& text) { - text_ = text; - } + } - const std::string& Thread::getText() const { - return text_; - } + void Thread::setText(const std::string& text) { + text_ = text; + } - void Thread::setParent(const std::string& parent) { - parent_ = parent; - } + const std::string& Thread::getText() const { + return text_; + } - const std::string& Thread::getParent() const { - return parent_; - } + void Thread::setParent(const std::string& parent) { + parent_ = parent; + } + + const std::string& Thread::getParent() const { + return parent_; + } } diff --git a/Swiften/Elements/Thread.h b/Swiften/Elements/Thread.h index 8207851..e736e7f 100644 --- a/Swiften/Elements/Thread.h +++ b/Swiften/Elements/Thread.h @@ -12,17 +12,17 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Thread : public Payload { - public: - Thread(const std::string& text = "", const std::string& parent = ""); - virtual ~Thread(); - void setText(const std::string& text); - const std::string& getText() const; - void setParent(const std::string& parent); - const std::string& getParent() const; + class SWIFTEN_API Thread : public Payload { + public: + Thread(const std::string& text = "", const std::string& parent = ""); + virtual ~Thread(); + void setText(const std::string& text); + const std::string& getText() const; + void setParent(const std::string& parent); + const std::string& getParent() const; - private: - std::string text_; - std::string parent_; - }; + private: + std::string text_; + std::string parent_; + }; } diff --git a/Swiften/Elements/ToplevelElement.h b/Swiften/Elements/ToplevelElement.h index a9cc09c..55e055a 100644 --- a/Swiften/Elements/ToplevelElement.h +++ b/Swiften/Elements/ToplevelElement.h @@ -10,10 +10,10 @@ #include <Swiften/Elements/Element.h> namespace Swift { - class SWIFTEN_API ToplevelElement : public Element { - public: - ToplevelElement() {} - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(ToplevelElement) - virtual ~ToplevelElement(); - }; + class SWIFTEN_API ToplevelElement : public Element { + public: + ToplevelElement() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(ToplevelElement) + virtual ~ToplevelElement(); + }; } diff --git a/Swiften/Elements/UnblockPayload.h b/Swiften/Elements/UnblockPayload.h index 20459e2..7d6574d 100644 --- a/Swiften/Elements/UnblockPayload.h +++ b/Swiften/Elements/UnblockPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,24 +9,24 @@ #include <vector> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API UnblockPayload : public Payload { - public: - UnblockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { - } + class SWIFTEN_API UnblockPayload : public Payload { + public: + UnblockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { + } - void addItem(const JID& item) { - items.push_back(item); - } + void addItem(const JID& item) { + items.push_back(item); + } - const std::vector<JID>& getItems() const { - return items; - } + const std::vector<JID>& getItems() const { + return items; + } - private: - std::vector<JID> items; - }; + private: + std::vector<JID> items; + }; } diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp index 3fe8757..c728bde 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -1,57 +1,57 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Form.h> using namespace Swift; class FormTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(FormTest); - CPPUNIT_TEST(testGetFormType); - CPPUNIT_TEST(testGetFormType_InvalidFormType); - CPPUNIT_TEST(testGetFormType_NoFormType); - CPPUNIT_TEST_SUITE_END(); + CPPUNIT_TEST_SUITE(FormTest); + CPPUNIT_TEST(testGetFormType); + CPPUNIT_TEST(testGetFormType_InvalidFormType); + CPPUNIT_TEST(testGetFormType_NoFormType); + CPPUNIT_TEST_SUITE_END(); - public: - void testGetFormType() { - Form form; + public: + void testGetFormType() { + Form form; - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Foo")); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); - field->setName("FORM_TYPE"); - form.addField(field); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); + field->setName("FORM_TYPE"); + form.addField(field); - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Bar")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Bar")); - CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), form.getFormType()); - } + CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), form.getFormType()); + } - void testGetFormType_InvalidFormType() { - Form form; + void testGetFormType_InvalidFormType() { + Form form; - FormField::ref field = boost::make_shared<FormField>(FormField::FixedType, "jabber:bot"); - field->setName("FORM_TYPE"); - form.addField(field); + FormField::ref field = std::make_shared<FormField>(FormField::FixedType, "jabber:bot"); + field->setName("FORM_TYPE"); + form.addField(field); - CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); - } + CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); + } - void testGetFormType_NoFormType() { - Form form; + void testGetFormType_NoFormType() { + Form form; - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Foo")); - CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); - } + CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(FormTest); diff --git a/Swiften/Elements/UnitTest/IQTest.cpp b/Swiften/Elements/UnitTest/IQTest.cpp index c67fdc1..ed98c75 100644 --- a/Swiften/Elements/UnitTest/IQTest.cpp +++ b/Swiften/Elements/UnitTest/IQTest.cpp @@ -1,12 +1,13 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <boost/shared_ptr.hpp> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/SoftwareVersion.h> @@ -15,43 +16,43 @@ using namespace Swift; class IQTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(IQTest); - CPPUNIT_TEST(testCreateResult); - CPPUNIT_TEST(testCreateResult_WithoutPayload); - CPPUNIT_TEST(testCreateError); - CPPUNIT_TEST_SUITE_END(); - - public: - IQTest() {} - - void testCreateResult() { - boost::shared_ptr<Payload> payload(new SoftwareVersion("myclient")); - boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid", payload)); - - CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); - CPPUNIT_ASSERT(iq->getPayload<SoftwareVersion>()); - CPPUNIT_ASSERT(payload == iq->getPayload<SoftwareVersion>()); - } - - void testCreateResult_WithoutPayload() { - boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid")); - - CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); - CPPUNIT_ASSERT(!iq->getPayload<SoftwareVersion>()); - } - - void testCreateError() { - boost::shared_ptr<IQ> iq(IQ::createError(JID("foo@bar/fum"), "myid", ErrorPayload::BadRequest, ErrorPayload::Modify)); - - CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); - boost::shared_ptr<ErrorPayload> error(iq->getPayload<ErrorPayload>()); - CPPUNIT_ASSERT(error); - CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, error->getCondition()); - CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, error->getType()); - } + CPPUNIT_TEST_SUITE(IQTest); + CPPUNIT_TEST(testCreateResult); + CPPUNIT_TEST(testCreateResult_WithoutPayload); + CPPUNIT_TEST(testCreateError); + CPPUNIT_TEST_SUITE_END(); + + public: + IQTest() {} + + void testCreateResult() { + std::shared_ptr<Payload> payload(new SoftwareVersion("myclient")); + std::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid", payload)); + + CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); + CPPUNIT_ASSERT(iq->getPayload<SoftwareVersion>()); + CPPUNIT_ASSERT(payload == iq->getPayload<SoftwareVersion>()); + } + + void testCreateResult_WithoutPayload() { + std::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid")); + + CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); + CPPUNIT_ASSERT(!iq->getPayload<SoftwareVersion>()); + } + + void testCreateError() { + std::shared_ptr<IQ> iq(IQ::createError(JID("foo@bar/fum"), "myid", ErrorPayload::BadRequest, ErrorPayload::Modify)); + + CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); + std::shared_ptr<ErrorPayload> error(iq->getPayload<ErrorPayload>()); + CPPUNIT_ASSERT(error); + CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, error->getCondition()); + CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, error->getType()); + } }; diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp index 8bead5e..6a45bd8 100644 --- a/Swiften/Elements/UnitTest/StanzaTest.cpp +++ b/Swiften/Elements/UnitTest/StanzaTest.cpp @@ -1,231 +1,233 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + +#include <boost/date_time/posix_time/posix_time.hpp> + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <boost/shared_ptr.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <Swiften/Elements/Stanza.h> -#include <Swiften/Elements/Payload.h> -#include <Swiften/Elements/Message.h> #include <Swiften/Elements/Delay.h> +#include <Swiften/Elements/Message.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/Stanza.h> using namespace Swift; class StanzaTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(StanzaTest); - CPPUNIT_TEST(testConstructor_Copy); - CPPUNIT_TEST(testGetPayload); - CPPUNIT_TEST(testGetPayloads); - CPPUNIT_TEST(testGetPayload_NoSuchPayload); - CPPUNIT_TEST(testDestructor); - CPPUNIT_TEST(testDestructor_Copy); - CPPUNIT_TEST(testUpdatePayload_ExistingPayload); - CPPUNIT_TEST(testUpdatePayload_NewPayload); - CPPUNIT_TEST(testGetPayloadOfSameType); - CPPUNIT_TEST(testGetPayloadOfSameType_NoSuchPayload); - CPPUNIT_TEST(testGetTimestamp); - CPPUNIT_TEST(testGetTimestamp_TimestampWithFrom); - CPPUNIT_TEST(testGetTimestamp_NoDelay); - CPPUNIT_TEST(testGetTimestampFrom); - CPPUNIT_TEST(testGetTimestampFrom_Fallsback); - CPPUNIT_TEST_SUITE_END(); - - public: - class MyPayload1 : public Payload { - public: - MyPayload1() {} - }; - - class MyPayload2 : public Payload { - public: - MyPayload2(const std::string& s = "") : text_(s) {} - - std::string text_; - }; - - class MyPayload3 : public Payload { - public: - MyPayload3() {} - }; - - class DestroyingPayload : public Payload { - public: - DestroyingPayload(bool* alive) : alive_(alive) { - } - - ~DestroyingPayload() { - (*alive_) = false; - } - - private: - bool* alive_; - }; - - void testConstructor_Copy() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>()); - Message copy(m); - - CPPUNIT_ASSERT(copy.getPayload<MyPayload1>()); - CPPUNIT_ASSERT(copy.getPayload<MyPayload2>()); - } - - void testDestructor() { - bool payloadAlive = true; - { - Message m; - m.addPayload(boost::make_shared<DestroyingPayload>(&payloadAlive)); - } - - CPPUNIT_ASSERT(!payloadAlive); - } - - void testDestructor_Copy() { - bool payloadAlive = true; - Message* m1 = new Message(); - m1->addPayload(boost::make_shared<DestroyingPayload>(&payloadAlive)); - Message* m2 = new Message(*m1); - - delete m1; - CPPUNIT_ASSERT(payloadAlive); - - delete m2; - CPPUNIT_ASSERT(!payloadAlive); - } - - void testGetPayload() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>()); - m.addPayload(boost::make_shared<MyPayload3>()); - - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT(p); - } - - void testGetPayload_NoSuchPayload() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); - - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT(!p); - } - - void testGetPayloads() { - Message m; - boost::shared_ptr<MyPayload2> payload1(new MyPayload2()); - boost::shared_ptr<MyPayload2> payload2(new MyPayload2()); - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(payload1); - m.addPayload(boost::make_shared<MyPayload3>()); - m.addPayload(payload2); - - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m.getPayloads<MyPayload2>().size()); - CPPUNIT_ASSERT_EQUAL(payload1, m.getPayloads<MyPayload2>()[0]); - CPPUNIT_ASSERT_EQUAL(payload2, m.getPayloads<MyPayload2>()[1]); - } - - - void testUpdatePayload_ExistingPayload() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>("foo")); - m.addPayload(boost::make_shared<MyPayload3>()); - - m.updatePayload(boost::make_shared<MyPayload2>("bar")); - - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); - } - - void testUpdatePayload_NewPayload() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); - - m.updatePayload(boost::make_shared<MyPayload2>("bar")); - - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); - } - - void testGetPayloadOfSameType() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>("foo")); - m.addPayload(boost::make_shared<MyPayload3>()); - - boost::shared_ptr<MyPayload2> payload(boost::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar")))); - CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_); - } - - void testGetPayloadOfSameType_NoSuchPayload() { - Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); - - CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar"))); - } - - void testGetTimestamp() { - Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1))); - - boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); - - CPPUNIT_ASSERT(timestamp); - CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); - } - - void testGetTimestamp_TimestampWithFrom() { - Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo@bar.com"))); - - boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); - - CPPUNIT_ASSERT(timestamp); - CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); - } - - void testGetTimestamp_NoDelay() { - Message m; - CPPUNIT_ASSERT(!m.getTimestamp()); - } - - void testGetTimestampFrom() { - Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(0))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); - - boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); - - CPPUNIT_ASSERT(timestamp); - CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:02"), boost::posix_time::to_simple_string(*timestamp)); - } - - void testGetTimestampFrom_Fallsback() { - Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); - - boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); - - CPPUNIT_ASSERT(timestamp); - CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); - } + CPPUNIT_TEST_SUITE(StanzaTest); + CPPUNIT_TEST(testConstructor_Copy); + CPPUNIT_TEST(testGetPayload); + CPPUNIT_TEST(testGetPayloads); + CPPUNIT_TEST(testGetPayload_NoSuchPayload); + CPPUNIT_TEST(testDestructor); + CPPUNIT_TEST(testDestructor_Copy); + CPPUNIT_TEST(testUpdatePayload_ExistingPayload); + CPPUNIT_TEST(testUpdatePayload_NewPayload); + CPPUNIT_TEST(testGetPayloadOfSameType); + CPPUNIT_TEST(testGetPayloadOfSameType_NoSuchPayload); + CPPUNIT_TEST(testGetTimestamp); + CPPUNIT_TEST(testGetTimestamp_TimestampWithFrom); + CPPUNIT_TEST(testGetTimestamp_NoDelay); + CPPUNIT_TEST(testGetTimestampFrom); + CPPUNIT_TEST(testGetTimestampFrom_Fallsback); + CPPUNIT_TEST_SUITE_END(); + + public: + class MyPayload1 : public Payload { + public: + MyPayload1() {} + }; + + class MyPayload2 : public Payload { + public: + MyPayload2(const std::string& s = "") : text_(s) {} + + std::string text_; + }; + + class MyPayload3 : public Payload { + public: + MyPayload3() {} + }; + + class DestroyingPayload : public Payload { + public: + DestroyingPayload(bool* alive) : alive_(alive) { + } + + ~DestroyingPayload() { + (*alive_) = false; + } + + private: + bool* alive_; + }; + + void testConstructor_Copy() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>()); + Message copy(m); + + CPPUNIT_ASSERT(copy.getPayload<MyPayload1>()); + CPPUNIT_ASSERT(copy.getPayload<MyPayload2>()); + } + + void testDestructor() { + bool payloadAlive = true; + { + Message m; + m.addPayload(std::make_shared<DestroyingPayload>(&payloadAlive)); + } + + CPPUNIT_ASSERT(!payloadAlive); + } + + void testDestructor_Copy() { + bool payloadAlive = true; + Message* m1 = new Message(); + m1->addPayload(std::make_shared<DestroyingPayload>(&payloadAlive)); + Message* m2 = new Message(*m1); + + delete m1; + CPPUNIT_ASSERT(payloadAlive); + + delete m2; + CPPUNIT_ASSERT(!payloadAlive); + } + + void testGetPayload() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>()); + m.addPayload(std::make_shared<MyPayload3>()); + + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + CPPUNIT_ASSERT(p); + } + + void testGetPayload_NoSuchPayload() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); + + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + CPPUNIT_ASSERT(!p); + } + + void testGetPayloads() { + Message m; + std::shared_ptr<MyPayload2> payload1(new MyPayload2()); + std::shared_ptr<MyPayload2> payload2(new MyPayload2()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(payload1); + m.addPayload(std::make_shared<MyPayload3>()); + m.addPayload(payload2); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m.getPayloads<MyPayload2>().size()); + CPPUNIT_ASSERT_EQUAL(payload1, m.getPayloads<MyPayload2>()[0]); + CPPUNIT_ASSERT_EQUAL(payload2, m.getPayloads<MyPayload2>()[1]); + } + + + void testUpdatePayload_ExistingPayload() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>("foo")); + m.addPayload(std::make_shared<MyPayload3>()); + + m.updatePayload(std::make_shared<MyPayload2>("bar")); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); + } + + void testUpdatePayload_NewPayload() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); + + m.updatePayload(std::make_shared<MyPayload2>("bar")); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); + } + + void testGetPayloadOfSameType() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>("foo")); + m.addPayload(std::make_shared<MyPayload3>()); + + std::shared_ptr<MyPayload2> payload(std::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(std::make_shared<MyPayload2>("bar")))); + CPPUNIT_ASSERT(payload); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_); + } + + void testGetPayloadOfSameType_NoSuchPayload() { + Message m; + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); + + CPPUNIT_ASSERT(!m.getPayloadOfSameType(std::make_shared<MyPayload2>("bar"))); + } + + void testGetTimestamp() { + Message m; + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1))); + + boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); + + CPPUNIT_ASSERT(timestamp); + CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); + } + + void testGetTimestamp_TimestampWithFrom() { + Message m; + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo@bar.com"))); + + boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); + + CPPUNIT_ASSERT(timestamp); + CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); + } + + void testGetTimestamp_NoDelay() { + Message m; + CPPUNIT_ASSERT(!m.getTimestamp()); + } + + void testGetTimestampFrom() { + Message m; + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(0))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); + + boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); + + CPPUNIT_ASSERT(timestamp); + CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:02"), boost::posix_time::to_simple_string(*timestamp)); + } + + void testGetTimestampFrom_Fallsback() { + Message m; + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); + + boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); + + CPPUNIT_ASSERT(timestamp); + CPPUNIT_ASSERT_EQUAL(std::string("1970-Jan-01 00:00:01"), boost::posix_time::to_simple_string(*timestamp)); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(StanzaTest); diff --git a/Swiften/Elements/UnknownElement.h b/Swiften/Elements/UnknownElement.h index 1d71e6b..b6f8021 100644 --- a/Swiften/Elements/UnknownElement.h +++ b/Swiften/Elements/UnknownElement.h @@ -10,8 +10,8 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API UnknownElement : public ToplevelElement { - public: - UnknownElement() {} - }; + class SWIFTEN_API UnknownElement : public ToplevelElement { + public: + UnknownElement() {} + }; } diff --git a/Swiften/Elements/UserLocation.h b/Swiften/Elements/UserLocation.h index a23da34..3bdaec6 100644 --- a/Swiften/Elements/UserLocation.h +++ b/Swiften/Elements/UserLocation.h @@ -1,227 +1,227 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/optional.hpp> #include <string> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API UserLocation : public Payload { - public: - - UserLocation(); - - virtual ~UserLocation(); + class SWIFTEN_API UserLocation : public Payload { + public: + + UserLocation(); + + virtual ~UserLocation(); + + const boost::optional< std::string >& getArea() const { + return area; + } + + void setArea(const boost::optional< std::string >& value) { + this->area = value ; + } - const boost::optional< std::string >& getArea() const { - return area; - } + const boost::optional< double >& getAltitude() const { + return altitude; + } - void setArea(const boost::optional< std::string >& value) { - this->area = value ; - } + void setAltitude(const boost::optional< double >& value) { + this->altitude = value ; + } - const boost::optional< float >& getAltitude() const { - return altitude; - } + const boost::optional< std::string >& getLocality() const { + return locality; + } - void setAltitude(const boost::optional< float >& value) { - this->altitude = value ; - } + void setLocality(const boost::optional< std::string >& value) { + this->locality = value ; + } - const boost::optional< std::string >& getLocality() const { - return locality; - } + const boost::optional< double >& getLatitude() const { + return latitude; + } - void setLocality(const boost::optional< std::string >& value) { - this->locality = value ; - } + void setLatitude(const boost::optional< double >& value) { + this->latitude = value ; + } - const boost::optional< float >& getLatitude() const { - return latitude; - } + const boost::optional< double >& getAccuracy() const { + return accuracy; + } - void setLatitude(const boost::optional< float >& value) { - this->latitude = value ; - } + void setAccuracy(const boost::optional< double >& value) { + this->accuracy = value ; + } - const boost::optional< float >& getAccuracy() const { - return accuracy; - } + const boost::optional< std::string >& getDescription() const { + return description; + } - void setAccuracy(const boost::optional< float >& value) { - this->accuracy = value ; - } + void setDescription(const boost::optional< std::string >& value) { + this->description = value ; + } - const boost::optional< std::string >& getDescription() const { - return description; - } + const boost::optional< std::string >& getCountryCode() const { + return countryCode; + } - void setDescription(const boost::optional< std::string >& value) { - this->description = value ; - } + void setCountryCode(const boost::optional< std::string >& value) { + this->countryCode = value ; + } - const boost::optional< std::string >& getCountryCode() const { - return countryCode; - } + const boost::optional< boost::posix_time::ptime >& getTimestamp() const { + return timestamp; + } - void setCountryCode(const boost::optional< std::string >& value) { - this->countryCode = value ; - } + void setTimestamp(const boost::optional< boost::posix_time::ptime >& value) { + this->timestamp = value ; + } - const boost::optional< boost::posix_time::ptime >& getTimestamp() const { - return timestamp; - } + const boost::optional< std::string >& getFloor() const { + return floor; + } - void setTimestamp(const boost::optional< boost::posix_time::ptime >& value) { - this->timestamp = value ; - } + void setFloor(const boost::optional< std::string >& value) { + this->floor = value ; + } - const boost::optional< std::string >& getFloor() const { - return floor; - } + const boost::optional< std::string >& getBuilding() const { + return building; + } - void setFloor(const boost::optional< std::string >& value) { - this->floor = value ; - } + void setBuilding(const boost::optional< std::string >& value) { + this->building = value ; + } - const boost::optional< std::string >& getBuilding() const { - return building; - } + const boost::optional< std::string >& getRoom() const { + return room; + } - void setBuilding(const boost::optional< std::string >& value) { - this->building = value ; - } + void setRoom(const boost::optional< std::string >& value) { + this->room = value ; + } - const boost::optional< std::string >& getRoom() const { - return room; - } - - void setRoom(const boost::optional< std::string >& value) { - this->room = value ; - } - - const boost::optional< std::string >& getCountry() const { - return country; - } - - void setCountry(const boost::optional< std::string >& value) { - this->country = value ; - } - - const boost::optional< std::string >& getRegion() const { - return region; - } - - void setRegion(const boost::optional< std::string >& value) { - this->region = value ; - } - - const boost::optional< std::string >& getURI() const { - return uri; - } - - void setURI(const boost::optional< std::string >& value) { - this->uri = value ; - } - - const boost::optional< float >& getLongitude() const { - return longitude; - } - - void setLongitude(const boost::optional< float >& value) { - this->longitude = value ; - } - - const boost::optional< float >& getError() const { - return error; - } - - void setError(const boost::optional< float >& value) { - this->error = value ; - } - - const boost::optional< std::string >& getPostalCode() const { - return postalCode; - } - - void setPostalCode(const boost::optional< std::string >& value) { - this->postalCode = value ; - } - - const boost::optional< float >& getBearing() const { - return bearing; - } - - void setBearing(const boost::optional< float >& value) { - this->bearing = value ; - } - - const boost::optional< std::string >& getText() const { - return text; - } - - void setText(const boost::optional< std::string >& value) { - this->text = value ; - } - - const boost::optional< std::string >& getDatum() const { - return datum; - } - - void setDatum(const boost::optional< std::string >& value) { - this->datum = value ; - } - - const boost::optional< std::string >& getStreet() const { - return street; - } - - void setStreet(const boost::optional< std::string >& value) { - this->street = value ; - } - - const boost::optional< float >& getSpeed() const { - return speed; - } - - void setSpeed(const boost::optional< float >& value) { - this->speed = value ; - } - - - private: - boost::optional< std::string > area; - boost::optional< float > altitude; - boost::optional< std::string > locality; - boost::optional< float > latitude; - boost::optional< float > accuracy; - boost::optional< std::string > description; - boost::optional< std::string > countryCode; - boost::optional< boost::posix_time::ptime > timestamp; - boost::optional< std::string > floor; - boost::optional< std::string > building; - boost::optional< std::string > room; - boost::optional< std::string > country; - boost::optional< std::string > region; - boost::optional< std::string > uri; - boost::optional< float > longitude; - boost::optional< float > error; - boost::optional< std::string > postalCode; - boost::optional< float > bearing; - boost::optional< std::string > text; - boost::optional< std::string > datum; - boost::optional< std::string > street; - boost::optional< float > speed; - }; + const boost::optional< std::string >& getCountry() const { + return country; + } + + void setCountry(const boost::optional< std::string >& value) { + this->country = value ; + } + + const boost::optional< std::string >& getRegion() const { + return region; + } + + void setRegion(const boost::optional< std::string >& value) { + this->region = value ; + } + + const boost::optional< std::string >& getURI() const { + return uri; + } + + void setURI(const boost::optional< std::string >& value) { + this->uri = value ; + } + + const boost::optional< double >& getLongitude() const { + return longitude; + } + + void setLongitude(const boost::optional< double >& value) { + this->longitude = value ; + } + + const boost::optional< double >& getError() const { + return error; + } + + void setError(const boost::optional< double >& value) { + this->error = value ; + } + + const boost::optional< std::string >& getPostalCode() const { + return postalCode; + } + + void setPostalCode(const boost::optional< std::string >& value) { + this->postalCode = value ; + } + + const boost::optional< double >& getBearing() const { + return bearing; + } + + void setBearing(const boost::optional< double >& value) { + this->bearing = value ; + } + + const boost::optional< std::string >& getText() const { + return text; + } + + void setText(const boost::optional< std::string >& value) { + this->text = value ; + } + + const boost::optional< std::string >& getDatum() const { + return datum; + } + + void setDatum(const boost::optional< std::string >& value) { + this->datum = value ; + } + + const boost::optional< std::string >& getStreet() const { + return street; + } + + void setStreet(const boost::optional< std::string >& value) { + this->street = value ; + } + + const boost::optional< double >& getSpeed() const { + return speed; + } + + void setSpeed(const boost::optional< double >& value) { + this->speed = value ; + } + + + private: + boost::optional< std::string > area; + boost::optional< double > altitude; + boost::optional< std::string > locality; + boost::optional< double > latitude; + boost::optional< double > accuracy; + boost::optional< std::string > description; + boost::optional< std::string > countryCode; + boost::optional< boost::posix_time::ptime > timestamp; + boost::optional< std::string > floor; + boost::optional< std::string > building; + boost::optional< std::string > room; + boost::optional< std::string > country; + boost::optional< std::string > region; + boost::optional< std::string > uri; + boost::optional< double > longitude; + boost::optional< double > error; + boost::optional< std::string > postalCode; + boost::optional< double > bearing; + boost::optional< std::string > text; + boost::optional< std::string > datum; + boost::optional< std::string > street; + boost::optional< double > speed; + }; } diff --git a/Swiften/Elements/UserTune.h b/Swiften/Elements/UserTune.h index 3b0d304..7def9b9 100644 --- a/Swiften/Elements/UserTune.h +++ b/Swiften/Elements/UserTune.h @@ -1,91 +1,91 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <Swiften/Base/Override.h> -#include <Swiften/Base/API.h> -#include <Swiften/Elements/Payload.h> -#include <boost/optional.hpp> #include <string> +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Base/Override.h> +#include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API UserTune : public Payload { - public: - - UserTune(); - - virtual ~UserTune(); - - const boost::optional< unsigned int >& getRating() const { - return rating; - } - - void setRating(const boost::optional< unsigned int >& value) { - this->rating = value ; - } - - const boost::optional< std::string >& getTitle() const { - return title; - } - - void setTitle(const boost::optional< std::string >& value) { - this->title = value ; - } - - const boost::optional< std::string >& getTrack() const { - return track; - } - - void setTrack(const boost::optional< std::string >& value) { - this->track = value ; - } - - const boost::optional< std::string >& getArtist() const { - return artist; - } - - void setArtist(const boost::optional< std::string >& value) { - this->artist = value ; - } - - const boost::optional< std::string >& getURI() const { - return uri; - } - - void setURI(const boost::optional< std::string >& value) { - this->uri = value ; - } - - const boost::optional< std::string >& getSource() const { - return source; - } - - void setSource(const boost::optional< std::string >& value) { - this->source = value ; - } - - const boost::optional< unsigned int >& getLength() const { - return length; - } - - void setLength(const boost::optional< unsigned int >& value) { - this->length = value ; - } - - - private: - boost::optional< unsigned int > rating; - boost::optional< std::string > title; - boost::optional< std::string > track; - boost::optional< std::string > artist; - boost::optional< std::string > uri; - boost::optional< std::string > source; - boost::optional< unsigned int > length; - }; + class SWIFTEN_API UserTune : public Payload { + public: + + UserTune(); + + virtual ~UserTune(); + + const boost::optional< unsigned int >& getRating() const { + return rating; + } + + void setRating(const boost::optional< unsigned int >& value) { + this->rating = value ; + } + + const boost::optional< std::string >& getTitle() const { + return title; + } + + void setTitle(const boost::optional< std::string >& value) { + this->title = value ; + } + + const boost::optional< std::string >& getTrack() const { + return track; + } + + void setTrack(const boost::optional< std::string >& value) { + this->track = value ; + } + + const boost::optional< std::string >& getArtist() const { + return artist; + } + + void setArtist(const boost::optional< std::string >& value) { + this->artist = value ; + } + + const boost::optional< std::string >& getURI() const { + return uri; + } + + void setURI(const boost::optional< std::string >& value) { + this->uri = value ; + } + + const boost::optional< std::string >& getSource() const { + return source; + } + + void setSource(const boost::optional< std::string >& value) { + this->source = value ; + } + + const boost::optional< unsigned int >& getLength() const { + return length; + } + + void setLength(const boost::optional< unsigned int >& value) { + this->length = value ; + } + + + private: + boost::optional< unsigned int > rating; + boost::optional< std::string > title; + boost::optional< std::string > track; + boost::optional< std::string > artist; + boost::optional< std::string > uri; + boost::optional< std::string > source; + boost::optional< unsigned int > length; + }; } diff --git a/Swiften/Elements/VCard.cpp b/Swiften/Elements/VCard.cpp index ffa90e7..571ead4 100644 --- a/Swiften/Elements/VCard.cpp +++ b/Swiften/Elements/VCard.cpp @@ -1,25 +1,23 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/VCard.h> -#include <Swiften/Base/foreach.h> - namespace Swift { VCard::EMailAddress VCard::getPreferredEMailAddress() const { - foreach(const EMailAddress& address, emailAddresses_) { - if (address.isPreferred) { - return address; - } - } - if (!emailAddresses_.empty()) { - return emailAddresses_[0]; - } - return EMailAddress(); + for (const auto& address : emailAddresses_) { + if (address.isPreferred) { + return address; + } + } + if (!emailAddresses_.empty()) { + return emailAddresses_[0]; + } + return EMailAddress(); } diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h index 54f52c2..5a43c3c 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -1,302 +1,303 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> + #include <boost/date_time/posix_time/ptime.hpp> -#include <string> #include <Swiften/Base/API.h> -#include <Swiften/JID/JID.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> namespace Swift { - class SWIFTEN_API VCard : public Payload { - public: - typedef boost::shared_ptr<VCard> ref; - - struct EMailAddress { - EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) { - } - - bool isHome; - bool isWork; - bool isInternet; - bool isPreferred; - bool isX400; - std::string address; - }; - - struct Telephone { - Telephone() : isHome(false), isWork(false), isVoice(false), isFax(false), isPager(false), isMSG(false), isCell(false), - isVideo(false), isBBS(false), isModem(false), isISDN(false), isPCS(false), isPreferred(false) { - } - - bool isHome; - bool isWork; - bool isVoice; - bool isFax; - bool isPager; - bool isMSG; - bool isCell; - bool isVideo; - bool isBBS; - bool isModem; - bool isISDN; - bool isPCS; - bool isPreferred; - std::string number; - }; - - enum DeliveryType { - DomesticDelivery, - InternationalDelivery, - None - }; - - struct Address { - Address() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { - } - - bool isHome; - bool isWork; - bool isPostal; - bool isParcel; - DeliveryType deliveryType; - bool isPreferred; - - std::string poBox; - std::string addressExtension; - std::string street; - std::string locality; - std::string region; - std::string postalCode; - std::string country; - }; - - struct AddressLabel { - AddressLabel() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { - } - - bool isHome; - bool isWork; - bool isPostal; - bool isParcel; - DeliveryType deliveryType; - bool isPreferred; - std::vector<std::string> lines; - }; - - struct Organization { - std::string name; - std::vector<std::string> units; - }; - - VCard() {} - - void setVersion(const std::string& version) { version_ = version; } - const std::string& getVersion() const { return version_; } - - void setFullName(const std::string& fullName) { fullName_ = fullName; } - const std::string& getFullName() const { return fullName_; } - - void setFamilyName(const std::string& familyName) { familyName_ = familyName; } - const std::string& getFamilyName() const { return familyName_; } - - void setGivenName(const std::string& givenName) { givenName_ = givenName; } - const std::string& getGivenName() const { return givenName_; } - - void setMiddleName(const std::string& middleName) { middleName_ = middleName; } - const std::string& getMiddleName() const { return middleName_; } - - void setPrefix(const std::string& prefix) { prefix_ = prefix; } - const std::string& getPrefix() const { return prefix_; } - - void setSuffix(const std::string& suffix) { suffix_ = suffix; } - const std::string& getSuffix() const { return suffix_; } - - - //void setEMailAddress(const std::string& email) { email_ = email; } - //const std::string& getEMailAddress() const { return email_; } - - void setNickname(const std::string& nick) { nick_ = nick; } - const std::string& getNickname() const { return nick_; } - - void setPhoto(const ByteArray& photo) { photo_ = photo; } - const ByteArray& getPhoto() const { return photo_; } - - void setPhotoType(const std::string& photoType) { photoType_ = photoType; } - const std::string& getPhotoType() const { return photoType_; } - - const std::string& getUnknownContent() const { return unknownContent_; } - void addUnknownContent(const std::string& c) { - unknownContent_ += c; - } - - const std::vector<EMailAddress>& getEMailAddresses() const { - return emailAddresses_; - } - - void addEMailAddress(const EMailAddress& email) { - emailAddresses_.push_back(email); - } - - void clearEMailAddresses() { - emailAddresses_.clear(); - } + class SWIFTEN_API VCard : public Payload { + public: + typedef std::shared_ptr<VCard> ref; + + struct EMailAddress { + EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) { + } + + bool isHome; + bool isWork; + bool isInternet; + bool isPreferred; + bool isX400; + std::string address; + }; + + struct Telephone { + Telephone() : isHome(false), isWork(false), isVoice(false), isFax(false), isPager(false), isMSG(false), isCell(false), + isVideo(false), isBBS(false), isModem(false), isISDN(false), isPCS(false), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isVoice; + bool isFax; + bool isPager; + bool isMSG; + bool isCell; + bool isVideo; + bool isBBS; + bool isModem; + bool isISDN; + bool isPCS; + bool isPreferred; + std::string number; + }; + + enum DeliveryType { + DomesticDelivery, + InternationalDelivery, + None + }; + + struct Address { + Address() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isPostal; + bool isParcel; + DeliveryType deliveryType; + bool isPreferred; + + std::string poBox; + std::string addressExtension; + std::string street; + std::string locality; + std::string region; + std::string postalCode; + std::string country; + }; + + struct AddressLabel { + AddressLabel() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isPostal; + bool isParcel; + DeliveryType deliveryType; + bool isPreferred; + std::vector<std::string> lines; + }; + + struct Organization { + std::string name; + std::vector<std::string> units; + }; + + VCard() {} + + void setVersion(const std::string& version) { version_ = version; } + const std::string& getVersion() const { return version_; } + + void setFullName(const std::string& fullName) { fullName_ = fullName; } + const std::string& getFullName() const { return fullName_; } + + void setFamilyName(const std::string& familyName) { familyName_ = familyName; } + const std::string& getFamilyName() const { return familyName_; } + + void setGivenName(const std::string& givenName) { givenName_ = givenName; } + const std::string& getGivenName() const { return givenName_; } + + void setMiddleName(const std::string& middleName) { middleName_ = middleName; } + const std::string& getMiddleName() const { return middleName_; } + + void setPrefix(const std::string& prefix) { prefix_ = prefix; } + const std::string& getPrefix() const { return prefix_; } + + void setSuffix(const std::string& suffix) { suffix_ = suffix; } + const std::string& getSuffix() const { return suffix_; } + + + //void setEMailAddress(const std::string& email) { email_ = email; } + //const std::string& getEMailAddress() const { return email_; } + + void setNickname(const std::string& nick) { nick_ = nick; } + const std::string& getNickname() const { return nick_; } + + void setPhoto(const ByteArray& photo) { photo_ = photo; } + const ByteArray& getPhoto() const { return photo_; } + + void setPhotoType(const std::string& photoType) { photoType_ = photoType; } + const std::string& getPhotoType() const { return photoType_; } + + const std::string& getUnknownContent() const { return unknownContent_; } + void addUnknownContent(const std::string& c) { + unknownContent_ += c; + } + + const std::vector<EMailAddress>& getEMailAddresses() const { + return emailAddresses_; + } + + void addEMailAddress(const EMailAddress& email) { + emailAddresses_.push_back(email); + } + + void clearEMailAddresses() { + emailAddresses_.clear(); + } - EMailAddress getPreferredEMailAddress() const; + EMailAddress getPreferredEMailAddress() const; - void setBirthday(const boost::posix_time::ptime& birthday) { - birthday_ = birthday; - } + void setBirthday(const boost::posix_time::ptime& birthday) { + birthday_ = birthday; + } - const boost::posix_time::ptime& getBirthday() const { - return birthday_; - } + const boost::posix_time::ptime& getBirthday() const { + return birthday_; + } - const std::vector<Telephone>& getTelephones() const { - return telephones_; - } + const std::vector<Telephone>& getTelephones() const { + return telephones_; + } - void addTelephone(const Telephone& phone) { - telephones_.push_back(phone); - } + void addTelephone(const Telephone& phone) { + telephones_.push_back(phone); + } - void clearTelephones() { - telephones_.clear(); - } + void clearTelephones() { + telephones_.clear(); + } - const std::vector<Address>& getAddresses() const { - return addresses_; - } + const std::vector<Address>& getAddresses() const { + return addresses_; + } - void addAddress(const Address& address) { - addresses_.push_back(address); - } + void addAddress(const Address& address) { + addresses_.push_back(address); + } - void clearAddresses() { - addresses_.clear(); - } - - const std::vector<AddressLabel>& getAddressLabels() const { - return addressLabels_; - } - - void addAddressLabel(const AddressLabel& addressLabel) { - addressLabels_.push_back(addressLabel); - } - - void clearAddressLabels() { - addressLabels_.clear(); - } - - const std::vector<JID>& getJIDs() const { - return jids_; - } - - void addJID(const JID& jid) { - jids_.push_back(jid); - } - - void clearJIDs() { - jids_.clear(); - } - - const std::string& getDescription() const { - return description_; - } - - void setDescription(const std::string& description) { - this->description_ = description; - } - - const std::vector<Organization>& getOrganizations() const { - return organizations_; - } - - void addOrganization(const Organization& organization) { - organizations_.push_back(organization); - } - - void clearOrganizations() { - organizations_.clear(); - } - - const std::vector<std::string>& getTitles() const { - return titles_; - } - - void addTitle(const std::string& title) { - titles_.push_back(title); - } - - void clearTitles() { - titles_.clear(); - } - - const std::vector<std::string>& getRoles() const { - return roles_; - } - - void addRole(const std::string& role) { - roles_.push_back(role); - } - - void clearRoles() { - roles_.clear(); - } - - const std::vector<std::string>& getURLs() const { - return urls_; - } - - void addURL(const std::string& url) { - urls_.push_back(url); - } - - void clearURLs() { - urls_.clear(); - } - - bool isEmpty() const { - bool empty = version_.empty() && fullName_.empty() && familyName_.empty() && givenName_.empty() && middleName_.empty() && prefix_.empty() && suffix_.empty(); - empty &= photo_.empty() && photoType_.empty() && nick_.empty(); - empty &= birthday_.is_not_a_date_time(); - empty &= unknownContent_.empty(); - empty &= emailAddresses_.empty() && telephones_.empty() && addresses_.empty() && addressLabels_.empty() && jids_.empty(); - empty &= description_.empty() && organizations_.empty() && titles_.empty() && roles_.empty() && urls_.empty(); - return empty; - } - - private: - std::string version_; - std::string fullName_; - std::string familyName_; - std::string givenName_; - std::string middleName_; - std::string prefix_; - std::string suffix_; - //std::string email_; - ByteArray photo_; - std::string photoType_; - std::string nick_; - boost::posix_time::ptime birthday_; - std::string unknownContent_; - std::vector<EMailAddress> emailAddresses_; - std::vector<Telephone> telephones_; - std::vector<Address> addresses_; - std::vector<AddressLabel> addressLabels_; - std::vector<JID> jids_; - std::string description_; - std::vector<Organization> organizations_; - std::vector<std::string> titles_; - std::vector<std::string> roles_; - std::vector<std::string> urls_; - }; + void clearAddresses() { + addresses_.clear(); + } + + const std::vector<AddressLabel>& getAddressLabels() const { + return addressLabels_; + } + + void addAddressLabel(const AddressLabel& addressLabel) { + addressLabels_.push_back(addressLabel); + } + + void clearAddressLabels() { + addressLabels_.clear(); + } + + const std::vector<JID>& getJIDs() const { + return jids_; + } + + void addJID(const JID& jid) { + jids_.push_back(jid); + } + + void clearJIDs() { + jids_.clear(); + } + + const std::string& getDescription() const { + return description_; + } + + void setDescription(const std::string& description) { + this->description_ = description; + } + + const std::vector<Organization>& getOrganizations() const { + return organizations_; + } + + void addOrganization(const Organization& organization) { + organizations_.push_back(organization); + } + + void clearOrganizations() { + organizations_.clear(); + } + + const std::vector<std::string>& getTitles() const { + return titles_; + } + + void addTitle(const std::string& title) { + titles_.push_back(title); + } + + void clearTitles() { + titles_.clear(); + } + + const std::vector<std::string>& getRoles() const { + return roles_; + } + + void addRole(const std::string& role) { + roles_.push_back(role); + } + + void clearRoles() { + roles_.clear(); + } + + const std::vector<std::string>& getURLs() const { + return urls_; + } + + void addURL(const std::string& url) { + urls_.push_back(url); + } + + void clearURLs() { + urls_.clear(); + } + + bool isEmpty() const { + bool empty = version_.empty() && fullName_.empty() && familyName_.empty() && givenName_.empty() && middleName_.empty() && prefix_.empty() && suffix_.empty(); + empty &= photo_.empty() && photoType_.empty() && nick_.empty(); + empty &= birthday_.is_not_a_date_time(); + empty &= unknownContent_.empty(); + empty &= emailAddresses_.empty() && telephones_.empty() && addresses_.empty() && addressLabels_.empty() && jids_.empty(); + empty &= description_.empty() && organizations_.empty() && titles_.empty() && roles_.empty() && urls_.empty(); + return empty; + } + + private: + std::string version_; + std::string fullName_; + std::string familyName_; + std::string givenName_; + std::string middleName_; + std::string prefix_; + std::string suffix_; + //std::string email_; + ByteArray photo_; + std::string photoType_; + std::string nick_; + boost::posix_time::ptime birthday_; + std::string unknownContent_; + std::vector<EMailAddress> emailAddresses_; + std::vector<Telephone> telephones_; + std::vector<Address> addresses_; + std::vector<AddressLabel> addressLabels_; + std::vector<JID> jids_; + std::string description_; + std::vector<Organization> organizations_; + std::vector<std::string> titles_; + std::vector<std::string> roles_; + std::vector<std::string> urls_; + }; } diff --git a/Swiften/Elements/VCardUpdate.h b/Swiften/Elements/VCardUpdate.h index ded26c9..e3b5377 100644 --- a/Swiften/Elements/VCardUpdate.h +++ b/Swiften/Elements/VCardUpdate.h @@ -12,14 +12,14 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API VCardUpdate : public Payload { - public: - VCardUpdate(const std::string& photoHash = "") : photoHash_(photoHash) {} + class SWIFTEN_API VCardUpdate : public Payload { + public: + VCardUpdate(const std::string& photoHash = "") : photoHash_(photoHash) {} - void setPhotoHash(const std::string& photoHash) { photoHash_ = photoHash; } - const std::string& getPhotoHash() const { return photoHash_; } + void setPhotoHash(const std::string& photoHash) { photoHash_ = photoHash; } + const std::string& getPhotoHash() const { return photoHash_; } - private: - std::string photoHash_; - }; + private: + std::string photoHash_; + }; } diff --git a/Swiften/Elements/Version.h b/Swiften/Elements/Version.h index b14dcf0..1d734be 100644 --- a/Swiften/Elements/Version.h +++ b/Swiften/Elements/Version.h @@ -12,17 +12,17 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API Version : public Payload { - public: - Version(const std::string& name = "", const std::string& version = "", const std::string& os = "") : name_(name), version_(version), os_(os) { } + class SWIFTEN_API Version : public Payload { + public: + Version(const std::string& name = "", const std::string& version = "", const std::string& os = "") : name_(name), version_(version), os_(os) { } - const std::string& getName() const { return name_; } - const std::string& getVersion() const { return version_; } - const std::string& getOS() const { return os_; } + const std::string& getName() const { return name_; } + const std::string& getVersion() const { return version_; } + const std::string& getOS() const { return os_; } - private: - std::string name_; - std::string version_; - std::string os_; - }; + private: + std::string name_; + std::string version_; + std::string os_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp index f4ff01a..037fde4 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp @@ -4,52 +4,59 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> -#include <Swiften/Base/String.h> + #include <cstdio> #include <iomanip> #include <sstream> -#include <iostream> + +#include <Swiften/Base/String.h> namespace Swift { - WhiteboardColor::WhiteboardColor() : red_(0), green_(0), blue_(0), alpha_(255) { - } - - WhiteboardColor::WhiteboardColor(int red, int green, int blue, int alpha) : red_(red), green_(green), blue_(blue), alpha_(alpha) { - } - - WhiteboardColor::WhiteboardColor(const std::string& hex) : alpha_(255) { - int value = String::convertHexStringToInt(hex.substr(1)); - red_ = (value >> 16)&0xFF; - green_ = (value >> 8)&0xFF; - blue_ = value&0xFF; - } - - std::string WhiteboardColor::toHex() const { - std::string value = String::convertIntToHexString((red_ << 16) + (green_ << 8) + blue_); - while (value.size() < 6) { - value.insert(0, "0"); - } - return "#"+value; - } - - int WhiteboardColor::getRed() const { - return red_; - } - - int WhiteboardColor::getGreen() const { - return green_; - } - - int WhiteboardColor::getBlue() const { - return blue_; - } - - int WhiteboardColor::getAlpha() const { - return alpha_; - } - - void WhiteboardColor::setAlpha(int alpha) { - alpha_ = alpha; - } + WhiteboardColor::WhiteboardColor() : red_(0), green_(0), blue_(0), alpha_(255) { + } + + WhiteboardColor::WhiteboardColor(int red, int green, int blue, int alpha) : red_(red), green_(green), blue_(blue), alpha_(alpha) { + } + + WhiteboardColor::WhiteboardColor(const std::string& hex) : alpha_(255) { + int value = String::convertHexStringToInt(hex.substr(1)); + red_ = (value >> 16)&0xFF; + green_ = (value >> 8)&0xFF; + blue_ = value&0xFF; + } + + std::string WhiteboardColor::toHex() const { + std::string value = String::convertIntToHexString((red_ << 16) + (green_ << 8) + blue_); + while (value.size() < 6) { + value.insert(0, "0"); + } + return "#"+value; + } + + int WhiteboardColor::getRed() const { + return red_; + } + + int WhiteboardColor::getGreen() const { + return green_; + } + + int WhiteboardColor::getBlue() const { + return blue_; + } + + int WhiteboardColor::getAlpha() const { + return alpha_; + } + + void WhiteboardColor::setAlpha(int alpha) { + alpha_ = alpha; + } } diff --git a/Swiften/Elements/Whiteboard/WhiteboardColor.h b/Swiften/Elements/Whiteboard/WhiteboardColor.h index 3b3d93c..6402efd 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardColor.h +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.h @@ -11,20 +11,20 @@ #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API WhiteboardColor { - public: - WhiteboardColor(); - WhiteboardColor(int red, int green, int blue, int alpha = 255); - WhiteboardColor(const std::string& hex); - std::string toHex() const; - int getRed() const; - int getGreen() const; - int getBlue() const; - int getAlpha() const; - void setAlpha(int alpha); + class SWIFTEN_API WhiteboardColor { + public: + WhiteboardColor(); + WhiteboardColor(int red, int green, int blue, int alpha = 255); + WhiteboardColor(const std::string& hex); + std::string toHex() const; + int getRed() const; + int getGreen() const; + int getBlue() const; + int getAlpha() const; + void setAlpha(int alpha); - private: - int red_, green_, blue_; - int alpha_; - }; + private: + int red_, green_, blue_; + int alpha_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h index 297e75a..ae0fe17 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,23 +13,23 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> namespace Swift { - class SWIFTEN_API WhiteboardDeleteOperation : public WhiteboardOperation { - public: - typedef boost::shared_ptr<WhiteboardDeleteOperation> ref; - public: - std::string getElementID() const { - return elementID_; - } + class SWIFTEN_API WhiteboardDeleteOperation : public WhiteboardOperation { + public: + typedef std::shared_ptr<WhiteboardDeleteOperation> ref; + public: + std::string getElementID() const { + return elementID_; + } - void setElementID(const std::string& elementID) { - elementID_ = elementID; - } + void setElementID(const std::string& elementID) { + elementID_ = elementID; + } - private: - std::string elementID_; - }; + private: + std::string elementID_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardElement.h b/Swiften/Elements/Whiteboard/WhiteboardElement.h index df774d9..6f6ff4f 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardElement.h @@ -4,29 +4,37 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> + #include <Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h> namespace Swift { - class WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardElement> ref; + class WhiteboardElement { + public: + typedef std::shared_ptr<WhiteboardElement> ref; - public: - virtual ~WhiteboardElement() {} - virtual void accept(WhiteboardElementVisitor& visitor) = 0; + public: + virtual ~WhiteboardElement() {} + virtual void accept(WhiteboardElementVisitor& visitor) = 0; - const std::string& getID() const { - return id_; - } + const std::string& getID() const { + return id_; + } - void setID(const std::string& id) { - id_ = id; - } + void setID(const std::string& id) { + id_ = id; + } - private: - std::string id_; - }; + private: + std::string id_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h b/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h index 413d6cf..090af56 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h +++ b/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h @@ -7,21 +7,21 @@ #pragma once namespace Swift { - class WhiteboardLineElement; - class WhiteboardFreehandPathElement; - class WhiteboardRectElement; - class WhiteboardPolygonElement; - class WhiteboardTextElement; - class WhiteboardEllipseElement; + class WhiteboardLineElement; + class WhiteboardFreehandPathElement; + class WhiteboardRectElement; + class WhiteboardPolygonElement; + class WhiteboardTextElement; + class WhiteboardEllipseElement; - class WhiteboardElementVisitor { - public: - virtual ~WhiteboardElementVisitor() {} - virtual void visit(WhiteboardLineElement& /*element*/) = 0; - virtual void visit(WhiteboardFreehandPathElement& /*element*/) = 0; - virtual void visit(WhiteboardRectElement& /*element*/) = 0; - virtual void visit(WhiteboardPolygonElement& /*element*/) = 0; - virtual void visit(WhiteboardTextElement& /*element*/) = 0; - virtual void visit(WhiteboardEllipseElement& /*element*/) = 0; - }; + class WhiteboardElementVisitor { + public: + virtual ~WhiteboardElementVisitor() {} + virtual void visit(WhiteboardLineElement& /*element*/) = 0; + virtual void visit(WhiteboardFreehandPathElement& /*element*/) = 0; + virtual void visit(WhiteboardRectElement& /*element*/) = 0; + virtual void visit(WhiteboardPolygonElement& /*element*/) = 0; + virtual void visit(WhiteboardTextElement& /*element*/) = 0; + virtual void visit(WhiteboardEllipseElement& /*element*/) = 0; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h index 88d0907..8086aed 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,69 +13,69 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardEllipseElement : public WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardEllipseElement> ref; - public: - WhiteboardEllipseElement(int cx, int cy, int rx, int ry) { - cx_ = cx; - cy_ = cy; - rx_ = rx; - ry_ = ry; - } - - int getCX() const { - return cx_; - } - - int getCY() const { - return cy_; - } - - int getRX() const { - return rx_; - } - - int getRY() const { - return ry_; - } - - const WhiteboardColor& getPenColor() const { - return penColor_; - } - - void setPenColor(const WhiteboardColor& color) { - penColor_ = color; - } - - const WhiteboardColor& getBrushColor() const { - return brushColor_; - } - - void setBrushColor(const WhiteboardColor& color) { - brushColor_ = color; - } - - int getPenWidth() const { - return penWidth_; - } - - void setPenWidth(const int penWidth) { - penWidth_ = penWidth; - } - - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } - - private: - int cx_, cy_, rx_, ry_; - WhiteboardColor penColor_; - WhiteboardColor brushColor_; - int penWidth_; - }; + class SWIFTEN_API WhiteboardEllipseElement : public WhiteboardElement { + public: + typedef std::shared_ptr<WhiteboardEllipseElement> ref; + public: + WhiteboardEllipseElement(int cx, int cy, int rx, int ry) { + cx_ = cx; + cy_ = cy; + rx_ = rx; + ry_ = ry; + } + + int getCX() const { + return cx_; + } + + int getCY() const { + return cy_; + } + + int getRX() const { + return rx_; + } + + int getRY() const { + return ry_; + } + + const WhiteboardColor& getPenColor() const { + return penColor_; + } + + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } + + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } + + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int cx_, cy_, rx_, ry_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_ = 0; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h index 6e200fd..bc6c846 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h @@ -5,60 +5,60 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <utility> +#include <vector> + #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> - -#include <vector> -#include <utility> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardFreehandPathElement : public WhiteboardElement { - typedef std::pair<int, int> Point; - public: - typedef boost::shared_ptr<WhiteboardFreehandPathElement> ref; - public: - WhiteboardFreehandPathElement() { - } + class SWIFTEN_API WhiteboardFreehandPathElement : public WhiteboardElement { + typedef std::pair<int, int> Point; + public: + typedef std::shared_ptr<WhiteboardFreehandPathElement> ref; + public: + WhiteboardFreehandPathElement() { + } - void setPoints(const std::vector<Point>& points) { - points_ = points; - } + void setPoints(const std::vector<Point>& points) { + points_ = points; + } - const std::vector<Point>& getPoints() const { - return points_; - } + const std::vector<Point>& getPoints() const { + return points_; + } - const WhiteboardColor& getColor() const { - return color_; - } + const WhiteboardColor& getColor() const { + return color_; + } - void setColor(const WhiteboardColor& color) { - color_ = color; - } + void setColor(const WhiteboardColor& color) { + color_ = color; + } - int getPenWidth() const { - return penWidth_; - } + int getPenWidth() const { + return penWidth_; + } - void setPenWidth(const int penWidth) { - penWidth_ = penWidth; - } + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } - private: - std::vector<Point> points_; - WhiteboardColor color_; - int penWidth_; - }; + private: + std::vector<Point> points_; + WhiteboardColor color_; + int penWidth_ = 0; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h index d52adc2..256c17e 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,23 +13,23 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> namespace Swift { - class SWIFTEN_API WhiteboardInsertOperation : public WhiteboardOperation { - public: - typedef boost::shared_ptr<WhiteboardInsertOperation> ref; - public: - WhiteboardElement::ref getElement() const { - return element_; - } + class SWIFTEN_API WhiteboardInsertOperation : public WhiteboardOperation { + public: + typedef std::shared_ptr<WhiteboardInsertOperation> ref; + public: + WhiteboardElement::ref getElement() const { + return element_; + } - void setElement(WhiteboardElement::ref element) { - element_ = element; - } + void setElement(WhiteboardElement::ref element) { + element_ = element; + } - private: - WhiteboardElement::ref element_; - }; + private: + WhiteboardElement::ref element_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h index 267fb33..9c64977 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,60 +14,60 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardLineElement : public WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardLineElement> ref; - public: - WhiteboardLineElement(int x1, int y1, int x2, int y2) : penWidth_(1) { - x1_ = x1; - y1_ = y1; - x2_ = x2; - y2_ = y2; - } + class SWIFTEN_API WhiteboardLineElement : public WhiteboardElement { + public: + typedef std::shared_ptr<WhiteboardLineElement> ref; + public: + WhiteboardLineElement(int x1, int y1, int x2, int y2) : penWidth_(1) { + x1_ = x1; + y1_ = y1; + x2_ = x2; + y2_ = y2; + } - int x1() const { - return x1_; - } + int x1() const { + return x1_; + } - int y1() const { - return y1_; - } + int y1() const { + return y1_; + } - int x2() const { - return x2_; - } + int x2() const { + return x2_; + } - int y2() const { - return y2_; - } + int y2() const { + return y2_; + } - const WhiteboardColor& getColor() const { - return color_; - } + const WhiteboardColor& getColor() const { + return color_; + } - void setColor(const WhiteboardColor& color) { - color_ = color; - } + void setColor(const WhiteboardColor& color) { + color_ = color; + } - int getPenWidth() const { - return penWidth_; - } + int getPenWidth() const { + return penWidth_; + } - void setPenWidth(const int penWidth) { - penWidth_ = penWidth; - } + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } - private: - int x1_, y1_, x2_, y2_; - WhiteboardColor color_; - int penWidth_; - }; + private: + int x1_, y1_, x2_, y2_; + WhiteboardColor color_; + int penWidth_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardOperation.h b/Swiften/Elements/Whiteboard/WhiteboardOperation.h index 497d551..2e90c69 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h @@ -4,48 +4,56 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <Swiften/Base/API.h> -#include <boost/smart_ptr/shared_ptr.hpp> #include <string> +#include <boost/smart_ptr/shared_ptr.hpp> + +#include <Swiften/Base/API.h> + namespace Swift { - class WhiteboardOperation { - public: - typedef boost::shared_ptr<WhiteboardOperation> ref; - public: - WhiteboardOperation() {} - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(WhiteboardOperation) - virtual ~WhiteboardOperation(){} - - std::string getID() const { - return id_; - } - - void setID(const std::string& id) { - id_ = id; - } - - std::string getParentID() const { - return parentID_; - } - - void setParentID(const std::string& parentID) { - parentID_ = parentID; - } - - int getPos() const { - return pos_; - } - - void setPos(int pos) { - pos_ = pos; - } - - private: - std::string id_; - std::string parentID_; - int pos_; - }; + class WhiteboardOperation { + public: + typedef std::shared_ptr<WhiteboardOperation> ref; + public: + WhiteboardOperation() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(WhiteboardOperation) + virtual ~WhiteboardOperation(){} + + std::string getID() const { + return id_; + } + + void setID(const std::string& id) { + id_ = id; + } + + std::string getParentID() const { + return parentID_; + } + + void setParentID(const std::string& parentID) { + parentID_ = parentID; + } + + int getPos() const { + return pos_; + } + + void setPos(int pos) { + pos_ = pos; + } + + private: + std::string id_; + std::string parentID_; + int pos_ = 0; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h index 38bc3e1..6ad5dc7 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -19,54 +19,54 @@ #include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardPolygonElement : public WhiteboardElement { - typedef std::pair<int, int> Point; - public: - typedef boost::shared_ptr<WhiteboardPolygonElement> ref; - public: - WhiteboardPolygonElement() { - } + class SWIFTEN_API WhiteboardPolygonElement : public WhiteboardElement { + typedef std::pair<int, int> Point; + public: + typedef std::shared_ptr<WhiteboardPolygonElement> ref; + public: + WhiteboardPolygonElement() { + } - const std::vector<Point>& getPoints() const { - return points_; - } + const std::vector<Point>& getPoints() const { + return points_; + } - void setPoints(const std::vector<Point>& points) { - points_ = points; - } + void setPoints(const std::vector<Point>& points) { + points_ = points; + } - const WhiteboardColor& getPenColor() const { - return penColor_; - } + const WhiteboardColor& getPenColor() const { + return penColor_; + } - void setPenColor(const WhiteboardColor& color) { - penColor_ = color; - } + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } - const WhiteboardColor& getBrushColor() const { - return brushColor_; - } + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } - void setBrushColor(const WhiteboardColor& color) { - brushColor_ = color; - } + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } - int getPenWidth() const { - return penWidth_; - } + int getPenWidth() const { + return penWidth_; + } - void setPenWidth(const int penWidth) { - penWidth_ = penWidth; - } + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } - private: - std::vector<Point> points_; - WhiteboardColor penColor_; - WhiteboardColor brushColor_; - int penWidth_; - }; + private: + std::vector<Point> points_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_ = 0; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h index f22ab5c..4dcdc8a 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,69 +13,69 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardRectElement : public WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardRectElement> ref; - public: - WhiteboardRectElement(int x, int y, int width, int height) : penWidth_(1) { - x_ = x; - y_ = y; - width_ = width; - height_ = height; - } - - int getX() const { - return x_; - } - - int getY() const { - return y_; - } - - int getWidth() const { - return width_; - } - - int getHeight() const { - return height_; - } - - const WhiteboardColor& getPenColor() const { - return penColor_; - } - - void setPenColor(const WhiteboardColor& color) { - penColor_ = color; - } - - const WhiteboardColor& getBrushColor() const { - return brushColor_; - } - - void setBrushColor(const WhiteboardColor& color) { - brushColor_ = color; - } - - int getPenWidth() const { - return penWidth_; - } - - void setPenWidth(const int penWidth) { - penWidth_ = penWidth; - } - - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } - - private: - int x_, y_, width_, height_; - WhiteboardColor penColor_; - WhiteboardColor brushColor_; - int penWidth_; - }; + class SWIFTEN_API WhiteboardRectElement : public WhiteboardElement { + public: + typedef std::shared_ptr<WhiteboardRectElement> ref; + public: + WhiteboardRectElement(int x, int y, int width, int height) : penWidth_(1) { + x_ = x; + y_ = y; + width_ = width; + height_ = height; + } + + int getX() const { + return x_; + } + + int getY() const { + return y_; + } + + int getWidth() const { + return width_; + } + + int getHeight() const { + return height_; + } + + const WhiteboardColor& getPenColor() const { + return penColor_; + } + + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } + + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } + + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int x_, y_, width_, height_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h index bd9b579..2e1c145 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,59 +13,59 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> namespace Swift { - class SWIFTEN_API WhiteboardTextElement : public WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardTextElement> ref; - public: - WhiteboardTextElement(int x, int y) { - x_ = x; - y_ = y; - } + class SWIFTEN_API WhiteboardTextElement : public WhiteboardElement { + public: + typedef std::shared_ptr<WhiteboardTextElement> ref; + public: + WhiteboardTextElement(int x, int y) { + x_ = x; + y_ = y; + } - void setText(const std::string text) { - text_ = text; - } + void setText(const std::string text) { + text_ = text; + } - const std::string& getText() const { - return text_; - } + const std::string& getText() const { + return text_; + } - int getX() const { - return x_; - } + int getX() const { + return x_; + } - int getY() const { - return y_; - } + int getY() const { + return y_; + } - const WhiteboardColor& getColor() const { - return color_; - } + const WhiteboardColor& getColor() const { + return color_; + } - void setColor(const WhiteboardColor& color) { - color_ = color; - } + void setColor(const WhiteboardColor& color) { + color_ = color; + } - int getSize() const { - return size_; - } + int getSize() const { + return size_; + } - void setSize(const int size) { - size_ = size; - } + void setSize(const int size) { + size_ = size; + } - void accept(WhiteboardElementVisitor& visitor) { - visitor.visit(*this); - } + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } - private: - int x_, y_; - int size_; - std::string text_; - WhiteboardColor color_; - }; + private: + int x_, y_; + int size_ = 0; + std::string text_; + WhiteboardColor color_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h index af07e8f..36cbc6d 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,32 +13,32 @@ #pragma once #include <Swiften/Base/API.h> -#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> namespace Swift { - class SWIFTEN_API WhiteboardUpdateOperation : public WhiteboardOperation { - public: - typedef boost::shared_ptr<WhiteboardUpdateOperation> ref; - public: - WhiteboardElement::ref getElement() const { - return element_; - } - - void setElement(WhiteboardElement::ref element) { - element_ = element; - } - - int getNewPos() const { - return newPos_; - } - - void setNewPos(int newPos) { - newPos_ = newPos; - } - - private: - WhiteboardElement::ref element_; - int newPos_; - }; + class SWIFTEN_API WhiteboardUpdateOperation : public WhiteboardOperation { + public: + typedef std::shared_ptr<WhiteboardUpdateOperation> ref; + public: + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + int getNewPos() const { + return newPos_; + } + + void setNewPos(int newPos) { + newPos_ = newPos; + } + + private: + WhiteboardElement::ref element_; + int newPos_ = 0; + }; } diff --git a/Swiften/Elements/WhiteboardPayload.h b/Swiften/Elements/WhiteboardPayload.h index 3fcaa33..41c0acd 100644 --- a/Swiften/Elements/WhiteboardPayload.h +++ b/Swiften/Elements/WhiteboardPayload.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,52 +20,52 @@ #include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> namespace Swift { - class SWIFTEN_API WhiteboardPayload : public Payload { - public: - typedef boost::shared_ptr<WhiteboardPayload> ref; - - public: - enum Type {UnknownType, Data, SessionRequest, SessionAccept, SessionTerminate}; - - WhiteboardPayload(Type type = WhiteboardPayload::Data) : type_(type) { - } - - void setData(const std::string &data) { - data_ = data; - } - - std::string getData() const { - return data_; - } - - Type getType() const { - return type_; - } - - void setType(Type type) { - type_ = type; - } - - WhiteboardElement::ref getElement() const { - return element_; - } - - void setElement(WhiteboardElement::ref element) { - element_ = element; - } - - WhiteboardOperation::ref getOperation() const { - return operation_; - } - - void setOperation(WhiteboardOperation::ref operation) { - operation_ = operation; - } - - private: - std::string data_; - Type type_; - WhiteboardElement::ref element_; - WhiteboardOperation::ref operation_; - }; + class SWIFTEN_API WhiteboardPayload : public Payload { + public: + typedef std::shared_ptr<WhiteboardPayload> ref; + + public: + enum Type {UnknownType, Data, SessionRequest, SessionAccept, SessionTerminate}; + + WhiteboardPayload(Type type = WhiteboardPayload::Data) : type_(type) { + } + + void setData(const std::string &data) { + data_ = data; + } + + std::string getData() const { + return data_; + } + + Type getType() const { + return type_; + } + + void setType(Type type) { + type_ = type; + } + + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + WhiteboardOperation::ref getOperation() const { + return operation_; + } + + void setOperation(WhiteboardOperation::ref operation) { + operation_ = operation; + } + + private: + std::string data_; + Type type_; + WhiteboardElement::ref element_; + WhiteboardOperation::ref operation_; + }; } |