forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.h
105 lines (92 loc) · 4.01 KB
/
version.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H
#include "google/cloud/internal/attributes.h"
#include "google/cloud/internal/port_platform.h"
#include "google/cloud/internal/version_info.h"
#include <string>
#define GOOGLE_CLOUD_CPP_IAM_DEPRECATED \
GOOGLE_CLOUD_CPP_DEPRECATED( \
"this type predates IAM conditions and does not work with policies " \
"that include IAM conditions. The functions that use this type are " \
"deprecated and will be be removed on 2022-04-01 or shortly " \
"after. See GitHub issue #5929 for more information.")
#define GOOGLE_CLOUD_CPP_VCONCAT(Ma, Mi) v##Ma
#define GOOGLE_CLOUD_CPP_VEVAL(Ma, Mi) GOOGLE_CLOUD_CPP_VCONCAT(Ma, Mi)
#define GOOGLE_CLOUD_CPP_NS \
GOOGLE_CLOUD_CPP_VEVAL(GOOGLE_CLOUD_CPP_VERSION_MAJOR, \
GOOGLE_CLOUD_CPP_VERSION_MINOR)
#define GOOGLE_CLOUD_CPP_GENERATED_VCONCAT(Ma, Mi) gcpcxxV##Ma
#define GOOGLE_CLOUD_CPP_GENERATED_VEVAL(Ma, Mi) \
GOOGLE_CLOUD_CPP_GENERATED_VCONCAT(Ma, Mi)
#define GOOGLE_CLOUD_CPP_GENERATED_NS \
GOOGLE_CLOUD_CPP_GENERATED_VEVAL(GOOGLE_CLOUD_CPP_VERSION_MAJOR, \
GOOGLE_CLOUD_CPP_VERSION_MINOR)
namespace google {
/**
* Contains all the Google Cloud C++ Library APIs.
*/
namespace cloud {
/**
* The Google Cloud C++ Library inlined, versioned namespace.
*
* Applications may need to link multiple versions of the Google Cloud C++
* Libraries, for example, if they link a library that uses an older version of
* the libraries than they do. This namespace is inlined, so applications can
* use `google::cloud::Foo` in their source, but the symbols are versioned,
* i.e., the symbol becomes `google::cloud::v1::Foo`.
*
* Note that, consistent with the semver.org guidelines, the v0 version makes
* no guarantees with respect to backwards compatibility.
*/
inline namespace GOOGLE_CLOUD_CPP_NS {
/**
* The Google Cloud Storage C++ Client major version.
*
* @see https://semver.org/spec/v2.0.0.html for details.
*/
int constexpr version_major() { return GOOGLE_CLOUD_CPP_VERSION_MAJOR; }
/**
* The Google Cloud Storage C++ Client minor version.
*
* @see https://semver.org/spec/v2.0.0.html for details.
*/
int constexpr version_minor() { return GOOGLE_CLOUD_CPP_VERSION_MINOR; }
/**
* The Google Cloud Storage C++ Client patch version.
*
* @see https://semver.org/spec/v2.0.0.html for details.
*/
int constexpr version_patch() { return GOOGLE_CLOUD_CPP_VERSION_PATCH; }
namespace internal {
auto constexpr kMaxMinorVersions = 100;
auto constexpr kMaxPatchVersions = 100;
} // namespace internal
/// A single integer representing the Major/Minor/Patch version.
int constexpr version() {
static_assert(version_minor() < internal::kMaxMinorVersions,
"version_minor() should be < kMaxMinorVersions");
static_assert(version_patch() < internal::kMaxPatchVersions,
"version_patch() should be < kMaxPatchVersions");
return internal::kMaxPatchVersions *
(internal::kMaxMinorVersions * version_major() + version_minor()) +
version_patch();
}
/// The version as a string, in MAJOR.MINOR.PATCH+gitrev format.
std::string version_string();
} // namespace GOOGLE_CLOUD_CPP_NS
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H