##

SemanticVersion.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_COMMON_SEMANTICVERSION_HH_
#define GAZEBO_COMMON_SEMANTICVERSION_HH_
#include <string>
#include <memory>
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace common
{
// Forward declare private data class
class SemanticVersionPrivate;
class GZ_COMMON_VISIBLE SemanticVersion
{
public: SemanticVersion();
public: explicit SemanticVersion(const std::string &_v);
public: SemanticVersion(const SemanticVersion &_copy);
public: SemanticVersion &operator=(const SemanticVersion &_other);
public: SemanticVersion(const unsigned int _major,
const unsigned int _minor = 0,
const unsigned int _patch = 0,
const std::string &_prerelease = "",
const std::string &_build = "");
public: ~SemanticVersion();
public: bool Parse(const std::string &_versionStr);
public: std::string Version() const;
public: unsigned int Major() const;
public: unsigned int Minor() const;
public: unsigned int Patch() const;
public: std::string Prerelease() const;
public: std::string Build() const;
public: bool operator<(const SemanticVersion &_other) const;
public: bool operator<=(const SemanticVersion &_other) const;
public: bool operator>(const SemanticVersion &_other) const;
public: bool operator>=(const SemanticVersion &_other) const;
public: bool operator==(const SemanticVersion &_other) const;
public: bool operator!=(const SemanticVersion &_other) const;
public: friend std::ostream &operator<<(std::ostream &_out,
const SemanticVersion &_v)
{
_out << _v.Version();
return _out;
}
private: std::unique_ptr<SemanticVersionPrivate> dataPtr;
};
}
}
#endif
gazebo::common::SemanticVersion::Minor
unsigned int Minor() const
Get the minor number.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
common
common
Definition: FuelModelDatabase.hh:37
gazebo::common::SemanticVersion::Parse
bool Parse(const std::string &_versionStr)
Parse a version string and set the major, minor, patch numbers, and prerelease and build strings.
system.hh
gazebo::common::SemanticVersion::operator==
bool operator==(const SemanticVersion &_other) const
Equality comparison operator.
gazebo::common::SemanticVersion::operator<
bool operator<(const SemanticVersion &_other) const
Less than comparison operator.
gazebo::common::SemanticVersion::Major
unsigned int Major() const
Get the major number.
gazebo::common::SemanticVersion::operator>
bool operator>(const SemanticVersion &_other) const
Greater than comparison operator.
gazebo::common::SemanticVersion::operator<<
friend std::ostream & operator<<(std::ostream &_out, const SemanticVersion &_v)
Stream insertion operator.
Definition: SemanticVersion.hh:139
gazebo::common::SemanticVersion::Patch
unsigned int Patch() const
Get the patch number.
gazebo::common::SemanticVersion::operator=
SemanticVersion & operator=(const SemanticVersion &_other)
Assignment operator.
gazebo::common::SemanticVersion::~SemanticVersion
~SemanticVersion()
Destructor.
gazebo::common::SemanticVersion::Version
std::string Version() const
Returns the version as a string.
gazebo::common::SemanticVersion::Prerelease
std::string Prerelease() const
Get the prerelease string.
gazebo::common::SemanticVersion::Build
std::string Build() const
Get the build metadata string.
gazebo::common::SemanticVersion::operator>=
bool operator>=(const SemanticVersion &_other) const
Greater than or equal comparison operator.
gazebo::common::SemanticVersion::operator!=
bool operator!=(const SemanticVersion &_other) const
Inequality comparison operator.
gazebo::common::SemanticVersion::SemanticVersion
SemanticVersion()
Default constructor.
gazebo::common::SemanticVersion::operator<=
bool operator<=(const SemanticVersion &_other) const
Less than or equal comparison operator.
gazebo::common::SemanticVersion
Version comparison class based on Semantic Versioning 2.0.0 http://semver.org/ Compares versions and ...
Definition: SemanticVersion.hh:38