Ocean
Loading...
Searching...
No Matches
Version.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_BASE_VERSION_H
9#define META_OCEAN_BASE_VERSION_H
10
11#include "ocean/base/Base.h"
12#include "ocean/base/String.h"
13
14/// The major version number of Ocean.
15#define OCEAN_VERSION_MAJOR 1
16
17/// The minor version number of Ocean.
18#define OCEAN_VERSION_MINOR 0
19
20/// The patch version number of Ocean.
21#define OCEAN_VERSION_PATCH 1
22
23/// Indicates whether this is a development or a release version.
24#define OCEAN_VERSION_IS_DEVELEOPMENT_BRANCH 1
25
26/// Combines the major, minor, patch, and development branch version numbers into a single version number.
27#define OCEAN_VERSIONIZE(major, minor, patch, isDevelopmentBranch) (major * 1000000 + minor * 1000 + patch) * 2 + (isDevelopmentBranch != 0 ? 1 : 0)
28
29/// The full version of Ocean.
30#define OCEAN_VERSION OCEAN_VERSIONIZE(OCEAN_VERSION_MAJOR, OCEAN_VERSION_MINOR, OCEAN_VERSION_PATCH, OCEAN_VERSION_IS_DEVELEOPMENT_BRANCH);
31
32namespace Ocean
33{
34
35/**
36 * This class provides version numbers for Ocean.
37 * @ingroup base
38 */
40{
41 public:
42
43 /**
44 * Returns the major version number of Ocean.
45 * @return The version
46 */
47 static constexpr unsigned int major();
48
49 /**
50 * Returns the major version number of Ocean.
51 * @return The version
52 */
53 static constexpr unsigned int minor();
54
55 /**
56 * Returns the major version number of Ocean.
57 * @return The version
58 */
59 static constexpr unsigned int patch();
60
61 /**
62 * Returns the major version number of Ocean.
63 * @return The version
64 */
65 static constexpr bool isDevelopmentBranch();
66
67 /**
68 * Returns the major version number of Ocean.
69 * @return The version
70 */
71 static constexpr unsigned int version();
72
73 /**
74 * Returns the version number of Ocean as string.
75 * @return The version
76 */
77 static inline std::string versionString();
78};
79
80constexpr unsigned int Version::major()
81{
82 return OCEAN_VERSION_MAJOR;
83}
84
85constexpr unsigned int Version::minor()
86{
87 return OCEAN_VERSION_MINOR;
88}
89
90constexpr unsigned int Version::patch()
91{
92 return OCEAN_VERSION_PATCH;
93}
94
96{
97 return OCEAN_VERSION_IS_DEVELEOPMENT_BRANCH != 0;
98}
99
100constexpr unsigned int Version::version()
101{
102 return OCEAN_VERSION;
103}
104
106{
107 return String::toAString(major()) + "." + String::toAString(minor()) + "." + String::toAString(patch()) + (isDevelopmentBranch() ? "-development" : "");
108}
109
110}
111
112#endif // META_OCEAN_BASE_VERSION_H
static std::string toAString(const char value)
Converts a value to a string with 8bit character.
This class provides version numbers for Ocean.
Definition Version.h:40
static constexpr unsigned int version()
Returns the major version number of Ocean.
Definition Version.h:100
static constexpr unsigned int major()
Returns the major version number of Ocean.
Definition Version.h:80
static std::string versionString()
Returns the version number of Ocean as string.
Definition Version.h:105
static constexpr bool isDevelopmentBranch()
Returns the major version number of Ocean.
Definition Version.h:95
static constexpr unsigned int patch()
Returns the major version number of Ocean.
Definition Version.h:90
static constexpr unsigned int minor()
Returns the major version number of Ocean.
Definition Version.h:85
The namespace covering the entire Ocean framework.
Definition Accessor.h:15