OMW  0.1.0
version.h
1 /*
2 author Oliver Blaser
3 date 14.08.2021
4 copyright MIT - Copyright (c) 2021 Oliver Blaser
5 */
6 
7 #ifndef OMW_VERSION_H
8 #define OMW_VERSION_H
9 
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 
14 namespace omw
15 {
16  class Version
17  {
18  public:
19  Version();
20  Version(int major, int minor, int revision);
21  explicit Version(const char* versionStr);
22  explicit Version(const std::string& versionStr);
23 
24  int maj() const;
25  int min() const;
26  int rev() const;
27 
28  const int* data() const;
29  size_t size() const;
30 
31  std::vector<int> toVector() const;
32  std::string toString() const;
33 
34  friend bool operator<(const omw::Version& left, const omw::Version& right);
35  friend bool operator>(const omw::Version& left, const omw::Version& right);
36  friend bool operator<=(const omw::Version& left, const omw::Version& right);
37  friend bool operator>=(const omw::Version& left, const omw::Version& right);
38  friend bool operator==(const omw::Version& left, const omw::Version& right);
39  friend bool operator!=(const omw::Version& left, const omw::Version& right);
40  friend std::ostream& operator<<(std::ostream& os, const omw::Version& v);
41 
42  private:
43  static constexpr size_t dataSize = 3;
44  int version[dataSize];
45 
46  void setData(const std::string& versionStr);
47  };
48 }
49 
50 #endif // OMW_VERSION_H
std::string
C++ standard string. See std::basic_string for further detail.
Definition: linkToStd.dox:15
omw::Version
Definition: version.h:17
omw::Version::size
size_t size() const
Definition: version.cpp:77
omw::Version::toString
std::string toString() const
Definition: version.cpp:91
omw
Main namespace.
omw::Version::data
const int * data() const
Definition: version.cpp:70