FEDEM Solver  R8.0
Source code of the dynamics solver
FFaVersionNumber.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFA_VERSION_NUMBER_H
9 #define FFA_VERSION_NUMBER_H
10 
11 #include <string>
12 
13 
22 {
23 public:
25  FFaVersionNumber(int n1 = 0, int n2 = 0, int n3 = 0, int n4 = -1);
27  FFaVersionNumber(const std::string& s) { this->parseLine(s); }
28 
30  void setVersion(int n1, int n2 = 0, int n3 = 0, int n4 = -1);
32  void parseLine(const std::string& line, char skipUntil = '\0');
33 
35  void set(int i, int n);
37  int get(int i) const;
38 
40  const std::string& getString() const { return version; }
42  std::string getInterpretedString() const;
43 
45  bool operator> (const FFaVersionNumber& v) const;
47  bool operator==(const FFaVersionNumber& v) const;
49  bool operator>=(const FFaVersionNumber& v) const;
51  bool operator< (const FFaVersionNumber& v) const;
53  bool operator<=(const FFaVersionNumber& v) const;
54 
55 private:
56  int d1;
57  int d2;
58  int d3;
59  int build;
60  std::string version;
61 };
62 
63 #endif
A class to keep Fedem version numbers.
Definition: FFaVersionNumber.H:22
void setVersion(int n1, int n2=0, int n3=0, int n4=-1)
Sets the version number.
Definition: FFaVersionNumber.C:20
bool operator<=(const FFaVersionNumber &v) const
Less than or equal to operator.
Definition: FFaVersionNumber.C:189
bool operator==(const FFaVersionNumber &v) const
Equality operator.
Definition: FFaVersionNumber.C:171
std::string getInterpretedString() const
Returns a converted string representation of this version number.
Definition: FFaVersionNumber.C:37
int get(int i) const
returns the major-, minor- or patch version or the build number.
Definition: FFaVersionNumber.C:136
int d2
Minor version number.
Definition: FFaVersionNumber.H:57
const std::string & getString() const
Returns the string representation of this version number.
Definition: FFaVersionNumber.H:40
std::string version
String representation of the version number.
Definition: FFaVersionNumber.H:60
int d3
Patch version number.
Definition: FFaVersionNumber.H:58
void parseLine(const std::string &line, char skipUntil='\0')
Parses a version number from the provided string.
Definition: FFaVersionNumber.C:46
bool operator>=(const FFaVersionNumber &v) const
Greater or equal to operator.
Definition: FFaVersionNumber.C:177
FFaVersionNumber(int n1=0, int n2=0, int n3=0, int n4=-1)
Default constructor.
Definition: FFaVersionNumber.C:14
bool operator>(const FFaVersionNumber &v) const
Greater than operator.
Definition: FFaVersionNumber.C:148
void set(int i, int n)
Sets the major-, minor- or patch version or the build number.
Definition: FFaVersionNumber.C:125
int d1
Major version number.
Definition: FFaVersionNumber.H:56
bool operator<(const FFaVersionNumber &v) const
Less than operator.
Definition: FFaVersionNumber.C:183
int build
Internal build number.
Definition: FFaVersionNumber.H:59
FFaVersionNumber(const std::string &s)
Constructor initializing the version number from a string.
Definition: FFaVersionNumber.H:27