Google Cloud C++ Client  0.4.0
C++ Client Library for Google Cloud Platform
version.h
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H_
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H_
17 
18 #include "google/cloud/internal/port_platform.h"
19 #include "google/cloud/internal/version_info.h"
20 #include <string>
21 
22 #define GOOGLE_CLOUD_CPP_VCONCAT(Ma, Mi) v##Ma
23 #define GOOGLE_CLOUD_CPP_VEVAL(Ma, Mi) GOOGLE_CLOUD_CPP_VCONCAT(Ma, Mi)
24 #define GOOGLE_CLOUD_CPP_NS
25  GOOGLE_CLOUD_CPP_VEVAL(GOOGLE_CLOUD_CPP_VERSION_MAJOR,
26  GOOGLE_CLOUD_CPP_VERSION_MINOR)
27 
28 namespace google {
29 /**
30  * Contains all the Google Cloud C++ Library APIs.
31  */
32 namespace cloud {
33 /**
34  * The Google Cloud C++ Library inlined, versioned namespace.
35  *
36  * Applications may need to link multiple versions of the Google Cloud C++
37  * Libraries, for example, if they link a library that uses an older version of
38  * the libraries than they do. This namespace is inlined, so applications can
39  * use `google::cloud::Foo` in their source, but the symbols are versioned,
40  * i.e., the symbol becomes `google::cloud::v1::Foo`.
41  *
42  * Note that, consistent with the semver.org guidelines, the v0 version makes
43  * no guarantees with respect to backwards compatibility.
44  */
45 inline namespace GOOGLE_CLOUD_CPP_NS {
46 /**
47  * The Google Cloud Storage C++ Client major version.
48  *
49  * @see https://semver.org/spec/v2.0.0.html for details.
50  */
51 int constexpr version_major() { return GOOGLE_CLOUD_CPP_VERSION_MAJOR; }
52 
53 /**
54  * The Google Cloud Storage C++ Client minor version.
55  *
56  * @see https://semver.org/spec/v2.0.0.html for details.
57  */
58 int constexpr version_minor() { return GOOGLE_CLOUD_CPP_VERSION_MINOR; }
59 
60 /**
61  * The Google Cloud Storage C++ Client patch version.
62  *
63  * @see https://semver.org/spec/v2.0.0.html for details.
64  */
65 int constexpr version_patch() { return GOOGLE_CLOUD_CPP_VERSION_PATCH; }
66 
67 /// A single integer representing the Major/Minor/Patch version.
68 int constexpr version() {
69  return 100 * (100 * version_major() + version_minor()) + version_patch();
70 }
71 
72 /// The version as a string, in MAJOR.MINOR.PATCH+gitrev format.
73 std::string version_string();
74 
75 } // namespace GOOGLE_CLOUD_CPP_NS
76 } // namespace cloud
77 } // namespace google
78 
79 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_VERSION_H_
#define GOOGLE_CLOUD_CPP_VEVAL(Ma, Mi)
Definition: version.h:23
#define GOOGLE_CLOUD_CPP_NS
Definition: version.h:24
Contains all the Google Cloud C++ Library APIs.
Definition: iam_bindings.cc:21
#define GOOGLE_CLOUD_CPP_VCONCAT(Ma, Mi)
Definition: version.h:22
int constexpr version_patch()
The Google Cloud Storage C++ Client patch version.
Definition: version.h:65
int constexpr version_major()
The Google Cloud Storage C++ Client major version.
Definition: version.h:51
int constexpr version_minor()
The Google Cloud Storage C++ Client minor version.
Definition: version.h:58
std::string version_string()
The version as a string, in MAJOR.MINOR.PATCH+gitrev format.
int constexpr version()
A single integer representing the Major/Minor/Patch version.
Definition: version.h:68