|
|
|||
File indexing completed on 2026-09-19 09:23:23
0001 // Protocol Buffers - Google's data interchange format 0002 // Copyright 2008 Google Inc. All rights reserved. 0003 // 0004 // Use of this source code is governed by a BSD-style 0005 // license that can be found in the LICENSE file or at 0006 // https://developers.google.com/open-source/licenses/bsd 0007 0008 // Author: kenton@google.com (Kenton Varda) and others 0009 // 0010 // Contains basic types and utilities used by the rest of the library. 0011 0012 #ifndef GOOGLE_PROTOBUF_COMMON_H__ 0013 #define GOOGLE_PROTOBUF_COMMON_H__ 0014 0015 #include <algorithm> 0016 #include <memory> 0017 #include <string> 0018 #include <vector> 0019 0020 #include "absl/strings/string_view.h" 0021 #include "google/protobuf/stubs/platform_macros.h" 0022 #include "google/protobuf/stubs/port.h" 0023 0024 #if defined(__APPLE__) 0025 #include <TargetConditionals.h> // for TARGET_OS_IPHONE 0026 #endif 0027 0028 #if defined(__ANDROID__) || defined(GOOGLE_PROTOBUF_OS_ANDROID) || \ 0029 (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ 0030 defined(GOOGLE_PROTOBUF_OS_IPHONE) 0031 #include <pthread.h> 0032 #endif 0033 0034 #include "google/protobuf/port_def.inc" 0035 0036 namespace std {} 0037 0038 namespace google { 0039 namespace protobuf { 0040 namespace internal { 0041 0042 // Some of these constants are macros rather than const ints so that they can 0043 // be used in #if directives. 0044 0045 // The current version, represented as a single integer to make comparison 0046 // easier: major * 10^6 + minor * 10^3 + micro 0047 #define GOOGLE_PROTOBUF_VERSION 6032001 0048 0049 // A suffix string for alpha, beta or rc releases. Empty for stable releases. 0050 #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" 0051 0052 // Verifies that the protobuf version a program was compiled with matches what 0053 // it is linked/running with. Use the macro below to call this function. 0054 void PROTOBUF_EXPORT VerifyVersion(int protobufVersionCompiledWith, 0055 const char* filename); 0056 0057 // Converts a numeric version number to a string. 0058 std::string PROTOBUF_EXPORT 0059 VersionString(int version); // NOLINT(runtime/string) 0060 0061 // Prints the protoc compiler version (no major version) 0062 std::string PROTOBUF_EXPORT 0063 ProtocVersionString(int version); // NOLINT(runtime/string) 0064 0065 } // namespace internal 0066 0067 // Place this macro in your main() function (or somewhere before you attempt 0068 // to use the protobuf library) to verify that the version you link against 0069 // matches the headers you compiled against. If a version mismatch is 0070 // detected, the process will abort. 0071 #define GOOGLE_PROTOBUF_VERIFY_VERSION \ 0072 ::google::protobuf::internal::VerifyVersion(GOOGLE_PROTOBUF_VERSION, __FILE__) 0073 0074 // This lives in message_lite.h now, but we leave this here for any users that 0075 // #include common.h and not message_lite.h. 0076 PROTOBUF_EXPORT void ShutdownProtobufLibrary(); 0077 0078 namespace internal { 0079 0080 // Strongly references the given variable such that the linker will be forced 0081 // to pull in this variable's translation unit. 0082 template <typename T> 0083 void StrongReference(const T& var) { 0084 auto volatile unused = &var; 0085 (void)&unused; // Use address to avoid an extra load of "unused". 0086 } 0087 0088 } // namespace internal 0089 } // namespace protobuf 0090 } // namespace google 0091 0092 #include "google/protobuf/port_undef.inc" 0093 0094 #endif // GOOGLE_PROTOBUF_COMMON_H__
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|