Transfer Ease
Loading...
Searching...
No Matches
semver.h
1#ifndef SEMVER_H
2#define SEMVER_H
3
4#include "transferease/transferease_global.h"
5
6#include <memory>
7#include <string>
8
9/*****************************/
10/* Namespace instructions */
11/*****************************/
12namespace tease{
13
14/*****************************/
15/* Class definitions */
16/*****************************/
17class TEASE_EXPORT Semver
18{
19
20public:
24 enum Field
25 {
26 SEMVER_MAJOR = 0,
30 SEMVER_NB_FIELDS
31 };
32
33public:
34 Semver();
35 Semver(int major, int minor, int patch);
36 Semver(const std::string &semver, char delimiter);
37
38 Semver(const Semver &other);
39 Semver(Semver &&other) noexcept;
40
41 virtual ~Semver();
42
43public:
44 void setField(Field idField, int value);
45 void clear();
46
47public:
48 int getField(Field idField) const;
49 bool isValid() const;
50
51public:
52 std::string toString(char delimiter, int widthField) const;
53 bool parseString(const std::string &version, char delimiter);
54
55public:
56 Semver& operator=(const Semver &other);
57 Semver& operator=(Semver &&other) noexcept;
58
59public:
60 TEASE_EXPORT friend bool operator==(const Semver &left, const Semver &right);
61 TEASE_EXPORT friend bool operator!=(const Semver &left, const Semver &right);
62 TEASE_EXPORT friend bool operator<(const Semver &left, const Semver &right);
63 TEASE_EXPORT friend bool operator<=(const Semver &left, const Semver &right);
64 TEASE_EXPORT friend bool operator>(const Semver &left, const Semver &right);
65 TEASE_EXPORT friend bool operator>=(const Semver &left, const Semver &right);
66
67public:
68 static const Semver& getLibraryVersion();
69
70private:
71 class Impl;
72 std::unique_ptr<Impl> d_ptr;
73};
74
75/*****************************/
76/* End namespaces */
77/*****************************/
78
79} // namespace tease
80
81/*****************************/
82/* End file */
83/*****************************/
84
85#endif // SEMVER_H
Allow to manage semantic version informations.
Definition semver.h:18
Field
Field of semantic versionning.
Definition semver.h:25
@ SEMVER_PATCH
Definition semver.h:28
@ SEMVER_MINOR
Definition semver.h:27