diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Elements | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Elements')
192 files changed, 6120 insertions, 6120 deletions
diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h index 61a72ec..0c43980 100644 --- a/Swiften/Elements/AuthChallenge.h +++ b/Swiften/Elements/AuthChallenge.h @@ -14,23 +14,23 @@ #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..8f6702c 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -12,10 +12,10 @@ #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 boost::shared_ptr<AuthFailure> ref; - AuthFailure() {} - }; + AuthFailure() {} + }; } diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index 8043d1a..33b25b4 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -16,37 +16,37 @@ #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 a6ba96f..a88e8d0 100644 --- a/Swiften/Elements/AuthResponse.h +++ b/Swiften/Elements/AuthResponse.h @@ -15,26 +15,26 @@ #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 d649574..860702c 100644 --- a/Swiften/Elements/AuthSuccess.h +++ b/Swiften/Elements/AuthSuccess.h @@ -14,19 +14,19 @@ #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 94f5150..acc9df4 100644 --- a/Swiften/Elements/BlockListPayload.h +++ b/Swiften/Elements/BlockListPayload.h @@ -13,20 +13,20 @@ #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 7fae9d2..df8d150 100644 --- a/Swiften/Elements/BlockPayload.h +++ b/Swiften/Elements/BlockPayload.h @@ -13,20 +13,20 @@ #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 5d2ca30..dc6ec78 100644 --- a/Swiften/Elements/Bytestreams.h +++ b/Swiften/Elements/Bytestreams.h @@ -17,47 +17,47 @@ #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 boost::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 fc92b10..875ede4 100644 --- a/Swiften/Elements/CapsInfo.h +++ b/Swiften/Elements/CapsInfo.h @@ -14,48 +14,48 @@ #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 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_; + }; } 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..f6c9a38 100644 --- a/Swiften/Elements/CarbonsDisable.h +++ b/Swiften/Elements/CarbonsDisable.h @@ -12,11 +12,11 @@ #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 boost::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..1cb64ad 100644 --- a/Swiften/Elements/CarbonsEnable.h +++ b/Swiften/Elements/CarbonsEnable.h @@ -12,11 +12,11 @@ #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 boost::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..fdd3944 100644 --- a/Swiften/Elements/CarbonsPrivate.h +++ b/Swiften/Elements/CarbonsPrivate.h @@ -12,11 +12,11 @@ #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 boost::shared_ptr<CarbonsPrivate> ref; - public: - virtual ~CarbonsPrivate(); - }; + public: + virtual ~CarbonsPrivate(); + }; } diff --git a/Swiften/Elements/CarbonsReceived.cpp b/Swiften/Elements/CarbonsReceived.cpp index d906f8e..1c0a72b 100644 --- a/Swiften/Elements/CarbonsReceived.cpp +++ b/Swiften/Elements/CarbonsReceived.cpp @@ -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(boost::shared_ptr<Forwarded> forwarded) { + forwarded_ = forwarded; + } - boost::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { - return forwarded_; - } + boost::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { + return forwarded_; + } } diff --git a/Swiften/Elements/CarbonsReceived.h b/Swiften/Elements/CarbonsReceived.h index b057893..82ccff9 100644 --- a/Swiften/Elements/CarbonsReceived.h +++ b/Swiften/Elements/CarbonsReceived.h @@ -13,16 +13,16 @@ #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 boost::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(boost::shared_ptr<Forwarded> forwarded); + boost::shared_ptr<Forwarded> getForwarded() const; - private: - boost::shared_ptr<Forwarded> forwarded_; - }; + private: + boost::shared_ptr<Forwarded> forwarded_; + }; } diff --git a/Swiften/Elements/CarbonsSent.cpp b/Swiften/Elements/CarbonsSent.cpp index 08b2e13..c2380c6 100644 --- a/Swiften/Elements/CarbonsSent.cpp +++ b/Swiften/Elements/CarbonsSent.cpp @@ -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(boost::shared_ptr<Forwarded> forwarded) { + forwarded_ = forwarded; + } + + boost::shared_ptr<Forwarded> CarbonsSent::getForwarded() const { + return forwarded_; + } } diff --git a/Swiften/Elements/CarbonsSent.h b/Swiften/Elements/CarbonsSent.h index f6b2b53..d025a0d 100644 --- a/Swiften/Elements/CarbonsSent.h +++ b/Swiften/Elements/CarbonsSent.h @@ -13,16 +13,16 @@ #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 boost::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(boost::shared_ptr<Forwarded> forwarded); + boost::shared_ptr<Forwarded> getForwarded() const; - private: - boost::shared_ptr<Forwarded> forwarded_; - }; + private: + boost::shared_ptr<Forwarded> forwarded_; + }; } diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h index 5f0bb9b..c1ae68e 100644 --- a/Swiften/Elements/ChatState.h +++ b/Swiften/Elements/ChatState.h @@ -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 boost::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 e628c36..fff3d6b 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -15,69 +15,69 @@ #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 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_; + }; } diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index 8efd618..e8afc18 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -14,22 +14,22 @@ #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 boost::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 30e7541..7435f34 100644 --- a/Swiften/Elements/ContainerPayload.h +++ b/Swiften/Elements/ContainerPayload.h @@ -15,21 +15,21 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - template<typename T> - class SWIFTEN_API ContainerPayload : public Payload { - public: - ContainerPayload() {} - ContainerPayload(boost::shared_ptr<T> payload) : payload(payload) {} - - void setPayload(boost::shared_ptr<T> payload) { - this->payload = payload; - } - - boost::shared_ptr<T> getPayload() const { - return payload; - } - - private: - boost::shared_ptr<T> payload; - }; + template<typename T> + class SWIFTEN_API ContainerPayload : public Payload { + public: + ContainerPayload() {} + ContainerPayload(boost::shared_ptr<T> payload) : payload(payload) {} + + void setPayload(boost::shared_ptr<T> payload) { + this->payload = payload; + } + + boost::shared_ptr<T> getPayload() const { + return payload; + } + + private: + boost::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..a4936a5 100644 --- a/Swiften/Elements/DeliveryReceipt.h +++ b/Swiften/Elements/DeliveryReceipt.h @@ -20,24 +20,24 @@ namespace Swift { class SWIFTEN_API DeliveryReceipt : public Payload { - public: - typedef boost::shared_ptr<DeliveryReceipt> ref; + public: + typedef boost::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..58086df 100644 --- a/Swiften/Elements/DeliveryReceiptRequest.h +++ b/Swiften/Elements/DeliveryReceiptRequest.h @@ -18,11 +18,11 @@ namespace Swift { class SWIFTEN_API DeliveryReceiptRequest : public Payload { - public: - typedef boost::shared_ptr<DeliveryReceiptRequest> ref; + public: + typedef boost::shared_ptr<DeliveryReceiptRequest> ref; - public: - DeliveryReceiptRequest() {} + public: + DeliveryReceiptRequest() {} }; } diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index 84f5ed3..29676b5 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -26,26 +26,26 @@ const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/wh const std::string DiscoInfo::BlockingCommandFeature = std::string("urn:xmpp:blocking"); 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 01a49bd..d6ca6b8 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -14,100 +14,100 @@ #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 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_; + }; } diff --git a/Swiften/Elements/DiscoItems.h b/Swiften/Elements/DiscoItems.h index 4672444..9c06b8d 100644 --- a/Swiften/Elements/DiscoItems.h +++ b/Swiften/Elements/DiscoItems.h @@ -14,58 +14,58 @@ #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 c16a290..bf867e2 100644 --- a/Swiften/Elements/EnableStreamManagement.h +++ b/Swiften/Elements/EnableStreamManagement.h @@ -10,8 +10,8 @@ #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 d2556f9..800ff22 100644 --- a/Swiften/Elements/ErrorPayload.h +++ b/Swiften/Elements/ErrorPayload.h @@ -14,75 +14,75 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp index d6de8ff..f8414b2 100644 --- a/Swiften/Elements/Form.cpp +++ b/Swiften/Elements/Form.cpp @@ -11,56 +11,56 @@ 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(); + foreach(FormField::ref 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; + 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; } } diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index 31faf25..ebdb161 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -17,107 +17,107 @@ #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 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_; + }; } diff --git a/Swiften/Elements/FormField.cpp b/Swiften/Elements/FormField.cpp index f8ebbca..d4bc9f4 100644 --- a/Swiften/Elements/FormField.cpp +++ b/Swiften/Elements/FormField.cpp @@ -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 d84dbb6..e62dec4 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -15,126 +15,126 @@ #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 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; + }; } diff --git a/Swiften/Elements/FormPage.cpp b/Swiften/Elements/FormPage.cpp index db7979f..a4e1616 100644 --- a/Swiften/Elements/FormPage.cpp +++ b/Swiften/Elements/FormPage.cpp @@ -14,51 +14,51 @@ FormPage::~FormPage() { } void FormPage::setLabel(const std::string& label) { - label_ = label; + label_ = label; } const std::string& FormPage::getLabel() const { - return label_; + return label_; } void FormPage::addChildSection(boost::shared_ptr<FormSection> section) { - childSections_.push_back(section); + childSections_.push_back(section); } const std::vector<boost::shared_ptr<FormSection> >& FormPage::getChildSections() const { - return childSections_; + return childSections_; } void FormPage::addTextElement(boost::shared_ptr<FormText> textElement) { - textElements_.push_back(textElement); + textElements_.push_back(textElement); } const std::vector<boost::shared_ptr<FormText> >& FormPage::getTextElements() const { - return textElements_; + return textElements_; } void FormPage::addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { - reportedRefs_.push_back(reportedRef); + reportedRefs_.push_back(reportedRef); } const std::vector<boost::shared_ptr<FormReportedRef> >& FormPage::getReportedRefs() const { - return reportedRefs_; + return reportedRefs_; } void FormPage::addField(boost::shared_ptr<FormField> field) { - fields_.push_back(field); + fields_.push_back(field); } const std::vector<boost::shared_ptr<FormField> >& FormPage::getFields() const { - return fields_; + 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 35bf63b..f7a4a9a 100644 --- a/Swiften/Elements/FormPage.h +++ b/Swiften/Elements/FormPage.h @@ -18,30 +18,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; - 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 boost::shared_ptr<FormPage> page; + FormPage (); + ~FormPage(); + void setLabel(const std::string& label); + const std::string& getLabel() 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; - private: - 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<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_; + }; } diff --git a/Swiften/Elements/FormReportedRef.h b/Swiften/Elements/FormReportedRef.h index 03a89d1..a972f10 100644 --- a/Swiften/Elements/FormReportedRef.h +++ b/Swiften/Elements/FormReportedRef.h @@ -11,9 +11,9 @@ namespace Swift { - class SWIFTEN_API FormReportedRef { + class SWIFTEN_API FormReportedRef { - public: - typedef boost::shared_ptr<FormReportedRef> ref; - }; + public: + typedef boost::shared_ptr<FormReportedRef> ref; + }; } diff --git a/Swiften/Elements/FormSection.cpp b/Swiften/Elements/FormSection.cpp index 7b254df..2fe1954 100644 --- a/Swiften/Elements/FormSection.cpp +++ b/Swiften/Elements/FormSection.cpp @@ -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); + textElements_.push_back(textElement); } const std::vector<boost::shared_ptr<FormText> >& FormSection::getTextElements() const { - return textElements_; + return textElements_; } void FormSection::addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { - reportedRefs_.push_back(reportedRef); + reportedRefs_.push_back(reportedRef); } const std::vector<boost::shared_ptr<FormReportedRef> >& FormSection::getReportedRefs() const { - return reportedRefs_; + return reportedRefs_; } void FormSection::addChildSection(boost::shared_ptr<FormSection> childSection) { - childSections_.push_back(childSection); + childSections_.push_back(childSection); } const std::vector<boost::shared_ptr<FormSection> >& FormSection::getChildSections() const { - return childSections_; + return childSections_; } void FormSection::addField(boost::shared_ptr<FormField> field) { - fields_.push_back(field); + fields_.push_back(field); } const std::vector<boost::shared_ptr<FormField> >& FormSection::getFields() const { - return fields_; + 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 523d507..69638c4 100644 --- a/Swiften/Elements/FormSection.h +++ b/Swiften/Elements/FormSection.h @@ -17,30 +17,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 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; - 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<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_; + }; } 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 5df1a25..1d95a3a 100644 --- a/Swiften/Elements/FormText.h +++ b/Swiften/Elements/FormText.h @@ -13,16 +13,16 @@ 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 boost::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 b39f5a5..8401fe1 100644 --- a/Swiften/Elements/Forwarded.h +++ b/Swiften/Elements/Forwarded.h @@ -13,21 +13,21 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class Delay; - class Stanza; + class Delay; + class Stanza; - class SWIFTEN_API Forwarded : public Payload { - public: - virtual ~Forwarded(); + class SWIFTEN_API Forwarded : public Payload { + public: + virtual ~Forwarded(); - void setDelay(boost::shared_ptr<Delay> delay) { delay_ = delay; } - const boost::shared_ptr<Delay>& getDelay() const { return delay_; } + void setDelay(boost::shared_ptr<Delay> delay) { delay_ = delay; } + const boost::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(boost::shared_ptr<Stanza> stanza) { stanza_ = stanza; } + const boost::shared_ptr<Stanza>& getStanza() const { return stanza_; } - private: - boost::shared_ptr<Delay> delay_; - boost::shared_ptr<Stanza> stanza_; - }; + private: + boost::shared_ptr<Delay> delay_; + boost::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 a06e3bc..97a46bb 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -16,94 +16,94 @@ #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 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; + }; } diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index 343a205..cd1498e 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -11,58 +11,58 @@ 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; + 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; } 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; + boost::shared_ptr<IQ> iq = boost::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; + 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; } 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; + 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; } 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; + 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; } } diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index b77dd03..275c00e 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -13,46 +13,46 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Idle.h b/Swiften/Elements/Idle.h index ec170fb..07ecc74 100644 --- a/Swiften/Elements/Idle.h +++ b/Swiften/Elements/Idle.h @@ -20,25 +20,25 @@ namespace Swift { - class SWIFTEN_API Idle : public Payload { - public: - typedef boost::shared_ptr<Idle> ref; - - public: - Idle() {} - Idle(boost::posix_time::ptime since) : since_(since) { - } - - void setSince(boost::posix_time::ptime since) { - since_ = since; - } - - boost::posix_time::ptime getSince() const { - return since_; - } - - private: - boost::posix_time::ptime since_; - }; + class SWIFTEN_API Idle : public Payload { + public: + typedef boost::shared_ptr<Idle> ref; + + public: + Idle() {} + Idle(boost::posix_time::ptime since) : since_(since) { + } + + void setSince(boost::posix_time::ptime since) { + since_ = since; + } + + boost::posix_time::ptime getSince() const { + return since_; + } + + private: + boost::posix_time::ptime since_; + }; } diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h index ef40c8f..a282df8 100644 --- a/Swiften/Elements/InBandRegistrationPayload.h +++ b/Swiften/Elements/InBandRegistrationPayload.h @@ -16,196 +16,196 @@ #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 boost::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 7bd618c..12fd9bd 100644 --- a/Swiften/Elements/IsodeIQDelegation.h +++ b/Swiften/Elements/IsodeIQDelegation.h @@ -14,23 +14,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API IsodeIQDelegation : public Payload { - public: - - IsodeIQDelegation(); - - virtual ~IsodeIQDelegation(); + class SWIFTEN_API IsodeIQDelegation : public Payload { + public: - boost::shared_ptr<Forwarded> getForward() const { - return forward; - } + IsodeIQDelegation(); - void setForward(boost::shared_ptr<Forwarded> value) { - this->forward = value ; - } + virtual ~IsodeIQDelegation(); + boost::shared_ptr<Forwarded> getForward() const { + return forward; + } - private: - boost::shared_ptr<Forwarded> forward; - }; + void setForward(boost::shared_ptr<Forwarded> value) { + this->forward = value ; + } + + + private: + boost::shared_ptr<Forwarded> forward; + }; } diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h index 5ec2e33..46751fd 100644 --- a/Swiften/Elements/JingleContentPayload.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -18,85 +18,85 @@ #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 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; + }; } diff --git a/Swiften/Elements/JingleDescription.h b/Swiften/Elements/JingleDescription.h index 7577383..b52291e 100644 --- a/Swiften/Elements/JingleDescription.h +++ b/Swiften/Elements/JingleDescription.h @@ -12,8 +12,8 @@ #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 boost::shared_ptr<JingleDescription> ref; + }; } diff --git a/Swiften/Elements/JingleFileTransferDescription.h b/Swiften/Elements/JingleFileTransferDescription.h index e37f2c6..4389bb2 100644 --- a/Swiften/Elements/JingleFileTransferDescription.h +++ b/Swiften/Elements/JingleFileTransferDescription.h @@ -15,19 +15,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 boost::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 40640c8..cc592c4 100644 --- a/Swiften/Elements/JingleFileTransferFileInfo.h +++ b/Swiften/Elements/JingleFileTransferFileInfo.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 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_; + }; } diff --git a/Swiften/Elements/JingleFileTransferHash.h b/Swiften/Elements/JingleFileTransferHash.h index 7c56fe8..42fc23c 100644 --- a/Swiften/Elements/JingleFileTransferHash.h +++ b/Swiften/Elements/JingleFileTransferHash.h @@ -25,18 +25,18 @@ namespace Swift { class SWIFTEN_API JingleFileTransferHash : public Payload { public: - typedef boost::shared_ptr<JingleFileTransferHash> ref; + typedef boost::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 efadf0b..6626f51 100644 --- a/Swiften/Elements/JingleIBBTransportPayload.h +++ b/Swiften/Elements/JingleIBBTransportPayload.h @@ -15,36 +15,36 @@ #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 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; + }; } diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 359e3ca..a862c41 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -18,150 +18,150 @@ #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 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; + }; } diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h index 4b0e7d4..bb542f0 100644 --- a/Swiften/Elements/JingleS5BTransportPayload.h +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -16,106 +16,106 @@ #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 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; + }; } diff --git a/Swiften/Elements/JingleTransportPayload.h b/Swiften/Elements/JingleTransportPayload.h index 70f3d25..12a08cd 100644 --- a/Swiften/Elements/JingleTransportPayload.h +++ b/Swiften/Elements/JingleTransportPayload.h @@ -12,20 +12,20 @@ #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 boost::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 96e410e..dd1f7bf 100644 --- a/Swiften/Elements/MAMFin.h +++ b/Swiften/Elements/MAMFin.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(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_; + }; } diff --git a/Swiften/Elements/MAMQuery.h b/Swiften/Elements/MAMQuery.h index 2a795dc..253fa0c 100644 --- a/Swiften/Elements/MAMQuery.h +++ b/Swiften/Elements/MAMQuery.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(boost::shared_ptr<Form> form) { form_ = form; } + const boost::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(boost::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } + const boost::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_; + boost::shared_ptr<Form> form_; + boost::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 f16111d..c9b01d9 100644 --- a/Swiften/Elements/MUCAdminPayload.h +++ b/Swiften/Elements/MUCAdminPayload.h @@ -19,19 +19,19 @@ #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 boost::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..80eb83e 100644 --- a/Swiften/Elements/MUCDestroyPayload.h +++ b/Swiften/Elements/MUCDestroyPayload.h @@ -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 boost::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..508a8ec 100644 --- a/Swiften/Elements/MUCInvitationPayload.h +++ b/Swiften/Elements/MUCInvitationPayload.h @@ -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 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_; + }; } diff --git a/Swiften/Elements/MUCItem.h b/Swiften/Elements/MUCItem.h index 40f4572..9ea6d77 100644 --- a/Swiften/Elements/MUCItem.h +++ b/Swiften/Elements/MUCItem.h @@ -10,12 +10,12 @@ #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() {} + 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..edd6eb6 100644 --- a/Swiften/Elements/MUCOccupant.cpp +++ b/Swiften/Elements/MUCOccupant.cpp @@ -19,28 +19,28 @@ MUCOccupant::MUCOccupant(const MUCOccupant& other) : nick_(other.getNick()), rol } 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 0eb9169..eb7df2c 100644 --- a/Swiften/Elements/MUCOccupant.h +++ b/Swiften/Elements/MUCOccupant.h @@ -14,30 +14,30 @@ #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(); + + 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 890b031..f75f677 100644 --- a/Swiften/Elements/MUCOwnerPayload.h +++ b/Swiften/Elements/MUCOwnerPayload.h @@ -13,26 +13,26 @@ #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 boost::shared_ptr<MUCOwnerPayload> ref; - MUCOwnerPayload() { - } + MUCOwnerPayload() { + } - boost::shared_ptr<Payload> getPayload() const { - return payload; - } + boost::shared_ptr<Payload> getPayload() const { + return payload; + } - void setPayload(boost::shared_ptr<Payload> p) { - payload = p; - } + void setPayload(boost::shared_ptr<Payload> p) { + payload = p; + } - Form::ref getForm() { - return boost::dynamic_pointer_cast<Form>(payload); - } + Form::ref getForm() { + return boost::dynamic_pointer_cast<Form>(payload); + } - private: - boost::shared_ptr<Payload> payload; - }; + private: + boost::shared_ptr<Payload> payload; + }; } diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h index af70f48..8588ca2 100644 --- a/Swiften/Elements/MUCPayload.h +++ b/Swiften/Elements/MUCPayload.h @@ -16,61 +16,61 @@ #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 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_; + }; } diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h index 6d2de30..e83c2d0 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -19,79 +19,79 @@ #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 boost::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 addStatusCode(StatusCode code) {statusCodes_.push_back(code);} + void addItem(const MUCItem& item) {items_.push_back(item);} - const std::vector<MUCItem>& getItems() const {return items_;} + void addStatusCode(StatusCode code) {statusCodes_.push_back(code);} - const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} + const std::vector<MUCItem>& getItems() const {return items_;} - boost::shared_ptr<Payload> getPayload() const { - return payload_; - } + const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} - void setPayload(boost::shared_ptr<Payload> p) { - payload_ = p; - } + boost::shared_ptr<Payload> getPayload() const { + return payload_; + } - const boost::optional<std::string>& getPassword() const { - return password_; - } + void setPayload(boost::shared_ptr<Payload> p) { + payload_ = p; + } - void setPassword(const std::string& password) { - password_ = password; - } + const boost::optional<std::string>& getPassword() const { + return password_; + } + void setPassword(const std::string& password) { + password_ = password; + } - const boost::optional<Invite>& getInvite() const { - return invite_; - } - void setInvite(const Invite& invite) { - invite_ = invite; - } + const boost::optional<Invite>& getInvite() const { + return 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_; + boost::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..c55e04b 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -20,63 +20,63 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Nickname.h b/Swiften/Elements/Nickname.h index 7a9e7b5..123c156 100644 --- a/Swiften/Elements/Nickname.h +++ b/Swiften/Elements/Nickname.h @@ -12,20 +12,20 @@ #include <Swiften/Elements/Payload.h> 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..e31afa9 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -12,14 +12,14 @@ #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 boost::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..344efc1 100644 --- a/Swiften/Elements/Presence.cpp +++ b/Swiften/Elements/Presence.cpp @@ -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); + boost::shared_ptr<Priority> priority(getPayload<Priority>()); + return (priority ? priority->getPriority() : 0); } void Presence::setPriority(int priority) { - updatePayload(boost::make_shared<Priority>(priority)); + updatePayload(boost::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 { + boost::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(boost::make_shared<Status>(status)); } } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 6327761..0b6ee5f 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -13,59 +13,59 @@ #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 boost::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 boost::make_shared<Presence>(); + } - static ref create(const std::string& status) { - return boost::make_shared<Presence>(status); - } + static ref create(const std::string& status) { + return boost::make_shared<Presence>(status); + } - static ref create(Presence::ref presence) { - return boost::make_shared<Presence>(*presence); - } + static ref create(Presence::ref presence) { + return boost::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 { + boost::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(boost::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); - } + boost::shared_ptr<Presence> clone() const { + return boost::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..e1f97d5 100644 --- a/Swiften/Elements/PrivateStorage.h +++ b/Swiften/Elements/PrivateStorage.h @@ -12,20 +12,20 @@ #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(boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()) : payload(payload) { + } - boost::shared_ptr<Payload> getPayload() const { - return payload; - } + boost::shared_ptr<Payload> getPayload() const { + return payload; + } - void setPayload(boost::shared_ptr<Payload> p) { - payload = p; - } + void setPayload(boost::shared_ptr<Payload> p) { + payload = p; + } - private: - boost::shared_ptr<Payload> payload; - }; + private: + boost::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 fb75c80..d62c54e 100644 --- a/Swiften/Elements/PubSub.h +++ b/Swiften/Elements/PubSub.h @@ -12,9 +12,9 @@ #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 61198ff..b19e84b 100644 --- a/Swiften/Elements/PubSubAffiliation.h +++ b/Swiften/Elements/PubSubAffiliation.h @@ -13,40 +13,40 @@ #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 e8f0382..9f66056 100644 --- a/Swiften/Elements/PubSubAffiliations.h +++ b/Swiften/Elements/PubSubAffiliations.h @@ -19,36 +19,36 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubConfigure.h b/Swiften/Elements/PubSubConfigure.h index 4cd219c..e8f3cbc 100644 --- a/Swiften/Elements/PubSubConfigure.h +++ b/Swiften/Elements/PubSubConfigure.h @@ -14,23 +14,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubConfigure : public Payload { - public: - - PubSubConfigure(); - - virtual ~PubSubConfigure(); + class SWIFTEN_API PubSubConfigure : public Payload { + public: - boost::shared_ptr<Form> getData() const { - return data; - } + PubSubConfigure(); - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } + virtual ~PubSubConfigure(); + boost::shared_ptr<Form> getData() const { + return data; + } - private: - boost::shared_ptr<Form> data; - }; + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubCreate.h b/Swiften/Elements/PubSubCreate.h index f535a89..b2226c4 100644 --- a/Swiften/Elements/PubSubCreate.h +++ b/Swiften/Elements/PubSubCreate.h @@ -17,32 +17,32 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubDefault.h b/Swiften/Elements/PubSubDefault.h index f4e7595..08482b4 100644 --- a/Swiften/Elements/PubSubDefault.h +++ b/Swiften/Elements/PubSubDefault.h @@ -16,37 +16,37 @@ #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 2029945..85d9bed 100644 --- a/Swiften/Elements/PubSubEvent.h +++ b/Swiften/Elements/PubSubEvent.h @@ -15,9 +15,9 @@ #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 73cd3b9..5d963a0 100644 --- a/Swiften/Elements/PubSubEventAssociate.h +++ b/Swiften/Elements/PubSubEventAssociate.h @@ -13,23 +13,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventAssociate : public Payload { - public: - - PubSubEventAssociate(); - - virtual ~PubSubEventAssociate(); + class SWIFTEN_API PubSubEventAssociate : public Payload { + public: - const std::string& getNode() const { - return node; - } + PubSubEventAssociate(); - void setNode(const std::string& value) { - this->node = value ; - } + virtual ~PubSubEventAssociate(); + const std::string& getNode() const { + return node; + } - private: - std::string node; - }; + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventCollection.h b/Swiften/Elements/PubSubEventCollection.h index 5910c9f..390fa58 100644 --- a/Swiften/Elements/PubSubEventCollection.h +++ b/Swiften/Elements/PubSubEventCollection.h @@ -19,41 +19,41 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubEventConfiguration.h b/Swiften/Elements/PubSubEventConfiguration.h index da42fcb..14639ab 100644 --- a/Swiften/Elements/PubSubEventConfiguration.h +++ b/Swiften/Elements/PubSubEventConfiguration.h @@ -17,32 +17,32 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubEventDelete.h b/Swiften/Elements/PubSubEventDelete.h index 1a2c74f..a778276 100644 --- a/Swiften/Elements/PubSubEventDelete.h +++ b/Swiften/Elements/PubSubEventDelete.h @@ -17,32 +17,32 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubEventDisassociate.h b/Swiften/Elements/PubSubEventDisassociate.h index d4c3452..826b1f4 100644 --- a/Swiften/Elements/PubSubEventDisassociate.h +++ b/Swiften/Elements/PubSubEventDisassociate.h @@ -13,23 +13,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventDisassociate : public Payload { - public: - - PubSubEventDisassociate(); - - virtual ~PubSubEventDisassociate(); + class SWIFTEN_API PubSubEventDisassociate : public Payload { + public: - const std::string& getNode() const { - return node; - } + PubSubEventDisassociate(); - void setNode(const std::string& value) { - this->node = value ; - } + virtual ~PubSubEventDisassociate(); + const std::string& getNode() const { + return node; + } - private: - std::string node; - }; + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventItem.h b/Swiften/Elements/PubSubEventItem.h index 3b4f930..bbadab9 100644 --- a/Swiften/Elements/PubSubEventItem.h +++ b/Swiften/Elements/PubSubEventItem.h @@ -17,54 +17,54 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubEventItems.h b/Swiften/Elements/PubSubEventItems.h index c3be21a..9d1e09b 100644 --- a/Swiften/Elements/PubSubEventItems.h +++ b/Swiften/Elements/PubSubEventItems.h @@ -19,49 +19,49 @@ #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< 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; + }; } 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 a19a8a2..743cc25 100644 --- a/Swiften/Elements/PubSubEventPurge.h +++ b/Swiften/Elements/PubSubEventPurge.h @@ -14,23 +14,23 @@ #include <Swiften/Elements/PubSubEventPayload.h> namespace Swift { - class SWIFTEN_API PubSubEventPurge : public PubSubEventPayload { - public: - - PubSubEventPurge(); - - virtual ~PubSubEventPurge(); + class SWIFTEN_API PubSubEventPurge : public PubSubEventPayload { + public: - const std::string& getNode() const { - return node; - } + PubSubEventPurge(); - void setNode(const std::string& value) { - this->node = value ; - } + virtual ~PubSubEventPurge(); + const std::string& getNode() const { + return node; + } - private: - std::string node; - }; + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubEventRedirect.h b/Swiften/Elements/PubSubEventRedirect.h index 13dc865..e0e351f 100644 --- a/Swiften/Elements/PubSubEventRedirect.h +++ b/Swiften/Elements/PubSubEventRedirect.h @@ -13,23 +13,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventRedirect : public Payload { - public: - - PubSubEventRedirect(); - - virtual ~PubSubEventRedirect(); + class SWIFTEN_API PubSubEventRedirect : public Payload { + public: - const std::string& getURI() const { - return uri; - } + PubSubEventRedirect(); - void setURI(const std::string& value) { - this->uri = value ; - } + virtual ~PubSubEventRedirect(); + const std::string& getURI() const { + return uri; + } - private: - std::string uri; - }; + void setURI(const std::string& value) { + this->uri = value ; + } + + + private: + std::string uri; + }; } diff --git a/Swiften/Elements/PubSubEventRetract.h b/Swiften/Elements/PubSubEventRetract.h index 6681061..b0aea96 100644 --- a/Swiften/Elements/PubSubEventRetract.h +++ b/Swiften/Elements/PubSubEventRetract.h @@ -13,23 +13,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubEventRetract : public Payload { - public: - - PubSubEventRetract(); - - virtual ~PubSubEventRetract(); + class SWIFTEN_API PubSubEventRetract : public Payload { + public: - const std::string& getID() const { - return id; - } + PubSubEventRetract(); - void setID(const std::string& value) { - this->id = value ; - } + virtual ~PubSubEventRetract(); + const std::string& getID() const { + return id; + } - private: - std::string id; - }; + void setID(const std::string& value) { + this->id = value ; + } + + + private: + std::string id; + }; } diff --git a/Swiften/Elements/PubSubEventSubscription.h b/Swiften/Elements/PubSubEventSubscription.h index 6416d21..0b8297c 100644 --- a/Swiften/Elements/PubSubEventSubscription.h +++ b/Swiften/Elements/PubSubEventSubscription.h @@ -18,65 +18,65 @@ #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 63b374b..5a16edc 100644 --- a/Swiften/Elements/PubSubItem.h +++ b/Swiften/Elements/PubSubItem.h @@ -16,36 +16,36 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubItems.h b/Swiften/Elements/PubSubItems.h index 7665ca4..b7d8fcc 100644 --- a/Swiften/Elements/PubSubItems.h +++ b/Swiften/Elements/PubSubItems.h @@ -19,54 +19,54 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubOptions.h b/Swiften/Elements/PubSubOptions.h index 9a953fe..fffc175 100644 --- a/Swiften/Elements/PubSubOptions.h +++ b/Swiften/Elements/PubSubOptions.h @@ -19,50 +19,50 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubOwnerAffiliation.h b/Swiften/Elements/PubSubOwnerAffiliation.h index d064873..a8c1d91 100644 --- a/Swiften/Elements/PubSubOwnerAffiliation.h +++ b/Swiften/Elements/PubSubOwnerAffiliation.h @@ -12,40 +12,40 @@ #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 23739a7..5005b01 100644 --- a/Swiften/Elements/PubSubOwnerAffiliations.h +++ b/Swiften/Elements/PubSubOwnerAffiliations.h @@ -18,36 +18,36 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubOwnerConfigure.h b/Swiften/Elements/PubSubOwnerConfigure.h index d29342d..086095c 100644 --- a/Swiften/Elements/PubSubOwnerConfigure.h +++ b/Swiften/Elements/PubSubOwnerConfigure.h @@ -18,32 +18,32 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubOwnerDefault.h b/Swiften/Elements/PubSubOwnerDefault.h index 17717db..a0b82f7 100644 --- a/Swiften/Elements/PubSubOwnerDefault.h +++ b/Swiften/Elements/PubSubOwnerDefault.h @@ -15,23 +15,23 @@ #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerDefault : public PubSubOwnerPayload { - public: - - PubSubOwnerDefault(); - - virtual ~PubSubOwnerDefault(); + class SWIFTEN_API PubSubOwnerDefault : public PubSubOwnerPayload { + public: - boost::shared_ptr<Form> getData() const { - return data; - } + PubSubOwnerDefault(); - void setData(boost::shared_ptr<Form> value) { - this->data = value ; - } + virtual ~PubSubOwnerDefault(); + boost::shared_ptr<Form> getData() const { + return data; + } - private: - boost::shared_ptr<Form> data; - }; + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::shared_ptr<Form> data; + }; } diff --git a/Swiften/Elements/PubSubOwnerDelete.h b/Swiften/Elements/PubSubOwnerDelete.h index b4f60a2..7f908a1 100644 --- a/Swiften/Elements/PubSubOwnerDelete.h +++ b/Swiften/Elements/PubSubOwnerDelete.h @@ -17,32 +17,32 @@ #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 ; + } + + 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; + }; } 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 50a4370..f3474cf 100644 --- a/Swiften/Elements/PubSubOwnerPubSub.h +++ b/Swiften/Elements/PubSubOwnerPubSub.h @@ -12,9 +12,9 @@ #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 2b1b64f..aca48e1 100644 --- a/Swiften/Elements/PubSubOwnerPurge.h +++ b/Swiften/Elements/PubSubOwnerPurge.h @@ -14,23 +14,23 @@ #include <Swiften/Elements/PubSubOwnerPayload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerPurge : public PubSubOwnerPayload { - public: - - PubSubOwnerPurge(); - - virtual ~PubSubOwnerPurge(); + class SWIFTEN_API PubSubOwnerPurge : public PubSubOwnerPayload { + public: - const std::string& getNode() const { - return node; - } + PubSubOwnerPurge(); - void setNode(const std::string& value) { - this->node = value ; - } + virtual ~PubSubOwnerPurge(); + const std::string& getNode() const { + return node; + } - private: - std::string node; - }; + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; } diff --git a/Swiften/Elements/PubSubOwnerRedirect.h b/Swiften/Elements/PubSubOwnerRedirect.h index 7659889..c481f98 100644 --- a/Swiften/Elements/PubSubOwnerRedirect.h +++ b/Swiften/Elements/PubSubOwnerRedirect.h @@ -13,23 +13,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubOwnerRedirect : public Payload { - public: - - PubSubOwnerRedirect(); - - virtual ~PubSubOwnerRedirect(); + class SWIFTEN_API PubSubOwnerRedirect : public Payload { + public: - const std::string& getURI() const { - return uri; - } + PubSubOwnerRedirect(); - void setURI(const std::string& value) { - this->uri = value ; - } + virtual ~PubSubOwnerRedirect(); + const std::string& getURI() const { + return uri; + } - private: - std::string uri; - }; + void setURI(const std::string& value) { + this->uri = value ; + } + + + private: + std::string uri; + }; } diff --git a/Swiften/Elements/PubSubOwnerSubscription.h b/Swiften/Elements/PubSubOwnerSubscription.h index 2b8964d..6a3fcc1 100644 --- a/Swiften/Elements/PubSubOwnerSubscription.h +++ b/Swiften/Elements/PubSubOwnerSubscription.h @@ -12,38 +12,38 @@ #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 caa5da8..44c31b8 100644 --- a/Swiften/Elements/PubSubOwnerSubscriptions.h +++ b/Swiften/Elements/PubSubOwnerSubscriptions.h @@ -18,36 +18,36 @@ #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< 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; + }; } 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 11a3ab2..a6fca8d 100644 --- a/Swiften/Elements/PubSubPublish.h +++ b/Swiften/Elements/PubSubPublish.h @@ -18,36 +18,36 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubRetract.h b/Swiften/Elements/PubSubRetract.h index 3863bef..60ceb28 100644 --- a/Swiften/Elements/PubSubRetract.h +++ b/Swiften/Elements/PubSubRetract.h @@ -18,45 +18,45 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubSubscribe.h b/Swiften/Elements/PubSubSubscribe.h index fe4ecd3..8c57a21 100644 --- a/Swiften/Elements/PubSubSubscribe.h +++ b/Swiften/Elements/PubSubSubscribe.h @@ -19,41 +19,41 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubSubscribeOptions.h b/Swiften/Elements/PubSubSubscribeOptions.h index 4b168c7..c837787 100644 --- a/Swiften/Elements/PubSubSubscribeOptions.h +++ b/Swiften/Elements/PubSubSubscribeOptions.h @@ -11,23 +11,23 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API PubSubSubscribeOptions : public Payload { - public: - - PubSubSubscribeOptions(); - - virtual ~PubSubSubscribeOptions(); + class SWIFTEN_API PubSubSubscribeOptions : public Payload { + public: - bool isRequired() const { - return required; - } + PubSubSubscribeOptions(); - void setRequired(bool value) { - this->required = value ; - } + virtual ~PubSubSubscribeOptions(); + bool isRequired() const { + return required; + } - private: - bool required; - }; + void setRequired(bool value) { + this->required = value ; + } + + + private: + bool required; + }; } diff --git a/Swiften/Elements/PubSubSubscription.h b/Swiften/Elements/PubSubSubscription.h index bd27a83..5bb1194 100644 --- a/Swiften/Elements/PubSubSubscription.h +++ b/Swiften/Elements/PubSubSubscription.h @@ -19,65 +19,65 @@ #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 ; + } + + 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; + }; } diff --git a/Swiften/Elements/PubSubSubscriptions.h b/Swiften/Elements/PubSubSubscriptions.h index ae08471..63fc402 100644 --- a/Swiften/Elements/PubSubSubscriptions.h +++ b/Swiften/Elements/PubSubSubscriptions.h @@ -19,36 +19,36 @@ #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< 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; + }; } diff --git a/Swiften/Elements/PubSubUnsubscribe.h b/Swiften/Elements/PubSubUnsubscribe.h index 4ea44b0..305af9a 100644 --- a/Swiften/Elements/PubSubUnsubscribe.h +++ b/Swiften/Elements/PubSubUnsubscribe.h @@ -17,41 +17,41 @@ #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 1152040..b64777f 100644 --- a/Swiften/Elements/Replace.h +++ b/Swiften/Elements/Replace.h @@ -20,17 +20,17 @@ #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 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_; + }; } 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 dc3692f..44995d1 100644 --- a/Swiften/Elements/ResultSet.h +++ b/Swiften/Elements/ResultSet.h @@ -12,43 +12,43 @@ #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.h b/Swiften/Elements/RosterItemExchangePayload.h index b1d9fe2..5090aff 100644 --- a/Swiften/Elements/RosterItemExchangePayload.h +++ b/Swiften/Elements/RosterItemExchangePayload.h @@ -22,73 +22,73 @@ #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 boost::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 6fb6ebe..ea19fa5 100644 --- a/Swiften/Elements/RosterItemPayload.h +++ b/Swiften/Elements/RosterItemPayload.h @@ -13,40 +13,40 @@ #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 d9bdc9a..b4be7d1 100644 --- a/Swiften/Elements/RosterPayload.cpp +++ b/Swiften/Elements/RosterPayload.cpp @@ -11,14 +11,14 @@ 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>(); + 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>(); } } diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h index e205ce9..35e81cd 100644 --- a/Swiften/Elements/RosterPayload.h +++ b/Swiften/Elements/RosterPayload.h @@ -16,34 +16,34 @@ #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 boost::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..cbc7d5b 100644 --- a/Swiften/Elements/S5BProxyRequest.h +++ b/Swiften/Elements/S5BProxyRequest.h @@ -25,45 +25,45 @@ namespace Swift { class SWIFTEN_API S5BProxyRequest : public Payload { public: - typedef boost::shared_ptr<S5BProxyRequest> ref; + typedef boost::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 2ca6888..6784291 100644 --- a/Swiften/Elements/SearchPayload.h +++ b/Swiften/Elements/SearchPayload.h @@ -16,81 +16,81 @@ #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 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; + }; } diff --git a/Swiften/Elements/SecurityLabel.h b/Swiften/Elements/SecurityLabel.h index b018620..748c65e 100644 --- a/Swiften/Elements/SecurityLabel.h +++ b/Swiften/Elements/SecurityLabel.h @@ -14,63 +14,63 @@ #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 cdcfca3..8e6db64 100644 --- a/Swiften/Elements/SecurityLabelsCatalog.h +++ b/Swiften/Elements/SecurityLabelsCatalog.h @@ -17,74 +17,74 @@ #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 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_; + }; } diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h index f906223..57318b9 100644 --- a/Swiften/Elements/SoftwareVersion.h +++ b/Swiften/Elements/SoftwareVersion.h @@ -14,43 +14,43 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp index f385e1c..617be4e 100644 --- a/Swiften/Elements/Stanza.cpp +++ b/Swiften/Elements/Stanza.cpp @@ -17,53 +17,53 @@ 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); + foreach (boost::shared_ptr<Payload>& 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()); + 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()); + 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>(); + foreach (const boost::shared_ptr<Payload>& i, payloads_) { + if (typeid(*i.get()) == typeid(*payload.get())) { + return i; + } + } + return boost::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>(); + boost::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< 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(); } diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index 8da6280..765aca8 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -18,79 +18,79 @@ #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 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_; + }; } 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..45680c0 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -12,26 +12,26 @@ #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 boost::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 ea934da..a40865e 100644 --- a/Swiften/Elements/StartSession.h +++ b/Swiften/Elements/StartSession.h @@ -12,8 +12,8 @@ #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 58e17d6..2fd2eff 100644 --- a/Swiften/Elements/Status.h +++ b/Swiften/Elements/Status.h @@ -12,20 +12,20 @@ #include <Swiften/Elements/Payload.h> 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 84be286..b339fa1 100644 --- a/Swiften/Elements/StatusShow.h +++ b/Swiften/Elements/StatusShow.h @@ -12,38 +12,38 @@ #include <Swiften/Elements/Payload.h> 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 7de303d..87cfb39 100644 --- a/Swiften/Elements/Storage.h +++ b/Swiften/Elements/Storage.h @@ -17,51 +17,51 @@ #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 e7e7309..ce57134 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -14,58 +14,58 @@ #include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamError : public ToplevelElement { - public: - typedef boost::shared_ptr<StreamError> ref; + class SWIFTEN_API StreamError : public ToplevelElement { + public: + typedef boost::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 7a9d936..1d07a16 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -16,92 +16,92 @@ #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 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_; + }; } diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h index b56fadc..cd37974 100644 --- a/Swiften/Elements/StreamInitiation.h +++ b/Swiften/Elements/StreamInitiation.h @@ -17,57 +17,57 @@ #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 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; + }; } diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index 9c40d60..11bd4c5 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -18,87 +18,87 @@ namespace Swift { class SWIFTEN_API StreamInitiationFileInfo : public Payload { public: - typedef boost::shared_ptr<StreamInitiationFileInfo> ref; - + typedef boost::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 6876ead..0ded077 100644 --- a/Swiften/Elements/StreamResume.h +++ b/Swiften/Elements/StreamResume.h @@ -14,29 +14,29 @@ #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 88779cc..e1c80d9 100644 --- a/Swiften/Elements/StreamResumed.h +++ b/Swiften/Elements/StreamResumed.h @@ -14,29 +14,29 @@ #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 982ce3b..4f9444a 100644 --- a/Swiften/Elements/Subject.h +++ b/Swiften/Elements/Subject.h @@ -12,20 +12,20 @@ #include <Swiften/Elements/Payload.h> 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 ddb42d8..7d6574d 100644 --- a/Swiften/Elements/UnblockPayload.h +++ b/Swiften/Elements/UnblockPayload.h @@ -13,20 +13,20 @@ #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 ea680f9..9255fa8 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -15,44 +15,44 @@ 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(boost::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 = boost::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(boost::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 = boost::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(boost::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 7cc78c6..a88e2d6 100644 --- a/Swiften/Elements/UnitTest/IQTest.cpp +++ b/Swiften/Elements/UnitTest/IQTest.cpp @@ -16,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() { + 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()); + } }; diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp index de5779c..13c038c 100644 --- a/Swiften/Elements/UnitTest/StanzaTest.cpp +++ b/Swiften/Elements/UnitTest/StanzaTest.cpp @@ -19,214 +19,214 @@ 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(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_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 1a9dba3..7d07d6a 100644 --- a/Swiften/Elements/UserLocation.h +++ b/Swiften/Elements/UserLocation.h @@ -16,212 +16,212 @@ #include <Swiften/Elements/Payload.h> namespace Swift { - class SWIFTEN_API UserLocation : public Payload { - public: - - UserLocation(); - - virtual ~UserLocation(); + class SWIFTEN_API UserLocation : public Payload { + public: - const boost::optional< std::string >& getArea() const { - return area; - } + UserLocation(); - void setArea(const boost::optional< std::string >& value) { - this->area = value ; - } + virtual ~UserLocation(); - const boost::optional< float >& getAltitude() const { - return altitude; - } + const boost::optional< std::string >& getArea() const { + return area; + } - void setAltitude(const boost::optional< float >& value) { - this->altitude = value ; - } + void setArea(const boost::optional< std::string >& value) { + this->area = value ; + } - const boost::optional< std::string >& getLocality() const { - return locality; - } + const boost::optional< float >& getAltitude() const { + return altitude; + } - void setLocality(const boost::optional< std::string >& value) { - this->locality = value ; - } + void setAltitude(const boost::optional< float >& value) { + this->altitude = value ; + } - const boost::optional< float >& getLatitude() const { - return latitude; - } + const boost::optional< std::string >& getLocality() const { + return locality; + } - void setLatitude(const boost::optional< float >& value) { - this->latitude = value ; - } + void setLocality(const boost::optional< std::string >& value) { + this->locality = value ; + } - const boost::optional< float >& getAccuracy() const { - return accuracy; - } + const boost::optional< float >& getLatitude() const { + return latitude; + } - void setAccuracy(const boost::optional< float >& value) { - this->accuracy = value ; - } + void setLatitude(const boost::optional< float >& value) { + this->latitude = value ; + } - const boost::optional< std::string >& getDescription() const { - return description; - } + const boost::optional< float >& getAccuracy() const { + return accuracy; + } - void setDescription(const boost::optional< std::string >& value) { - this->description = value ; - } + void setAccuracy(const boost::optional< float >& value) { + this->accuracy = value ; + } - const boost::optional< std::string >& getCountryCode() const { - return countryCode; - } + const boost::optional< std::string >& getDescription() const { + return description; + } - void setCountryCode(const boost::optional< std::string >& value) { - this->countryCode = value ; - } + void setDescription(const boost::optional< std::string >& value) { + this->description = value ; + } - const boost::optional< boost::posix_time::ptime >& getTimestamp() const { - return timestamp; - } + const boost::optional< std::string >& getCountryCode() const { + return countryCode; + } - void setTimestamp(const boost::optional< boost::posix_time::ptime >& value) { - this->timestamp = value ; - } + void setCountryCode(const boost::optional< std::string >& value) { + this->countryCode = value ; + } - const boost::optional< std::string >& getFloor() const { - return floor; - } + const boost::optional< boost::posix_time::ptime >& getTimestamp() const { + return timestamp; + } - void setFloor(const boost::optional< std::string >& value) { - this->floor = value ; - } + void setTimestamp(const boost::optional< boost::posix_time::ptime >& value) { + this->timestamp = value ; + } - const boost::optional< std::string >& getBuilding() const { - return building; - } + const boost::optional< std::string >& getFloor() const { + return floor; + } - void setBuilding(const boost::optional< std::string >& value) { - this->building = value ; - } + void setFloor(const boost::optional< std::string >& value) { + this->floor = 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 >& getBuilding() const { + return building; + } + + void setBuilding(const boost::optional< std::string >& value) { + this->building = 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; + }; } diff --git a/Swiften/Elements/UserTune.h b/Swiften/Elements/UserTune.h index c500832..7def9b9 100644 --- a/Swiften/Elements/UserTune.h +++ b/Swiften/Elements/UserTune.h @@ -15,77 +15,77 @@ #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..f541d06 100644 --- a/Swiften/Elements/VCard.cpp +++ b/Swiften/Elements/VCard.cpp @@ -11,15 +11,15 @@ 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(); + foreach(const EMailAddress& 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 ba9c39c..94cd029 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -17,287 +17,287 @@ #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 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(); + } - 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 dcd6ad7..6bf7e03 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp @@ -20,44 +20,44 @@ #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 d11fd8c..afecd0c 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h @@ -17,19 +17,19 @@ #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 boost::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 b01f31d..a4d1207 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardElement.h @@ -17,23 +17,23 @@ #include <Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h> namespace Swift { - class WhiteboardElement { - public: - typedef boost::shared_ptr<WhiteboardElement> ref; + class WhiteboardElement { + public: + typedef boost::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 040c8a3..15b50e4 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h @@ -17,65 +17,65 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h index 5164ae9..7522b7b 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h @@ -20,45 +20,45 @@ #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 boost::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_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h index bbeaa12..855e502 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h @@ -17,19 +17,19 @@ #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 boost::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 dae207a..7fb8a77 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h @@ -18,56 +18,56 @@ #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 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; + } - 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 79083a0..b657bd9 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h @@ -19,41 +19,41 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h index 38bc3e1..bd0b674 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h @@ -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 boost::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_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h index 7d47ba0..c681e97 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h @@ -17,65 +17,65 @@ #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 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_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h index 37ae2c5..df00bea 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h @@ -17,55 +17,55 @@ #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 boost::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_; + std::string text_; + WhiteboardColor color_; + }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h index fe88fe7..5147999 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h @@ -17,28 +17,28 @@ #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 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_; + }; } diff --git a/Swiften/Elements/WhiteboardPayload.h b/Swiften/Elements/WhiteboardPayload.h index 3fcaa33..42e1375 100644 --- a/Swiften/Elements/WhiteboardPayload.h +++ b/Swiften/Elements/WhiteboardPayload.h @@ -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 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_; + }; } |