Leosac  0.8.0
Open Source Access Control
version.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
26 #ifndef VERSION_HPP
27 #define VERSION_HPP
28 
29 #include <string>
30 
31 namespace Leosac
32 {
33 namespace Tools
34 {
35 class Version
36 {
37  static const int Major = LEOSAC_VERSION_MAJOR;
38  static const int Minor = LEOSAC_VERSION_MINOR;
39  static const int Patch = LEOSAC_VERSION_PATCH;
40 
41  Version() = delete;
42 
43  public:
49  static std::string buildVersionString(int major, int minor, int patch,
50  std::string git_sha1 = "");
51 
57  static int versionCompare(std::string a, std::string b);
58 
64  static bool isVersionValid(const std::string &v);
65 
66 
70  static std::string get_short_version();
71 
77  static std::string get_full_version();
78 
79  private:
80  static const std::string validChars;
81 };
82 }
83 }
84 
85 #endif // VERSION_HPP
Leosac::Tools::Version::validChars
static const std::string validChars
Definition: version.hpp:80
Leosac::Tools::Version::get_short_version
static std::string get_short_version()
Retrieve the short (X.Y.Z) version of Leosac.
Definition: version.cpp:85
Leosac::Tools::Version::get_full_version
static std::string get_full_version()
Returns the complete version string.
Definition: version.cpp:80
Leosac::Tools::Version
Definition: version.hpp:35
Leosac::Tools::Version::buildVersionString
static std::string buildVersionString(int major, int minor, int patch, std::string git_sha1="")
return semver compatible version string formatted this way: MAJOR.MINOR.PATCH
Definition: version.cpp:34
Leosac::Tools::Version::Patch
static const int Patch
Definition: version.hpp:39
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Tools::Version::Major
static const int Major
Definition: version.hpp:37
Leosac::Tools::Version::versionCompare
static int versionCompare(std::string a, std::string b)
compare two version strings using semver v2.0.0
Definition: version.cpp:51
Leosac::Tools::Version::Version
Version()=delete
Leosac::Tools::Version::Minor
static const int Minor
Definition: version.hpp:38
Leosac::Tools::Version::isVersionValid
static bool isVersionValid(const std::string &v)
check validity of a semver version string
Definition: version.cpp:74