00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <Swiften/Elements/Payload.h>
00010 #include <boost/shared_ptr.hpp>
00011 #include <boost/date_time/posix_time/posix_time_types.hpp>
00012
00013 #include <string>
00014
00015 namespace Swift {
00016
00017 class StreamInitiationFileInfo : public Payload {
00018 public:
00019 typedef boost::shared_ptr<StreamInitiationFileInfo> ref;
00020
00021 public:
00022 StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = 0,
00023 const std::string& hash = "", const boost::posix_time::ptime &date = boost::posix_time::ptime(), const std::string& algo="md5") :
00024 name(name), description(description), size(size), hash(hash), date(date), algo(algo), supportsRangeRequests(false), rangeOffset(0) {}
00025
00026 void setName(const std::string& name) {
00027 this->name = name;;
00028 }
00029
00030 const std::string& getName() const {
00031 return this->name;
00032 }
00033
00034 void setDescription(const std::string& description) {
00035 this->description = description;
00036 }
00037
00038 const std::string& getDescription() const {
00039 return this->description;
00040 }
00041
00042 void setSize(const boost::uintmax_t size) {
00043 this->size = size;
00044 }
00045
00046 boost::uintmax_t getSize() const {
00047 return this->size;
00048 }
00049
00050 void setHash(const std::string& hash) {
00051 this->hash = hash;
00052 }
00053
00054 const std::string& getHash() const {
00055 return this->hash;
00056 }
00057
00058 void setDate(const boost::posix_time::ptime& date) {
00059 this->date = date;
00060 }
00061
00062 const boost::posix_time::ptime& getDate() const {
00063 return this->date;
00064 }
00065
00066 void setAlgo(const std::string& algo) {
00067 this->algo = algo;
00068 }
00069
00070 const std::string& getAlgo() const {
00071 return this->algo;
00072 }
00073
00074 void setSupportsRangeRequests(const bool supportsIt) {
00075 supportsRangeRequests = supportsIt;
00076 }
00077
00078 bool getSupportsRangeRequests() const {
00079 return supportsRangeRequests;
00080 }
00081
00082 void setRangeOffset(const int offset) {
00083 supportsRangeRequests = offset >= 0 ? true : false;
00084 rangeOffset = offset;
00085 }
00086
00087 boost::uintmax_t getRangeOffset() const {
00088 return rangeOffset;
00089 }
00090
00091 private:
00092 std::string name;
00093 std::string description;
00094 boost::uintmax_t size;
00095 std::string hash;
00096 boost::posix_time::ptime date;
00097 std::string algo;
00098 bool supportsRangeRequests;
00099 boost::uintmax_t rangeOffset;
00100 };
00101
00102 }