• Main Page
  • Classes
  • Files
  • File List

Swiften/Elements/RosterItemPayload.h

00001 /*
00002  * Copyright (c) 2010 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <vector>
00010 #include <string>
00011 
00012 #include <Swiften/JID/JID.h>
00013 
00014 namespace Swift {
00015   class RosterItemPayload {
00016     public:
00017       enum Subscription { None, To, From, Both, Remove };
00018 
00019       RosterItemPayload() : subscription_(None), ask_(false) {}
00020       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) { }
00021       
00022       void setJID(const JID& jid) { jid_ = jid; }
00023       const JID& getJID() const { return jid_; }
00024 
00025       void setName(const std::string& name) { name_ = name; }
00026       const std::string& getName() const { return name_; }
00027 
00028       void setSubscription(Subscription subscription) { subscription_ = subscription; }
00029       const Subscription& getSubscription() const { return subscription_; }
00030 
00031       void addGroup(const std::string& group) { groups_.push_back(group); }
00032       void setGroups(const std::vector<std::string>& groups) { groups_ = groups; }
00033       const std::vector<std::string>& getGroups() const { return groups_; }
00034 
00035       void setSubscriptionRequested() { ask_ = true; }
00036       bool getSubscriptionRequested() const { return ask_; }
00037 
00038       const std::string& getUnknownContent() const { return unknownContent_; }
00039       void addUnknownContent(const std::string& c) { 
00040         unknownContent_ += c;
00041       }
00042 
00043     private:
00044       JID jid_;
00045       std::string name_;
00046       Subscription subscription_;
00047       std::vector<std::string> groups_;
00048       bool ask_;
00049       std::string unknownContent_;
00050   };
00051 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1