MRPT  1.9.9
xsversion.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef XSVERSION_H
10 #define XSVERSION_H
11 
12 #include "xsstring.h"
13 #include "xstypesconfig.h"
14 
15 typedef struct XsVersion XsVersion;
16 
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #else
21 #define XSVERSION_INITIALIZER \
22  { \
23  0, 0, 0, 0, XsString_INITIALIZER \
24  }
25 #endif
26 
27  XSTYPES_DLL_API int XsVersion_empty(const XsVersion* thisPtr);
29  const XsVersion* thisPtr, XsString* version);
30 
31 #ifdef __cplusplus
32 } // extern "C"
33 #endif
34 
35 struct XsVersion
36 {
37 #ifdef __cplusplus
38  //! \brief Constructs a version object using the supplied parameters or an
39  //! empty version object if no parameters are given.
40  explicit XsVersion(
41  int maj = 0, int min = 0, int rev = 0, int bld = 0,
42  const XsString& extra = XsString())
43  : m_major(maj),
44  m_minor(min),
45  m_revision(rev),
46  m_build(bld),
47  m_extra(extra)
48  {
49  }
50 
51  //! \brief Constructs a version object based upon the \a other object
52  XsVersion(const XsVersion& other)
53  : m_major(other.m_major),
54  m_minor(other.m_minor),
55  m_revision(other.m_revision),
56  m_build(other.m_build),
57  m_extra(other.m_extra)
58  {
59  }
60 
61  //! \brief Assign the version from the \a other object
62  XsVersion& operator=(const XsVersion& other)
63  {
64  m_major = other.m_major;
65  m_minor = other.m_minor;
66  m_revision = other.m_revision;
67  m_build = other.m_build;
68  m_extra = other.m_extra;
69  return *this;
70  }
71 
72  //! \brief \copybrief XsVersion_empty
73  inline bool empty() const { return 0 != XsVersion_empty(this); }
74  //! \brief \copybrief XsVersion_toString
75  inline XsString toString() const
76  {
77  XsString tmp;
78  XsVersion_toString(this, &tmp);
79  return tmp;
80  }
81 
82  //! \brief Return the \e major part of the version
83  inline int major() const { return m_major; }
84  //! \brief Return the \e minor part of the version
85  inline int minor() const { return m_minor; }
86  //! \brief Return the \e revision part of the version
87  inline int revision() const { return m_revision; }
88  //! \brief Return the \e build \e number part of the version
89  inline int build() const { return m_build; }
90  //! \brief Return the extra part of the version. This may contain custom
91  //! version details such as 'beta' or 'Mk4' to indicate the readiness and
92  //! purpose of this version of the object.
93  inline XsString extra() const { return m_extra; }
94 
95  private:
96 #endif
97 
98  /** The major part of the version number */
99  int m_major;
100  /** The minor part of the version number */
101  int m_minor;
102  /** The revision number of the version */
104  /** The build number of the version */
105  int m_build;
106  /** Storage for some extra information about the version */
108 };
109 
110 #endif // file guard
XsString m_extra
Storage for some extra information about the version.
Definition: xsversion.h:107
#define min(a, b)
struct XsVersion XsVersion
Definition: xsversion.h:15
int m_major
The major part of the version number.
Definition: xsversion.h:99
XSTYPES_DLL_API int XsVersion_empty(const XsVersion *thisPtr)
int m_minor
The minor part of the version number.
Definition: xsversion.h:101
int m_revision
The revision number of the version.
Definition: xsversion.h:103
bool empty() const
Definition: ts_hash_map.h:190
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
XSTYPES_DLL_API void XsVersion_toString(const XsVersion *thisPtr, XsString *version)
struct XsString XsString
Definition: xsstring.h:35
int m_build
The build number of the version.
Definition: xsversion.h:105



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019