UTVersionInfo.h

Go to the documentation of this file.
00001 //==================================================================================================
00002 // Copyright (C) 2010  Brian Tietz    sdbtietz at yahoo dot com
00003 //
00004 // This program is free software; you can redistribute it and/or modify it under the terms of the
00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the
00006 // License.
00007 //
00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010 // General Public License for more details.
00011 //
00012 // You should have received a copy of the GNU General Public License along with this program; if
00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00014 // 02110-1301, USA.
00015 //
00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com)
00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that
00018 // license as applied to the UT library in exchange for either substantial contributions to the
00019 // development of the UT library or other forms of compensation.  Any such waiver must be
00020 // established in writing between the copyright holder and the commercial entity obtaining such a
00021 // waiver.
00022 //==================================================================================================
00023 
00024 
00025 #ifndef _UT_VERSION_INFO_H_
00026 #define _UT_VERSION_INFO_H_
00027 
00028 
00029 //==================================================================================================
00030 //=== Project headers
00031 //==================================================================================================
00032 #include "UT.h"
00033 
00034 
00035 // \cond DOXYGEN_DOCUMENT_NEVER
00036 
00037 #pragma pack(1)
00038 
00039 //==================================================================================================
00040 struct InternalVersionInfo_t
00041 //==================================================================================================
00042 {
00043     uint8   major;              
00044     uint8   minor;              
00045     uint8   subminor;           
00046     uint8   subsubminor;        
00047     uint8   alpha;              
00048     uint8   beta;               
00049     uint8   rc;                 
00050     uint8   has_build_number;   
00051     uint16  build_number;       
00052 };
00053 
00054 #pragma pack()
00055 
00056 
00057 extern void get_version_string( const InternalVersionInfo_t* version, out String_t* version_string );
00058 
00059 // \endcond
00060 
00061 
00062 //==================================================================================================
00063 class UT_EXPORT VersionInfo_t
00064 //==================================================================================================
00135 {
00136     //----------------------------------------------------------------------------------------------
00137     public:
00138     //----------------------------------------------------------------------------------------------
00139     inline                          VersionInfo_t();
00141 
00142     void                            Init(stringliteral* library_name = NULL);
00155 
00156     inline uint8                    MajorVersion() const;
00159 
00160     inline uint8                    MinorVersion() const;
00163 
00164     inline uint8                    SubminorVersion() const;
00167 
00168     inline uint8                    SubSubminorVersion() const;
00171 
00172     inline bool                     IsAlphaVersion() const;
00175 
00176     inline bool                     IsBetaVersion() const;
00179 
00180     inline bool                     IsReleaseCandidate() const;
00183 
00184     inline bool                     HasBuildNumber() const;
00187 
00188     inline uint16                   BuildNumber() const;
00190 
00191     void                            GetVersionString(out String_t* version_string) const;
00193 
00194     //----------------------------------------------------------------------------------------------
00195     private:
00196     //----------------------------------------------------------------------------------------------
00197     bool                            m_initialized;
00198     InternalVersionInfo_t           m_info;
00199 };
00200 
00201 
00202 
00203 
00204 //==================================================================================================
00205 //==================================================================================================
00206 //===
00207 //=== Inline function implementations
00208 //===
00209 //==================================================================================================
00210 //==================================================================================================
00211 inline
00212 VersionInfo_t::VersionInfo_t()
00213 {
00214     m_initialized = false;
00215 }
00216 
00217 
00218 inline uint8
00219 VersionInfo_t::MajorVersion() const
00220 {
00221     assert(m_initialized);
00222     return m_info.major;
00223 }
00224 
00225 
00226 inline uint8
00227 VersionInfo_t::MinorVersion() const
00228 {
00229     assert(m_initialized);
00230     return m_info.minor;
00231 }
00232 
00233 
00234 inline uint8
00235 VersionInfo_t::SubminorVersion() const
00236 {
00237     assert(m_initialized);
00238     return m_info.subminor;
00239 }
00240 
00241 
00242 inline uint8
00243 VersionInfo_t::SubSubminorVersion() const
00244 {
00245     assert(m_initialized);
00246     return m_info.subsubminor;
00247 }
00248 
00249 
00250 inline bool
00251 VersionInfo_t::IsAlphaVersion() const
00252 {
00253     assert(m_initialized);
00254     return m_info.alpha ? true : false;
00255 }
00256 
00257 
00258 inline bool
00259 VersionInfo_t::IsBetaVersion() const
00260 {
00261     assert(m_initialized);
00262     return m_info.beta ? true : false;
00263 }
00264 
00265 
00266 inline bool
00267 VersionInfo_t::IsReleaseCandidate() const
00268 {
00269     assert(m_initialized);
00270     return m_info.rc ? true : false;
00271 }
00272 
00273 
00274 inline bool
00275 VersionInfo_t::HasBuildNumber() const
00276 {
00277     assert(m_initialized);
00278     return m_info.has_build_number ? true : false;
00279 }
00280 
00281 
00282 inline uint16
00283 VersionInfo_t::BuildNumber() const
00284 {
00285     assert(m_initialized && m_info.has_build_number);
00286     return m_info.build_number;
00287 }
00288 
00289 
00290 #endif // _UT_VERSION_INFO_H_

Generated on Tue Dec 14 22:35:05 2010 for UT library by  doxygen 1.6.1