Simple Application Framework
1
|
00001 /* 00002 This file is part of Simple Application Framework (Saf) library. 00003 Copyright (C) 2010 - 2012 Ondrej Danek <ondrej.danek@gmail.com> 00004 00005 This library is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published 00007 by the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 Saf is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with Simple Application Framework library. If not, 00017 see <http://www.gnu.org/licenses/>. 00018 */ 00019 00028 #ifndef SAF_SYSTEM_VERSION_H 00029 #define SAF_SYSTEM_VERSION_H 00030 00031 #include "../Type.h" 00032 00033 namespace Saf 00034 { 00035 namespace System 00036 { 00038 class Version 00039 { 00040 private: 00041 Uint32 m_major; 00042 Uint32 m_minor; 00043 Uint32 m_revision; 00044 00045 public: 00047 Version(Uint32 major, Uint32 minor, Uint32 revision) 00048 : m_major(major), m_minor(minor), m_revision(revision) 00049 {} 00050 00052 Version(const Version &v) 00053 : m_major(v.m_major), m_minor(v.m_minor), m_revision(v.m_revision) 00054 {} 00055 00057 Version& operator= (const Version &v) 00058 { 00059 m_major = v.m_major; 00060 m_minor = v.m_minor; 00061 m_revision = v.m_revision; 00062 return *this; 00063 } 00064 00065 Uint32 Major () const 00066 { 00067 return m_major; 00068 } 00069 00070 Uint32 Minor () const 00071 { 00072 return m_minor; 00073 } 00074 00075 Uint32 Revision () const 00076 { 00077 return m_revision; 00078 } 00079 00080 bool operator== (const Version &v) const 00081 { 00082 return (m_major == v.m_major && m_minor == v.m_minor && m_revision == v.m_revision); 00083 } 00084 00085 bool operator> (const Version &v) 00086 { 00087 if (m_major != v.m_major) 00088 { 00089 return m_major > v.m_major; 00090 } 00091 if (m_minor != v.m_minor) 00092 { 00093 return m_minor > v.m_minor; 00094 } 00095 return m_revision > v.m_revision; 00096 } 00097 00098 bool operator< (const Version &v) 00099 { 00100 if (m_major != v.m_major) 00101 { 00102 return m_major < v.m_major; 00103 } 00104 if (m_minor != v.m_minor) 00105 { 00106 return m_minor < v.m_minor; 00107 } 00108 return m_revision < v.m_revision; 00109 } 00110 }; 00111 } 00112 } 00113 00114 #endif