00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _VERSION_H_
00013 #define _VERSION_H_
00014
00015
00016 #include "wx/tokenzr.h"
00017
00018 class wxVersion;
00019 class wxVersionRange;
00020
00021 extern wxVersion wxEmptyVersion;
00022 extern wxVersionRange wxEmptyVersionRange;
00023
00024
00025
00026
00027
00028
00030 class wxVersion : public wxObject
00031 {
00032 DECLARE_DYNAMIC_CLASS(wxVersion)
00033
00034 public:
00035 wxVersion(size_t major = 0, size_t minor = 0, size_t release = 0)
00036 { m_nMajor=major; m_nMinor=minor; m_nRelease=release; }
00037 wxVersion(const wxString &str)
00038 { Set(str); }
00039
00040 public:
00041
00042 wxVersion &operator=(const wxString &str)
00043 { Set(str); return *this; }
00044 operator wxString() const
00045 { return GetAsString(); }
00046
00047
00048
00049
00050
00051 bool operator >(const wxVersion &ver) const;
00052 bool operator <(const wxVersion &ver) const;
00053 bool operator==(const wxVersion &ver) const;
00054
00055 bool operator!=(const wxVersion &ver) const
00056 { return !(*this == ver); }
00057 bool operator >=(const wxVersion &ver) const
00058 { return *this > ver || *this == ver; }
00059 bool operator <=(const wxVersion &ver) const
00060 { return *this < ver || *this == ver; }
00061
00062
00063 public:
00064
00065 void Set(size_t major, size_t minor, size_t release)
00066 { m_nMajor=major; m_nMinor=minor; m_nRelease=release; }
00067
00068 bool Set(const wxString &str);
00069
00070 public:
00071
00072 wxString GetAsString() const
00073 { return wxString::Format(wxT("%d.%d.%d"), m_nMajor, m_nMinor, m_nRelease); }
00074
00075 bool IsOk() const
00076 {
00077 return m_nMajor != 0 ||
00078 m_nMinor != 0 ||
00079 m_nRelease != 0;
00080 }
00081
00082 size_t GetMajor() const
00083 { return m_nMajor; }
00084 size_t GetMinor() const
00085 { return m_nMinor; }
00086 size_t GetRelease() const
00087 { return m_nRelease; }
00088
00089 protected:
00090
00091
00092
00093 size_t m_nMajor, m_nMinor, m_nRelease;
00094 };
00095
00096
00097
00098
00099
00100
00101
00103 class wxVersionRange : public wxObject
00104 {
00105 DECLARE_DYNAMIC_CLASS(wxVersionRange)
00106
00107 public:
00108 wxVersionRange()
00109 {}
00110 wxVersionRange(const wxVersion &start, const wxVersion &end)
00111 { m_start=start; m_end=end; }
00112 wxVersionRange(const wxString &str)
00113 { Set(str); }
00114
00115 public:
00116
00117 wxVersionRange &operator=(const wxString &str)
00118 { Set(str); return *this; }
00119 operator wxString() const
00120 { return GetAsString(); }
00121 bool operator==(const wxVersionRange &ver) const
00122 { return m_start==ver.m_start && m_end==ver.m_end; }
00123 bool operator!=(const wxVersionRange &ver) const
00124 { return !(*this == ver); }
00125
00126 public:
00127
00128 bool IsOk() const
00129 {
00130 return m_start.IsOk() && m_end.IsOk();
00131 }
00132
00133 bool Contains(const wxVersion &ver) const;
00134 bool OverlapsWith(const wxVersionRange &ver) const;
00135
00136 public:
00137
00138 void Set(const wxVersion &start, const wxVersion &end)
00139 { m_start=start; m_end=end; }
00140
00141 bool Set(const wxString &str);
00142
00143 public:
00144
00146 wxString GetAsString() const;
00147
00150 wxVersion GetStart() const
00151 { return m_start; }
00152
00155 wxVersion GetEnd() const
00156 { return m_end; }
00157
00158 protected:
00159
00160 wxVersion m_start, m_end;
00161 };
00162
00163
00164 WX_DECLARE_OBJARRAY(wxVersionRange, wxVersionRangeArray);
00165
00166
00167 #endif // _VERSION_H_
00168