/home/greg/src/restcgi-test/src/version.h

00001 /*
00002 Copyright (c) 2009 zooml.com
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy
00005 of this software and associated documentation files (the "Software"), to deal
00006 in the Software without restriction, including without limitation the rights
00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008 copies of the Software, and to permit persons to whom the Software is
00009 furnished to do so, subject to the following conditions:
00010 
00011 The above copyright notice and this permission notice shall be included in
00012 all copies or substantial portions of the Software.
00013 
00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00020 THE SOFTWARE.
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

Generated on Fri May 15 11:27:12 2009 for restcgi by  doxygen 1.4.7