libept
|
00001 #ifndef EPT_APT_VERSION_H 00002 #define EPT_APT_VERSION_H 00003 00008 /* 00009 * Copyright (C) 2007 Enrico Zini <enrico@enricozini.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 */ 00025 00026 #include <string> 00027 00028 namespace ept { 00029 namespace apt { 00030 00040 class Version 00041 { 00042 protected: 00043 std::string m_name; 00044 std::string m_version; 00045 00046 public: 00050 Version() {} 00051 00055 Version(const std::string& name, const std::string& version) 00056 : m_name(name), m_version(version) {} 00057 00061 std::string name() const { return m_name; } 00062 00067 std::string version() const { return m_version; } 00068 00072 std::string upstreamVersion() const; 00073 00077 bool isValid() const { return !m_name.empty() && !m_version.empty(); } 00078 00082 bool operator==(const Version& pkg) const { return m_name == pkg.m_name && m_version == pkg.m_version; } 00083 bool operator!=(const Version& pkg) const { return m_name != pkg.m_name || m_version != pkg.m_version; } 00084 bool operator<=(const Version& pkg) const; 00085 bool operator<(const Version& pkg) const; 00086 bool operator>=(const Version& pkg) const; 00087 bool operator>(const Version& pkg) const; 00088 }; 00089 00090 } 00091 } 00092 00093 // vim:set ts=4 sw=4: 00094 #endif