Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
version.cc
Go to the documentation of this file.
1 // Copyright 2019 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 
16 #include "google/cloud/spanner/internal/build_info.h"
17 #include "google/cloud/internal/build_info.h"
18 #include <sstream>
19 
20 namespace google {
21 namespace cloud {
22 namespace spanner {
23 inline namespace SPANNER_CLIENT_NS {
24 std::string VersionString() {
25  static std::string const kVersion = [] {
26  std::ostringstream os;
27  os << "v" << VersionMajor() << "." << VersionMinor() << "."
28  << VersionPatch();
29  auto metadata = internal::BuildMetadata();
30  if (!metadata.empty()) {
31  os << "+" << metadata;
32  }
33  return os.str();
34  }();
35  return kVersion;
36 }
37 } // namespace SPANNER_CLIENT_NS
38 } // namespace spanner
39 } // namespace cloud
40 } // namespace google
std::string VersionString()
The version as a string, in MAJOR.MINOR.PATCH+gitrev format.
Definition: version.cc:24
int constexpr VersionMajor()
The Cloud spanner C++ Client major version.
Definition: version.h:48
int constexpr VersionPatch()
The Cloud spanner C++ Client patch version.
Definition: version.h:58
Contains all the Cloud Spanner C++ client types and functions.
#define SPANNER_CLIENT_NS
Definition: version.h:22
int constexpr VersionMinor()
The Cloud spanner C++ Client minor version.
Definition: version.h:53