diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-17 20:04:40 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-21 11:50:43 (GMT) |
commit | 76d967cf7cef073501d152cb4863af418e74cdbe (patch) | |
tree | 437674039510ceba139f7c02fbebe95e5186ea94 /Swiften/Elements | |
parent | 94d7b0822e041740232f9d4b0f1e0f9f3dee1dd4 (diff) | |
download | swift-contrib-76d967cf7cef073501d152cb4863af418e74cdbe.zip swift-contrib-76d967cf7cef073501d152cb4863af418e74cdbe.tar.bz2 |
Added search parserialement.
Diffstat (limited to 'Swiften/Elements')
-rw-r--r-- | Swiften/Elements/SearchPayload.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/Swiften/Elements/SearchPayload.h b/Swiften/Elements/SearchPayload.h new file mode 100644 index 0000000..61b8547 --- /dev/null +++ b/Swiften/Elements/SearchPayload.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> + +#include "Swiften/Elements/Payload.h" +#include "Swiften/Elements/Form.h" +#include "Swiften/Base/String.h" + +namespace Swift { + /** + * XEP-0055 search payload. + */ + class SearchPayload : public Payload { + public: + typedef boost::shared_ptr<SearchPayload> ref; + + struct Item { + String first; + String last; + String nick; + String email; + JID jid; + }; + + SearchPayload() {} + + Form::ref getForm() const { return form; } + void setForm(Form::ref f) { form = f; } + + const boost::optional<String>& getInstructions() const { + return instructions; + } + + const boost::optional<String>& getNick() const { + return nick; + } + + const boost::optional<String>& getFirst() const { + return first; + } + + const boost::optional<String>& getLast() const { + return last; + } + + const boost::optional<String>& getEMail() const { + return email; + } + + void setInstructions(const String& v) { + this->instructions = v; + } + + void setNick(const String& v) { + this->nick = v; + } + + void setFirst(const String& v) { + this->first = v; + } + + void setLast(const String& v) { + this->last = v; + } + + void setEMail(const 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<String> instructions; + boost::optional<String> nick; + boost::optional<String> first; + boost::optional<String> last; + boost::optional<String> email; + std::vector<Item> items; + }; +} |