Data Access Library (DAL)
|
00001 /* Copyright 2011-2012 ASTRON, Netherlands Institute for Radio Astronomy 00002 * This file is part of the Data Access Library (DAL). 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 3 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #ifndef DAL_VERSIONTYPE_H 00018 #define DAL_VERSIONTYPE_H 00019 00020 #include <string> 00021 #include <ostream> 00022 00023 namespace dal { 00024 00025 // stupid GNU 00026 #ifdef major 00027 #undef major 00028 #endif 00029 00030 // stupid GNU 00031 #ifdef minor 00032 #undef minor 00033 #endif 00034 00070 struct VersionType { 00071 unsigned major; 00072 unsigned minor; 00073 unsigned release; 00074 00075 VersionType(unsigned major = 0, unsigned minor = 0, unsigned release = 0); 00076 00083 VersionType(const std::string &str); 00084 00088 std::string to_string() const; 00089 00096 int cmp(const VersionType &other) const; 00097 00098 bool operator <(const VersionType &other) const; 00099 bool operator <=(const VersionType &other) const; 00100 bool operator >(const VersionType &other) const; 00101 bool operator >=(const VersionType &other) const; 00102 bool operator ==(const VersionType &other) const; 00103 bool operator !=(const VersionType &other) const; 00104 }; 00105 00106 std::ostream &operator<<(std::ostream &str, const VersionType &version); 00107 00108 } 00109 00110 #endif