libqi-api  2.1.4.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
version.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Author(s):
4 ** - Cedric GESTES <gestes@aldebaran-robotics.com>
5 **
6 ** Copyright (C) 2010 Aldebaran Robotics
7 */
8 
9 #ifndef _QI_VERSION_HPP_
10 #define _QI_VERSION_HPP_
11 
12 //scoped_ptr needs to have dll-interface to be used
13 #ifdef _MSC_VER
14 # pragma warning( push )
15 # pragma warning( disable: 4251 )
16 #endif
17 
18 # include <qi/api.hpp>
19 # include <vector>
20 # include <string>
21 # include <boost/scoped_ptr.hpp>
22 
23 namespace qi {
24  namespace version {
25 
26  class VersionPrivate;
28  {
29  public:
30  // these constructors are implicit by design
31  Version();
32  Version(const Version &other);
33  Version(const std::string &version);
34  Version(const char *version);
35  ~Version();
36 
37  Version &operator= (const Version& rhs);
38 
39  operator const std::string&() const;
40 
41  bool operator< (const Version& pi) const;
42  bool operator> (const Version& pi) const;
43  bool operator==(const Version& pi) const;
44  bool operator!=(const Version& pi) const;
45  bool operator<=(const Version& pi) const;
46  bool operator>=(const Version& pi) const;
47 
48  private:
49  boost::scoped_ptr<VersionPrivate> _p;
50  };
51 
52  //convert a version's string into a vector<string> with each comparable part
53  QI_API std::vector<std::string> explode(const std::string &version);
54 
55  //compare two version's strings. a < b return -1
56  QI_API int compare(const std::string &versionA,
57  const std::string &versionB);
58 
59  QI_API std::string extract(const std::string &version);
60  }
61 }
62 
63 #ifdef _MSC_VER
64 # pragma warning( pop )
65 #endif
66 
67 #endif // _QI_VERSION_HPP_
int compare(const std::string &versionA, const std::string &versionB)
Compare version numbers.
std::vector< std::string > explode(const std::string &version)
Explode a version string to an array of strings.
std::string extract(const std::string &version)
Extract version number from string.
Struct representing a version number.
Definition: version.hpp:27
dll import/export and compiler message
bool operator<(bool b, const NullStream &ns)
Definition: log.hxx:178
#define QI_API
Definition: api.hpp:24