libqi-api
2.0.6.8
|
00001 #pragma once 00002 /* 00003 ** Author(s): 00004 ** - Cedric GESTES <gestes@aldebaran-robotics.com> 00005 ** 00006 ** Copyright (C) 2010 Aldebaran Robotics 00007 */ 00008 00009 #ifndef _QI_VERSION_HPP_ 00010 #define _QI_VERSION_HPP_ 00011 00012 //scoped_ptr needs to have dll-interface to be used 00013 #ifdef _MSC_VER 00014 # pragma warning( push ) 00015 # pragma warning( disable: 4251 ) 00016 #endif 00017 00018 # include <qi/api.hpp> 00019 # include <vector> 00020 # include <string> 00021 # include <boost/scoped_ptr.hpp> 00022 00023 namespace qi { 00024 namespace version { 00025 00026 class VersionPrivate; 00027 class QI_API Version 00028 { 00029 public: 00030 // these constructors are implicit by design 00031 Version(); 00032 Version(const Version &other); 00033 Version(const std::string &version); 00034 Version(const char *version); 00035 ~Version(); 00036 00037 Version &operator= (const Version& rhs); 00038 00039 operator const std::string&() const; 00040 00041 bool operator< (const Version& pi) const; 00042 bool operator> (const Version& pi) const; 00043 bool operator==(const Version& pi) const; 00044 bool operator!=(const Version& pi) const; 00045 bool operator<=(const Version& pi) const; 00046 bool operator>=(const Version& pi) const; 00047 00048 private: 00049 boost::scoped_ptr<VersionPrivate> _p; 00050 }; 00051 00052 //convert a version's string into a vector<string> with each comparable part 00053 QI_API std::vector<std::string> explode(const std::string &version); 00054 00055 //compare two version's strings. a < b return -1 00056 QI_API int compare(const std::string &versionA, 00057 const std::string &versionB); 00058 00059 QI_API std::string extract(const std::string &version); 00060 } 00061 } 00062 00063 #ifdef _MSC_VER 00064 # pragma warning( pop ) 00065 #endif 00066 00067 #endif // _QI_VERSION_HPP_