• Main Page
  • Classes
  • Files
  • File List

Swiften/Elements/Bytestreams.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 <boost/optional.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 #include <string>
00013 
00014 #include <Swiften/JID/JID.h>
00015 #include <Swiften/Elements/Payload.h>
00016 
00017 namespace Swift {
00018   class Bytestreams : public Payload {
00019     public:
00020       typedef boost::shared_ptr<Bytestreams> ref;
00021 
00022       struct StreamHost {
00023         StreamHost(const std::string& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {}
00024 
00025         std::string host;
00026         JID jid;
00027         int port;
00028       };
00029 
00030       Bytestreams() {}
00031 
00032       const std::string& getStreamID() const {
00033         return id;
00034       }
00035 
00036       void setStreamID(const std::string& id) {
00037         this->id = id;
00038       }
00039 
00040       const boost::optional<JID>& getUsedStreamHost() const {
00041         return usedStreamHost;
00042       }
00043 
00044       void setUsedStreamHost(const JID& host) {
00045         usedStreamHost = host;
00046       }
00047 
00048       const std::vector<StreamHost>& getStreamHosts() const {
00049         return streamHosts;
00050       }
00051 
00052       void addStreamHost(const StreamHost& streamHost) {
00053         streamHosts.push_back(streamHost);
00054       }
00055 
00056     private:
00057       std::string id;
00058       boost::optional<JID> usedStreamHost;
00059       std::vector<StreamHost> streamHosts;
00060   };
00061 }

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