OpenCPN Partial API docs
semantic_vers.h
1 /******************************************************************************
2  *
3  * Project: OpenCPN
4  *
5  ***************************************************************************
6  * Copyright (C) 2019 Alec Leamas *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  ***************************************************************************
23  */
24 
25 #ifndef SEMANTIC_VERSION_H_GUARD
26 #define SEMANTIC_VERSION_H_GUARD
27 
28 #include <sstream>
29 
30 #include "config.h"
31 
32 #undef major // work around gnu's major() and minor() macros.
33 #undef minor
34 
52  int major;
53  int minor;
54  int patch;
55  int post; // Post-release number e. g., downstream packaging.
56  std::string pre; // Pre-release tag like alfa.
57  std::string build; // Build info
58 
61 
62  SemanticVersion(int major, int minor, int rev = 0, int post = 0,
63  std::string pre = "", std::string build = "");
64 
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  bool operator!=(const SemanticVersion& other);
71 
73  std::string to_string();
74 
76  static SemanticVersion parse(std::string s);
77 };
78 
80 std::ostream& operator<<(std::ostream& s, const SemanticVersion& v);
81 
82 #endif // SEMANTIC_VERSION_H_GUARD
Versions uses a modified semantic versioning scheme: major.minor.revision.post-tag+build.
Definition: semantic_vers.h:51
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.