• Main Page
  • Classes
  • Files
  • File List

Swiften/Elements/RosterItemExchangePayload.h

00001 /*
00002  * Copyright (c) 2011 Jan Kaluza
00003  * Licensed under the Simplified BSD license.
00004  * See Documentation/Licenses/BSD-simplified.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <vector>
00010 #include <string>
00011 #include <boost/shared_ptr.hpp>
00012 
00013 #include <Swiften/Base/API.h>
00014 #include <Swiften/Elements/Payload.h>
00015 #include <Swiften/JID/JID.h>
00016 
00017 namespace Swift {
00018   class SWIFTEN_API RosterItemExchangePayload : public Payload {
00019     public:
00020       typedef boost::shared_ptr<RosterItemExchangePayload> ref;
00021 
00022       class SWIFTEN_API Item {
00023         public:
00024           enum Action { Add, Modify, Delete };
00025 
00026           Item(Action action = Add);
00027 
00028           Action getAction() const {
00029             return action;
00030           }
00031 
00032           void setAction(Action action) {
00033             this->action = action;
00034           }
00035 
00036           const JID& getJID() const {
00037             return jid;
00038           }
00039 
00040           void setJID(const JID& jid) {
00041             this->jid = jid;
00042           }
00043 
00044           const std::string& getName() const {
00045             return name;
00046           }
00047 
00048           void setName(const std::string& name) {
00049             this->name = name;
00050           }
00051 
00052           const std::vector<std::string>& getGroups() const {
00053             return groups;
00054           }
00055 
00056           void setGroups(const std::vector<std::string> &groups) {
00057             this->groups = groups;
00058           }
00059 
00060           void addGroup(const std::string& group) {
00061             groups.push_back(group);
00062           }
00063 
00064         private:
00065           Action action;
00066           JID jid;
00067           std::string name;
00068           std::vector<std::string> groups;
00069       };
00070 
00071       typedef std::vector<RosterItemExchangePayload::Item> RosterItemExchangePayloadItems;
00072 
00073     public:
00074       RosterItemExchangePayload();
00075 
00076       void addItem(const RosterItemExchangePayload::Item& item) {
00077         items_.push_back(item);
00078       }
00079 
00080       const RosterItemExchangePayloadItems& getItems() const {
00081         return items_;
00082       }
00083 
00084     private:
00085       RosterItemExchangePayloadItems items_;
00086   };
00087 }

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