Gazebo Math

API Reference

7.4.0
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
27namespace gz
28{
29 namespace math
30 {
31 // Inline bracket to help doxygen filtering.
32 inline namespace GZ_MATH_VERSION_NAMESPACE {
38 class GZ_MATH_VISIBLE SemanticVersion
39 {
42 public: SemanticVersion();
43
46 public: explicit SemanticVersion(const std::string &_v);
47
54 public: explicit SemanticVersion(const unsigned int _major,
55 const unsigned int _minor = 0,
56 const unsigned int _patch = 0,
57 const std::string &_prerelease = "",
58 const std::string &_build = "");
59
64 public: bool Parse(const std::string &_versionStr);
65
68 public: std::string Version() const;
69
72 public: unsigned int Major() const;
73
76 public: unsigned int Minor() const;
77
80 public: unsigned int Patch() const;
81
85 public: std::string Prerelease() const;
86
91 public: std::string Build() const;
92
96 public: bool operator<(const SemanticVersion &_other) const;
97
101 public: bool operator<=(const SemanticVersion &_other) const;
102
106 public: bool operator>(const SemanticVersion &_other) const;
107
111 public: bool operator>=(const SemanticVersion &_other) const;
112
116 public: bool operator==(const SemanticVersion &_other) const;
117
121 public: bool operator!=(const SemanticVersion &_other) const;
122
127 public: friend std::ostream &operator<<(std::ostream &_out,
128 const SemanticVersion &_v)
129 {
130 _out << _v.Version();
131 return _out;
132 }
133
134 GZ_UTILS_IMPL_PTR(dataPtr)
135 };
136 }
137 }
138}
139#endif