Version.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_Version_hxx
00024 #define __ccxx_Version_hxx
00025 
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/String.h++>
00028 
00029 namespace ccxx {
00030 
00056 class COMMONCPP_API Version
00057 {
00058   public:
00059 
00066   Version(const String& version) throw();
00067 
00076   Version(uint_t current = 0, uint_t revision = 0, uint_t age = 0) throw();
00077 
00079   Version(const Version& other) throw();
00080 
00082   virtual ~Version() throw();
00083 
00093   bool satisfies(const Version& requested) const throw();
00094 
00103   bool satisfiedBy(const Version& available) const throw();
00104 
00106   inline uint_t getCurrent() const throw()
00107   { return(_current); }
00108 
00110   inline uint_t getRevision() const throw()
00111   { return(_revision); }
00112 
00114   inline uint_t getAge() const throw()
00115   { return(_age); }
00116 
00118   void interfacesAdded() throw();
00119 
00121   void interfacesRemoved() throw();
00122 
00126   void interfacesChanged() throw();
00127 
00129   void implementationChanged() throw();
00130 
00134   String toString() const;
00135 
00137   String toCRAString() const;
00138 
00140   void fromString(const String& version) throw();
00141 
00143   bool operator==(const Version& other) const throw();
00144 
00146   inline bool operator!=(const Version& other) const throw()
00147   { return(! operator==(other)); }
00148 
00150   bool operator<(const Version& other) const throw();
00151 
00153   inline bool operator<=(const Version& other) const throw()
00154   { return(operator<(other) || operator==(other)); }
00155 
00157   bool operator>(const Version& other) const throw();
00158 
00160   inline bool operator>=(const Version& other) const throw()
00161   { return(operator>(other) || operator==(other)); }
00162 
00164   Version& operator=(const Version& other) throw();
00165 
00166   private:
00167 
00168   uint_t _current;
00169   uint_t _revision;
00170   uint_t _age;
00171   mutable String _str;
00172   mutable String _vstr;
00173 };
00174 
00175 inline std::ostream& operator<<(std::ostream& stream, const Version& v)
00176 { return(stream << v.toString().c_str()); }
00177 
00178 }; // namespace ccxx
00179 
00180 #endif // __ccxx_Version_hxx
00181 
00182 /* end of header file */
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3