• Main Page
  • Classes
  • Files
  • File List

Swiften/Elements/CapsInfo.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 <boost/shared_ptr.hpp>
00010 #include <string>
00011 
00012 #include <Swiften/Elements/Payload.h>
00013 
00014 namespace Swift {
00015   class CapsInfo : public Payload {
00016     public:
00017       typedef boost::shared_ptr<CapsInfo> ref;
00018 
00019       CapsInfo(const std::string& node = "", const std::string& version = "", const std::string& hash = "sha-1") : node_(node), version_(version), hash_(hash) {}
00020 
00021       bool operator==(const CapsInfo& o) const {
00022         return o.node_ == node_ && o.version_ == version_ && o.hash_ == hash_;
00023       }
00024 
00025       bool operator<(const CapsInfo& o) const {
00026         if (o.node_ == node_) {
00027           if (o.version_ == version_) {
00028             return hash_ < o.hash_;
00029           }
00030           else {
00031             return version_ < o.version_;
00032           }
00033         }
00034         else {
00035           return node_ < o.node_;
00036         }
00037       }
00038 
00039       const std::string& getNode() const { return node_; }
00040       void setNode(const std::string& node) {
00041         node_ = node;
00042       }
00043 
00044       const std::string& getVersion() const { return version_; }
00045       void setVersion(const std::string& version) {
00046         version_ = version;
00047       }
00048 
00049       const std::string& getHash() const { return hash_; }
00050       void setHash(const std::string& hash) {
00051         hash_ = hash;
00052       }
00053 
00054     private:
00055       std::string node_;
00056       std::string version_;
00057       std::string hash_;
00058   };
00059 }

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