Gazebo Math

API Reference

7.5.1
gz/math/SemanticVersion.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_MATH_SEMANTICVERSION_HH_
19 #define GZ_MATH_SEMANTICVERSION_HH_
20 
21 #include <iosfwd>
22 #include <string>
23 #include <gz/math/Helpers.hh>
24 #include <gz/math/config.hh>
25 #include <gz/utils/ImplPtr.hh>
26 
27 namespace gz::math
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace GZ_MATH_VERSION_NAMESPACE {
36  class GZ_MATH_VISIBLE SemanticVersion
37  {
40  public: SemanticVersion();
41 
44  public: explicit SemanticVersion(const std::string &_v);
45 
52  public: explicit SemanticVersion(const unsigned int _major,
53  const unsigned int _minor = 0,
54  const unsigned int _patch = 0,
55  const std::string &_prerelease = "",
56  const std::string &_build = "");
57 
62  public: bool Parse(const std::string &_versionStr);
63 
66  public: std::string Version() const;
67 
70  public: unsigned int Major() const;
71 
74  public: unsigned int Minor() const;
75 
78  public: unsigned int Patch() const;
79 
83  public: std::string Prerelease() const;
84 
89  public: std::string Build() const;
90 
94  public: bool operator<(const SemanticVersion &_other) const;
95 
99  public: bool operator<=(const SemanticVersion &_other) const;
100 
104  public: bool operator>(const SemanticVersion &_other) const;
105 
109  public: bool operator>=(const SemanticVersion &_other) const;
110 
114  public: bool operator==(const SemanticVersion &_other) const;
115 
119  public: bool operator!=(const SemanticVersion &_other) const;
120 
125  public: friend std::ostream &operator<<(std::ostream &_out,
126  const SemanticVersion &_v)
127  {
128  _out << _v.Version();
129  return _out;
130  }
131 
132  GZ_UTILS_IMPL_PTR(dataPtr)
133  };
134  } // namespace GZ_MATH_VERSION_NAMESPACE
135 } // namespace gz::math
136 #endif // GZ_MATH_SEMANTICVERSION_HH_