OpenCPN Partial API docs
Loading...
Searching...
No Matches
semantic_vers.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2019 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#ifndef SEMANTIC_VERSION_H_GUARD
25#define SEMANTIC_VERSION_H_GUARD
26
27#include <sstream>
28
29#include "config.h"
30
31#undef major // work around gnu's major() and minor() macros.
32#undef minor
33
51 int major;
52 int minor;
53 int patch;
54 int post; // Post-release number e. g., downstream packaging.
55 std::string pre; // Pre-release tag like alfa.
56 std::string build; // Build info
57
60
61 SemanticVersion(int major, int minor, int rev = 0, int post = 0,
62 std::string pre = "", std::string build = "");
63
64 bool operator<(const SemanticVersion& other);
65 bool operator==(const SemanticVersion& other);
66 bool operator>(const SemanticVersion& other);
67 bool operator<=(const SemanticVersion& other);
68 bool operator>=(const SemanticVersion& other);
69 bool operator!=(const SemanticVersion& other);
70
72 std::string to_string();
73
75 static SemanticVersion parse(std::string s);
76};
77
79std::ostream& operator<<(std::ostream& s, const SemanticVersion& v);
80
81#endif // SEMANTIC_VERSION_H_GUARD
std::ostream & operator<<(std::ostream &s, const SemanticVersion &v)
Dump version string.
Versions uses a modified semantic versioning scheme: major.minor.revision.post-tag+build.
SemanticVersion()
Construct a "0.0.0.0" version.
static SemanticVersion parse(std::string s)
Parse a version string, sets major == -1 on errors.
std::string to_string()
Return printable representation.