00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef restcgi_version_h
00023 #define restcgi_version_h
00024 #include "apidefs.h"
00025 #include "date_time.h"
00026 #include "method_e.h"
00027 #include <string>
00028 #ifdef _WIN32
00029 #pragma warning (disable: 4251)
00030 #endif
00031 namespace restcgi {
00043 class RESTCGI_API version_tag {
00044 public:
00045 version_tag();
00046 version_tag(const std::string& v);
00047 version_tag(int v);
00048 version_tag(unsigned int v);
00049 version_tag(long long v);
00050 version_tag(unsigned long long v);
00051 bool is_null() const {return string_.empty();}
00052 const std::string& string() const {return string_;}
00053
00054 bool operator ==(const version_tag& rhs) const {return string_ == rhs.string_;}
00056 bool operator !=(const version_tag& rhs) const {return string_ != rhs.string_;}
00057 private:
00058 std::string string_;
00059 };
00078 class RESTCGI_API version {
00079 public:
00080 typedef restcgi::version_tag tag_type;
00081 typedef restcgi::date_time date_time_type;
00082 version();
00083 version(const tag_type& tag, const date_time_type& dt = date_time_type());
00084 version(const date_time_type& dt, const tag_type& tag = tag_type());
00085 bool is_null() const {return tag_.is_null() && date_time_.is_null();}
00086 const tag_type& tag() const {return tag_;}
00087 date_time_type date_time() const {return date_time_;}
00088 private:
00089 tag_type tag_;
00090 date_time_type date_time_;
00091 };
00102 class RESTCGI_API version_constraint {
00103 public:
00104 typedef restcgi::version version_type;
00105 version_constraint();
00106 version_constraint(const version_type& v, bool mod);
00107 bool is_null() const {return version_.is_null();}
00108 const version_type& version() const {return version_;}
00109 bool modified() const {return modified_;}
00110
00111
00112
00113
00114
00115
00116 void assert_satisfied(const version_type& v, const method_e& e) const;
00117 private:
00118 version_type version_;
00119 bool modified_;
00120 };
00121 }
00122 #endif