00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00029
00030 #ifndef UTIL_VERSION_H
00031 #define UTIL_VERSION_H
00032
00033
00034 #include <PVLE/Util/Util.h>
00035 #include <boost/operators.hpp>
00036
00039 class PVLE_EXPORT Version : public boost::totally_ordered<Version> {
00040 public:
00042 enum EVersionQuality {
00043 QUALITY_DEV,
00044 QUALITY_ALPHA,
00045 QUALITY_BETA,
00046 QUALITY_RELEASE_CANDIDATE,
00047 QUALITY_GAMMA = QUALITY_RELEASE_CANDIDATE,
00048 QUALITY_STABLE,
00049 MAX_QUALITY
00050 };
00051
00052 Version(UINT majorNumber = 0, UINT minorNumber = 0, UINT revision = 0, UINT build = 0, EVersionQuality quality = QUALITY_STABLE)
00053 : majorNumber(majorNumber), minorNumber(minorNumber), revision(revision), build(build), quality(quality)
00054 {}
00055 Version(const Version & v) : majorNumber(v.majorNumber), minorNumber(v.minorNumber), revision(v.revision), build(v.build), quality(v.quality) {}
00057 Version(const std::string & str) { reset(); fromString(str); }
00058
00060 std::string toString() const;
00062 std::string toShortString() const;
00063
00066 bool fromString(const std::string & str);
00067
00069 void reset() { majorNumber = 0; minorNumber = 0; revision = 0; build = 0; quality = QUALITY_STABLE; }
00070
00071 Version & operator=(const Version & v) {
00072 majorNumber = v.majorNumber;
00073 minorNumber = v.minorNumber;
00074 revision = v.revision;
00075 build = v.build;
00076 quality = v.quality;
00077 return *this;
00078 }
00080 bool operator==(const Version & v) const { return majorNumber == v.majorNumber && minorNumber == v.minorNumber && revision == v.revision && build == v.build; }
00082 bool operator<(const Version & v) const {
00083 if (majorNumber != v.majorNumber) return majorNumber < v.majorNumber;
00084 if (minorNumber != v.minorNumber) return minorNumber < v.minorNumber;
00085 if (revision != v.revision) return revision < v.revision;
00086 return build < v.build;
00087 }
00088
00089 UINT majorNumber;
00090 UINT minorNumber;
00091 UINT revision;
00092 UINT build;
00093
00094 EVersionQuality quality;
00095 };
00096
00097
00098 #endif // UTIL_VERSION_H