ZTWHHH commited on
Commit
fd52fe2
·
verified ·
1 Parent(s): 49118f5

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_quantize_model.so +3 -0
  3. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_map_field.h +73 -0
  4. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_message.h +94 -0
  5. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_repeated_message_field.h +77 -0
  6. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/context.h +113 -0
  7. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/enum_field.h +162 -0
  8. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/enum_lite.h +98 -0
  9. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/extension.h +115 -0
  10. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/field.h +190 -0
  11. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/file.h +126 -0
  12. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/generator.h +77 -0
  13. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/generator_factory.h +103 -0
  14. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/helpers.h +474 -0
  15. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/java_generator.h +6 -0
  16. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/kotlin_generator.h +74 -0
  17. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/map_field_lite.h +74 -0
  18. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message.h +155 -0
  19. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_builder.h +95 -0
  20. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_field.h +180 -0
  21. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_field_lite.h +141 -0
  22. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/name_resolver.h +159 -0
  23. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/names.h +100 -0
  24. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/primitive_field.h +163 -0
  25. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/primitive_field_lite.h +141 -0
  26. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/shared_code_generator.h +90 -0
  27. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/string_field.h +160 -0
  28. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/string_field_lite.h +139 -0
  29. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/bytestream.h +351 -0
  30. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/callback.h +583 -0
  31. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/casts.h +138 -0
  32. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/common.h +197 -0
  33. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/hash.h +114 -0
  34. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/int128.h +387 -0
  35. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/logging.h +239 -0
  36. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/macros.h +93 -0
  37. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/map_util.h +769 -0
  38. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/mathutil.h +162 -0
  39. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/mutex.h +218 -0
  40. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/once.h +55 -0
  41. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/platform_macros.h +138 -0
  42. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/port.h +413 -0
  43. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/status.h +196 -0
  44. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/status_macros.h +89 -0
  45. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/statusor.h +253 -0
  46. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stl_util.h +90 -0
  47. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stringpiece.h +402 -0
  48. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stringprintf.h +85 -0
  49. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/strutil.h +950 -0
  50. videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/substitute.h +178 -0
.gitattributes CHANGED
@@ -900,3 +900,4 @@ videochat2/lib/python3.10/site-packages/tensorflow/python/keras/__pycache__/metr
900
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/__pycache__/gen_xla_ops.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
901
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2tensorrt/_pywrap_py_utils.so filter=lfs diff=lfs merge=lfs -text
902
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_function_lib.so filter=lfs diff=lfs merge=lfs -text
 
 
900
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/__pycache__/gen_xla_ops.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
901
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2tensorrt/_pywrap_py_utils.so filter=lfs diff=lfs merge=lfs -text
902
  videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_function_lib.so filter=lfs diff=lfs merge=lfs -text
903
+ videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_quantize_model.so filter=lfs diff=lfs merge=lfs -text
videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_quantize_model.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c9dade23874da18741fd25da2bfaaf11f3136de0da956dc888cd4be1c387d4f
3
+ size 2140025
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_map_field.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__
33
+
34
+ #include <google/protobuf/compiler/code_generator.h>
35
+ #include <google/protobuf/compiler/csharp/csharp_field_base.h>
36
+
37
+ namespace google {
38
+ namespace protobuf {
39
+ namespace compiler {
40
+ namespace csharp {
41
+
42
+ class MapFieldGenerator : public FieldGeneratorBase {
43
+ public:
44
+ MapFieldGenerator(const FieldDescriptor* descriptor,
45
+ int presenceIndex,
46
+ const Options* options);
47
+ ~MapFieldGenerator();
48
+
49
+ MapFieldGenerator(const MapFieldGenerator&) = delete;
50
+ MapFieldGenerator& operator=(const MapFieldGenerator&) = delete;
51
+
52
+ virtual void GenerateCloningCode(io::Printer* printer) override;
53
+ virtual void GenerateFreezingCode(io::Printer* printer) override;
54
+ virtual void GenerateMembers(io::Printer* printer) override;
55
+ virtual void GenerateMergingCode(io::Printer* printer) override;
56
+ virtual void GenerateParsingCode(io::Printer* printer) override;
57
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override;
58
+ virtual void GenerateSerializationCode(io::Printer* printer) override;
59
+ virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override;
60
+ virtual void GenerateSerializedSizeCode(io::Printer* printer) override;
61
+
62
+ virtual void WriteHash(io::Printer* printer) override;
63
+ virtual void WriteEquals(io::Printer* printer) override;
64
+ virtual void WriteToString(io::Printer* printer) override;
65
+ };
66
+
67
+ } // namespace csharp
68
+ } // namespace compiler
69
+ } // namespace protobuf
70
+ } // namespace google
71
+
72
+ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__
73
+
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_message.h ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__
33
+
34
+ #include <string>
35
+ #include <vector>
36
+
37
+ #include <google/protobuf/compiler/code_generator.h>
38
+ #include <google/protobuf/compiler/csharp/csharp_source_generator_base.h>
39
+ #include <google/protobuf/compiler/csharp/csharp_helpers.h>
40
+
41
+ namespace google {
42
+ namespace protobuf {
43
+ namespace compiler {
44
+ namespace csharp {
45
+
46
+ class FieldGeneratorBase;
47
+
48
+ class MessageGenerator : public SourceGeneratorBase {
49
+ public:
50
+ MessageGenerator(const Descriptor* descriptor, const Options* options);
51
+ ~MessageGenerator();
52
+
53
+ MessageGenerator(const MessageGenerator&) = delete;
54
+ MessageGenerator& operator=(const MessageGenerator&) = delete;
55
+
56
+ void GenerateCloningCode(io::Printer* printer);
57
+ void GenerateFreezingCode(io::Printer* printer);
58
+ void GenerateFrameworkMethods(io::Printer* printer);
59
+ void Generate(io::Printer* printer);
60
+
61
+ private:
62
+ const Descriptor* descriptor_;
63
+ std::vector<const FieldDescriptor*> fields_by_number_;
64
+ int has_bit_field_count_;
65
+ uint end_tag_;
66
+ bool has_extension_ranges_;
67
+
68
+ void GenerateMessageSerializationMethods(io::Printer* printer);
69
+ void GenerateWriteToBody(io::Printer* printer, bool use_write_context);
70
+ void GenerateMergingMethods(io::Printer* printer);
71
+ void GenerateMainParseLoop(io::Printer* printer, bool use_parse_context);
72
+
73
+ int GetPresenceIndex(const FieldDescriptor* descriptor);
74
+ FieldGeneratorBase* CreateFieldGeneratorInternal(
75
+ const FieldDescriptor* descriptor);
76
+
77
+ bool HasNestedGeneratedTypes();
78
+
79
+ void AddDeprecatedFlag(io::Printer* printer);
80
+ void AddSerializableAttribute(io::Printer* printer);
81
+
82
+ std::string class_name();
83
+ std::string full_class_name();
84
+
85
+ // field descriptors sorted by number
86
+ const std::vector<const FieldDescriptor*>& fields_by_number();
87
+ };
88
+
89
+ } // namespace csharp
90
+ } // namespace compiler
91
+ } // namespace protobuf
92
+ } // namespace google
93
+
94
+ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/csharp/csharp_repeated_message_field.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__
33
+
34
+ #include <google/protobuf/compiler/code_generator.h>
35
+ #include <google/protobuf/compiler/csharp/csharp_field_base.h>
36
+
37
+ namespace google {
38
+ namespace protobuf {
39
+ namespace compiler {
40
+ namespace csharp {
41
+
42
+ struct Options;
43
+
44
+ class RepeatedMessageFieldGenerator : public FieldGeneratorBase {
45
+ public:
46
+ RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
47
+ int presenceIndex,
48
+ const Options *options);
49
+ ~RepeatedMessageFieldGenerator();
50
+
51
+ RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete;
52
+ RepeatedMessageFieldGenerator& operator=(
53
+ const RepeatedMessageFieldGenerator&) = delete;
54
+
55
+ virtual void GenerateCloningCode(io::Printer* printer) override;
56
+ virtual void GenerateFreezingCode(io::Printer* printer) override;
57
+ virtual void GenerateMembers(io::Printer* printer) override;
58
+ virtual void GenerateMergingCode(io::Printer* printer) override;
59
+ virtual void GenerateParsingCode(io::Printer* printer) override;
60
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override;
61
+ virtual void GenerateSerializationCode(io::Printer* printer) override;
62
+ virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override;
63
+ virtual void GenerateSerializedSizeCode(io::Printer* printer) override;
64
+ virtual void GenerateExtensionCode(io::Printer* printer) override;
65
+
66
+ virtual void WriteHash(io::Printer* printer) override;
67
+ virtual void WriteEquals(io::Printer* printer) override;
68
+ virtual void WriteToString(io::Printer* printer) override;
69
+ };
70
+
71
+ } // namespace csharp
72
+ } // namespace compiler
73
+ } // namespace protobuf
74
+ } // namespace google
75
+
76
+ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__
77
+
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/context.h ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_CONTEXT_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_CONTEXT_H__
33
+
34
+ #include <map>
35
+ #include <memory>
36
+ #include <vector>
37
+
38
+ #include <google/protobuf/stubs/common.h>
39
+ #include <google/protobuf/compiler/java/options.h>
40
+
41
+ namespace google {
42
+ namespace protobuf {
43
+ class FileDescriptor;
44
+ class FieldDescriptor;
45
+ class OneofDescriptor;
46
+ class Descriptor;
47
+ class EnumDescriptor;
48
+ namespace compiler {
49
+ namespace java {
50
+ class ClassNameResolver; // name_resolver.h
51
+ }
52
+ } // namespace compiler
53
+ } // namespace protobuf
54
+ } // namespace google
55
+
56
+ namespace google {
57
+ namespace protobuf {
58
+ namespace compiler {
59
+ namespace java {
60
+
61
+ struct FieldGeneratorInfo;
62
+ struct OneofGeneratorInfo;
63
+ // A context object holds the information that is shared among all code
64
+ // generators.
65
+ class Context {
66
+ public:
67
+ Context(const FileDescriptor* file, const Options& options);
68
+ ~Context();
69
+
70
+ // Get the name resolver associated with this context. The resolver
71
+ // can be used to map descriptors to Java class names.
72
+ ClassNameResolver* GetNameResolver() const;
73
+
74
+ // Get the FieldGeneratorInfo for a given field.
75
+ const FieldGeneratorInfo* GetFieldGeneratorInfo(
76
+ const FieldDescriptor* field) const;
77
+
78
+ // Get the OneofGeneratorInfo for a given oneof.
79
+ const OneofGeneratorInfo* GetOneofGeneratorInfo(
80
+ const OneofDescriptor* oneof) const;
81
+
82
+ const Options& options() const { return options_; }
83
+
84
+ // Enforces all the files (including transitive dependencies) to use
85
+ // LiteRuntime.
86
+
87
+ bool EnforceLite() const { return options_.enforce_lite; }
88
+
89
+ // Does this message class have generated parsing, serialization, and other
90
+ // standard methods for which reflection-based fallback implementations exist?
91
+ bool HasGeneratedMethods(const Descriptor* descriptor) const;
92
+
93
+ private:
94
+ void InitializeFieldGeneratorInfo(const FileDescriptor* file);
95
+ void InitializeFieldGeneratorInfoForMessage(const Descriptor* message);
96
+ void InitializeFieldGeneratorInfoForFields(
97
+ const std::vector<const FieldDescriptor*>& fields);
98
+
99
+ std::unique_ptr<ClassNameResolver> name_resolver_;
100
+ std::map<const FieldDescriptor*, FieldGeneratorInfo>
101
+ field_generator_info_map_;
102
+ std::map<const OneofDescriptor*, OneofGeneratorInfo>
103
+ oneof_generator_info_map_;
104
+ Options options_;
105
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Context);
106
+ };
107
+
108
+ } // namespace java
109
+ } // namespace compiler
110
+ } // namespace protobuf
111
+ } // namespace google
112
+
113
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_CONTEXT_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/enum_field.h ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/compiler/java/field.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+ class Context; // context.h
48
+ class ClassNameResolver; // name_resolver.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ } // namespace protobuf
52
+ } // namespace google
53
+
54
+ namespace google {
55
+ namespace protobuf {
56
+ namespace compiler {
57
+ namespace java {
58
+
59
+ class ImmutableEnumFieldGenerator : public ImmutableFieldGenerator {
60
+ public:
61
+ explicit ImmutableEnumFieldGenerator(const FieldDescriptor* descriptor,
62
+ int messageBitIndex, int builderBitIndex,
63
+ Context* context);
64
+ ~ImmutableEnumFieldGenerator() override;
65
+
66
+ // implements ImmutableFieldGenerator
67
+ // ---------------------------------------
68
+ int GetNumBitsForMessage() const override;
69
+ int GetNumBitsForBuilder() const override;
70
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
71
+ void GenerateMembers(io::Printer* printer) const override;
72
+ void GenerateBuilderMembers(io::Printer* printer) const override;
73
+ void GenerateInitializationCode(io::Printer* printer) const override;
74
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
75
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
76
+ void GenerateMergingCode(io::Printer* printer) const override;
77
+ void GenerateBuildingCode(io::Printer* printer) const override;
78
+ void GenerateSerializationCode(io::Printer* printer) const override;
79
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
80
+ void GenerateFieldBuilderInitializationCode(
81
+ io::Printer* printer) const override;
82
+ void GenerateEqualsCode(io::Printer* printer) const override;
83
+ void GenerateHashCode(io::Printer* printer) const override;
84
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
85
+
86
+ std::string GetBoxedType() const override;
87
+
88
+ protected:
89
+ const FieldDescriptor* descriptor_;
90
+ std::map<std::string, std::string> variables_;
91
+ ClassNameResolver* name_resolver_;
92
+
93
+ private:
94
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumFieldGenerator);
95
+ };
96
+
97
+ class ImmutableEnumOneofFieldGenerator : public ImmutableEnumFieldGenerator {
98
+ public:
99
+ ImmutableEnumOneofFieldGenerator(const FieldDescriptor* descriptor,
100
+ int messageBitIndex, int builderBitIndex,
101
+ Context* context);
102
+ ~ImmutableEnumOneofFieldGenerator() override;
103
+
104
+ void GenerateMembers(io::Printer* printer) const override;
105
+ void GenerateBuilderMembers(io::Printer* printer) const override;
106
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
107
+ void GenerateMergingCode(io::Printer* printer) const override;
108
+ void GenerateBuildingCode(io::Printer* printer) const override;
109
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
110
+ void GenerateSerializationCode(io::Printer* printer) const override;
111
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
112
+ void GenerateEqualsCode(io::Printer* printer) const override;
113
+ void GenerateHashCode(io::Printer* printer) const override;
114
+
115
+ private:
116
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldGenerator);
117
+ };
118
+
119
+ class RepeatedImmutableEnumFieldGenerator : public ImmutableFieldGenerator {
120
+ public:
121
+ explicit RepeatedImmutableEnumFieldGenerator(
122
+ const FieldDescriptor* descriptor, int messageBitIndex,
123
+ int builderBitIndex, Context* context);
124
+ ~RepeatedImmutableEnumFieldGenerator() override;
125
+
126
+ // implements ImmutableFieldGenerator ---------------------------------------
127
+ int GetNumBitsForMessage() const override;
128
+ int GetNumBitsForBuilder() const override;
129
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
130
+ void GenerateMembers(io::Printer* printer) const override;
131
+ void GenerateBuilderMembers(io::Printer* printer) const override;
132
+ void GenerateInitializationCode(io::Printer* printer) const override;
133
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
134
+ void GenerateMergingCode(io::Printer* printer) const override;
135
+ void GenerateBuildingCode(io::Printer* printer) const override;
136
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
137
+ void GenerateBuilderParsingCodeFromPacked(
138
+ io::Printer* printer) const override;
139
+ void GenerateSerializationCode(io::Printer* printer) const override;
140
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
141
+ void GenerateFieldBuilderInitializationCode(
142
+ io::Printer* printer) const override;
143
+ void GenerateEqualsCode(io::Printer* printer) const override;
144
+ void GenerateHashCode(io::Printer* printer) const override;
145
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
146
+
147
+ std::string GetBoxedType() const override;
148
+
149
+ private:
150
+ const FieldDescriptor* descriptor_;
151
+ std::map<std::string, std::string> variables_;
152
+ ClassNameResolver* name_resolver_;
153
+
154
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableEnumFieldGenerator);
155
+ };
156
+
157
+ } // namespace java
158
+ } // namespace compiler
159
+ } // namespace protobuf
160
+ } // namespace google
161
+
162
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/enum_lite.h ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__
37
+
38
+ #include <string>
39
+ #include <vector>
40
+ #include <google/protobuf/descriptor.h>
41
+
42
+ namespace google {
43
+ namespace protobuf {
44
+ namespace compiler {
45
+ namespace java {
46
+ class Context; // context.h
47
+ class ClassNameResolver; // name_resolver.h
48
+ } // namespace java
49
+ } // namespace compiler
50
+ namespace io {
51
+ class Printer; // printer.h
52
+ }
53
+ } // namespace protobuf
54
+ } // namespace google
55
+
56
+ namespace google {
57
+ namespace protobuf {
58
+ namespace compiler {
59
+ namespace java {
60
+
61
+ class EnumLiteGenerator {
62
+ public:
63
+ EnumLiteGenerator(const EnumDescriptor* descriptor, bool immutable_api,
64
+ Context* context);
65
+ ~EnumLiteGenerator();
66
+
67
+ void Generate(io::Printer* printer);
68
+
69
+ private:
70
+ const EnumDescriptor* descriptor_;
71
+
72
+ // The proto language allows multiple enum constants to have the same
73
+ // numeric value. Java, however, does not allow multiple enum constants to
74
+ // be considered equivalent. We treat the first defined constant for any
75
+ // given numeric value as "canonical" and the rest as aliases of that
76
+ // canonical value.
77
+ std::vector<const EnumValueDescriptor*> canonical_values_;
78
+
79
+ struct Alias {
80
+ const EnumValueDescriptor* value;
81
+ const EnumValueDescriptor* canonical_value;
82
+ };
83
+ std::vector<Alias> aliases_;
84
+
85
+ bool immutable_api_;
86
+
87
+ Context* context_;
88
+ ClassNameResolver* name_resolver_;
89
+
90
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumLiteGenerator);
91
+ };
92
+
93
+ } // namespace java
94
+ } // namespace compiler
95
+ } // namespace protobuf
96
+ } // namespace google
97
+
98
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/extension.h ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/stubs/common.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ class FieldDescriptor; // descriptor.h
46
+ namespace compiler {
47
+ namespace java {
48
+ class Context; // context.h
49
+ class ClassNameResolver; // name_resolver.h
50
+ } // namespace java
51
+ } // namespace compiler
52
+ namespace io {
53
+ class Printer; // printer.h
54
+ }
55
+ } // namespace protobuf
56
+ } // namespace google
57
+
58
+ namespace google {
59
+ namespace protobuf {
60
+ namespace compiler {
61
+ namespace java {
62
+
63
+ // Generates code for an extension, which may be within the scope of some
64
+ // message or may be at file scope. This is much simpler than FieldGenerator
65
+ // since extensions are just simple identifiers with interesting types.
66
+ class ExtensionGenerator {
67
+ public:
68
+ explicit ExtensionGenerator() {}
69
+ virtual ~ExtensionGenerator() {}
70
+
71
+ virtual void Generate(io::Printer* printer) = 0;
72
+
73
+ // Returns an estimate of the number of bytes the printed code will compile
74
+ // to
75
+ virtual int GenerateNonNestedInitializationCode(io::Printer* printer) = 0;
76
+
77
+ // Returns an estimate of the number of bytes the printed code will compile
78
+ // to
79
+ virtual int GenerateRegistrationCode(io::Printer* printer) = 0;
80
+
81
+ protected:
82
+ static void InitTemplateVars(
83
+ const FieldDescriptor* descriptor, const std::string& scope,
84
+ bool immutable, ClassNameResolver* name_resolver,
85
+ std::map<std::string, std::string>* vars_pointer);
86
+
87
+ private:
88
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
89
+ };
90
+
91
+ class ImmutableExtensionGenerator : public ExtensionGenerator {
92
+ public:
93
+ explicit ImmutableExtensionGenerator(const FieldDescriptor* descriptor,
94
+ Context* context);
95
+ ~ImmutableExtensionGenerator() override;
96
+
97
+ void Generate(io::Printer* printer) override;
98
+ int GenerateNonNestedInitializationCode(io::Printer* printer) override;
99
+ int GenerateRegistrationCode(io::Printer* printer) override;
100
+
101
+ protected:
102
+ const FieldDescriptor* descriptor_;
103
+ ClassNameResolver* name_resolver_;
104
+ std::string scope_;
105
+
106
+ private:
107
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableExtensionGenerator);
108
+ };
109
+
110
+ } // namespace java
111
+ } // namespace compiler
112
+ } // namespace protobuf
113
+ } // namespace google
114
+
115
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/field.h ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__
37
+
38
+ #include <cstdint>
39
+ #include <map>
40
+ #include <memory>
41
+ #include <string>
42
+
43
+ #include <google/protobuf/stubs/logging.h>
44
+ #include <google/protobuf/stubs/common.h>
45
+ #include <google/protobuf/descriptor.h>
46
+
47
+ namespace google {
48
+ namespace protobuf {
49
+ namespace compiler {
50
+ namespace java {
51
+ class Context; // context.h
52
+ class ClassNameResolver; // name_resolver.h
53
+ } // namespace java
54
+ } // namespace compiler
55
+ namespace io {
56
+ class Printer; // printer.h
57
+ }
58
+ } // namespace protobuf
59
+ } // namespace google
60
+
61
+ namespace google {
62
+ namespace protobuf {
63
+ namespace compiler {
64
+ namespace java {
65
+
66
+ class ImmutableFieldGenerator {
67
+ public:
68
+ ImmutableFieldGenerator() {}
69
+ virtual ~ImmutableFieldGenerator();
70
+
71
+ virtual int GetNumBitsForMessage() const = 0;
72
+ virtual int GetNumBitsForBuilder() const = 0;
73
+ virtual void GenerateInterfaceMembers(io::Printer* printer) const = 0;
74
+ virtual void GenerateMembers(io::Printer* printer) const = 0;
75
+ virtual void GenerateBuilderMembers(io::Printer* printer) const = 0;
76
+ virtual void GenerateInitializationCode(io::Printer* printer) const = 0;
77
+ virtual void GenerateBuilderClearCode(io::Printer* printer) const = 0;
78
+ virtual void GenerateMergingCode(io::Printer* printer) const = 0;
79
+ virtual void GenerateBuildingCode(io::Printer* printer) const = 0;
80
+ virtual void GenerateBuilderParsingCode(io::Printer* printer) const = 0;
81
+ virtual void GenerateBuilderParsingCodeFromPacked(io::Printer* printer) const;
82
+ virtual void GenerateSerializationCode(io::Printer* printer) const = 0;
83
+ virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0;
84
+ virtual void GenerateFieldBuilderInitializationCode(
85
+ io::Printer* printer) const = 0;
86
+ virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0;
87
+
88
+ virtual void GenerateEqualsCode(io::Printer* printer) const = 0;
89
+ virtual void GenerateHashCode(io::Printer* printer) const = 0;
90
+
91
+ virtual std::string GetBoxedType() const = 0;
92
+
93
+ private:
94
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldGenerator);
95
+ };
96
+
97
+ class ImmutableFieldLiteGenerator {
98
+ public:
99
+ ImmutableFieldLiteGenerator() {}
100
+ virtual ~ImmutableFieldLiteGenerator();
101
+
102
+ virtual int GetNumBitsForMessage() const = 0;
103
+ virtual void GenerateInterfaceMembers(io::Printer* printer) const = 0;
104
+ virtual void GenerateMembers(io::Printer* printer) const = 0;
105
+ virtual void GenerateBuilderMembers(io::Printer* printer) const = 0;
106
+ virtual void GenerateInitializationCode(io::Printer* printer) const = 0;
107
+ virtual void GenerateFieldInfo(io::Printer* printer,
108
+ std::vector<uint16_t>* output) const = 0;
109
+ virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0;
110
+
111
+ virtual std::string GetBoxedType() const = 0;
112
+
113
+ private:
114
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldLiteGenerator);
115
+ };
116
+
117
+
118
+ // Convenience class which constructs FieldGenerators for a Descriptor.
119
+ template <typename FieldGeneratorType>
120
+ class FieldGeneratorMap {
121
+ public:
122
+ explicit FieldGeneratorMap(const Descriptor* descriptor, Context* context);
123
+ ~FieldGeneratorMap();
124
+
125
+ const FieldGeneratorType& get(const FieldDescriptor* field) const;
126
+
127
+ private:
128
+ const Descriptor* descriptor_;
129
+ std::vector<std::unique_ptr<FieldGeneratorType>> field_generators_;
130
+
131
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
132
+ };
133
+
134
+ template <typename FieldGeneratorType>
135
+ inline const FieldGeneratorType& FieldGeneratorMap<FieldGeneratorType>::get(
136
+ const FieldDescriptor* field) const {
137
+ GOOGLE_CHECK_EQ(field->containing_type(), descriptor_);
138
+ return *field_generators_[field->index()];
139
+ }
140
+
141
+ // Instantiate template for mutable and immutable maps.
142
+ template <>
143
+ FieldGeneratorMap<ImmutableFieldGenerator>::FieldGeneratorMap(
144
+ const Descriptor* descriptor, Context* context);
145
+
146
+ template <>
147
+ FieldGeneratorMap<ImmutableFieldGenerator>::~FieldGeneratorMap();
148
+
149
+
150
+ template <>
151
+ FieldGeneratorMap<ImmutableFieldLiteGenerator>::FieldGeneratorMap(
152
+ const Descriptor* descriptor, Context* context);
153
+
154
+ template <>
155
+ FieldGeneratorMap<ImmutableFieldLiteGenerator>::~FieldGeneratorMap();
156
+
157
+
158
+ // Field information used in FieldGenerators.
159
+ struct FieldGeneratorInfo {
160
+ std::string name;
161
+ std::string capitalized_name;
162
+ std::string disambiguated_reason;
163
+ };
164
+
165
+ // Oneof information used in OneofFieldGenerators.
166
+ struct OneofGeneratorInfo {
167
+ std::string name;
168
+ std::string capitalized_name;
169
+ };
170
+
171
+ // Set some common variables used in variable FieldGenerators.
172
+ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
173
+ const FieldGeneratorInfo* info,
174
+ std::map<std::string, std::string>* variables);
175
+
176
+ // Set some common oneof variables used in OneofFieldGenerators.
177
+ void SetCommonOneofVariables(const FieldDescriptor* descriptor,
178
+ const OneofGeneratorInfo* info,
179
+ std::map<std::string, std::string>* variables);
180
+
181
+ // Print useful comments before a field's accessors.
182
+ void PrintExtraFieldInfo(const std::map<std::string, std::string>& variables,
183
+ io::Printer* printer);
184
+
185
+ } // namespace java
186
+ } // namespace compiler
187
+ } // namespace protobuf
188
+ } // namespace google
189
+
190
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/file.h ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
37
+
38
+ #include <memory>
39
+ #include <string>
40
+ #include <vector>
41
+
42
+ #include <google/protobuf/stubs/common.h>
43
+ #include <google/protobuf/compiler/java/options.h>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ class FileDescriptor; // descriptor.h
48
+ namespace io {
49
+ class Printer; // printer.h
50
+ }
51
+ namespace compiler {
52
+ class GeneratorContext; // code_generator.h
53
+ namespace java {
54
+ class Context; // context.h
55
+ class MessageGenerator; // message.h
56
+ class GeneratorFactory; // generator_factory.h
57
+ class ExtensionGenerator; // extension.h
58
+ class ClassNameResolver; // name_resolver.h
59
+ } // namespace java
60
+ } // namespace compiler
61
+ } // namespace protobuf
62
+ } // namespace google
63
+
64
+ namespace google {
65
+ namespace protobuf {
66
+ namespace compiler {
67
+ namespace java {
68
+
69
+ class FileGenerator {
70
+ public:
71
+ FileGenerator(const FileDescriptor* file, const Options& options,
72
+ bool immutable_api = true);
73
+ ~FileGenerator();
74
+
75
+ // Checks for problems that would otherwise lead to cryptic compile errors.
76
+ // Returns true if there are no problems, or writes an error description to
77
+ // the given string and returns false otherwise.
78
+ bool Validate(std::string* error);
79
+
80
+ void Generate(io::Printer* printer);
81
+
82
+ std::string GetKotlinClassname();
83
+ void GenerateKotlinSiblings(const std::string& package_dir,
84
+ GeneratorContext* generator_context,
85
+ std::vector<std::string>* file_list,
86
+ std::vector<std::string>* annotation_list);
87
+
88
+ // If we aren't putting everything into one file, this will write all the
89
+ // files other than the outer file (i.e. one for each message, enum, and
90
+ // service type).
91
+ void GenerateSiblings(const std::string& package_dir,
92
+ GeneratorContext* generator_context,
93
+ std::vector<std::string>* file_list,
94
+ std::vector<std::string>* annotation_list);
95
+
96
+ const std::string& java_package() { return java_package_; }
97
+ const std::string& classname() { return classname_; }
98
+
99
+ private:
100
+ void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer);
101
+ void GenerateDescriptorInitializationCodeForMutable(io::Printer* printer);
102
+
103
+ bool ShouldIncludeDependency(const FileDescriptor* descriptor,
104
+ bool immutable_api_);
105
+
106
+ const FileDescriptor* file_;
107
+ std::string java_package_;
108
+ std::string classname_;
109
+
110
+ std::vector<std::unique_ptr<MessageGenerator>> message_generators_;
111
+ std::vector<std::unique_ptr<ExtensionGenerator>> extension_generators_;
112
+ std::unique_ptr<GeneratorFactory> generator_factory_;
113
+ std::unique_ptr<Context> context_;
114
+ ClassNameResolver* name_resolver_;
115
+ const Options options_;
116
+ bool immutable_api_;
117
+
118
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
119
+ };
120
+
121
+ } // namespace java
122
+ } // namespace compiler
123
+ } // namespace protobuf
124
+ } // namespace google
125
+
126
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/generator.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Generates Java code for a given .proto file.
36
+
37
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
38
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
39
+
40
+ #include <string>
41
+ #include <google/protobuf/compiler/code_generator.h>
42
+
43
+ // Must be included last.
44
+ #include <google/protobuf/port_def.inc>
45
+
46
+ namespace google {
47
+ namespace protobuf {
48
+ namespace compiler {
49
+ namespace java {
50
+
51
+ // CodeGenerator implementation which generates Java code. If you create your
52
+ // own protocol compiler binary and you want it to support Java output, you
53
+ // can do so by registering an instance of this CodeGenerator with the
54
+ // CommandLineInterface in your main() function.
55
+ class PROTOC_EXPORT JavaGenerator : public CodeGenerator {
56
+ public:
57
+ JavaGenerator();
58
+ ~JavaGenerator() override;
59
+
60
+ // implements CodeGenerator ----------------------------------------
61
+ bool Generate(const FileDescriptor* file, const std::string& parameter,
62
+ GeneratorContext* context, std::string* error) const override;
63
+
64
+ uint64_t GetSupportedFeatures() const override;
65
+
66
+ private:
67
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator);
68
+ };
69
+
70
+ } // namespace java
71
+ } // namespace compiler
72
+ } // namespace protobuf
73
+ } // namespace google
74
+
75
+ #include <google/protobuf/port_undef.inc>
76
+
77
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/generator_factory.h ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: liujisi@google.com (Pherl Liu)
32
+
33
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__
34
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__
35
+
36
+ #include <google/protobuf/stubs/common.h>
37
+
38
+ namespace google {
39
+ namespace protobuf {
40
+ class FieldDescriptor; // descriptor.h
41
+ class Descriptor; // descriptor.h
42
+ class ServiceDescriptor; // descriptor.h
43
+ namespace compiler {
44
+ namespace java {
45
+ class MessageGenerator; // message.h
46
+ class ExtensionGenerator; // extension.h
47
+ class ServiceGenerator; // service.h
48
+ class Context; // context.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ } // namespace protobuf
52
+ } // namespace google
53
+
54
+ namespace google {
55
+ namespace protobuf {
56
+ namespace compiler {
57
+ namespace java {
58
+
59
+ class GeneratorFactory {
60
+ public:
61
+ GeneratorFactory();
62
+ virtual ~GeneratorFactory();
63
+
64
+ virtual MessageGenerator* NewMessageGenerator(
65
+ const Descriptor* descriptor) const = 0;
66
+
67
+ virtual ExtensionGenerator* NewExtensionGenerator(
68
+ const FieldDescriptor* descriptor) const = 0;
69
+
70
+ virtual ServiceGenerator* NewServiceGenerator(
71
+ const ServiceDescriptor* descriptor) const = 0;
72
+
73
+ private:
74
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorFactory);
75
+ };
76
+
77
+ // Factory that creates generators for immutable-default messages.
78
+ class ImmutableGeneratorFactory : public GeneratorFactory {
79
+ public:
80
+ ImmutableGeneratorFactory(Context* context);
81
+ ~ImmutableGeneratorFactory() override;
82
+
83
+ MessageGenerator* NewMessageGenerator(
84
+ const Descriptor* descriptor) const override;
85
+
86
+ ExtensionGenerator* NewExtensionGenerator(
87
+ const FieldDescriptor* descriptor) const override;
88
+
89
+ ServiceGenerator* NewServiceGenerator(
90
+ const ServiceDescriptor* descriptor) const override;
91
+
92
+ private:
93
+ Context* context_;
94
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableGeneratorFactory);
95
+ };
96
+
97
+
98
+ } // namespace java
99
+ } // namespace compiler
100
+ } // namespace protobuf
101
+ } // namespace google
102
+
103
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/helpers.h ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__
37
+
38
+ #include <cstdint>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/io/printer.h>
42
+ #include <google/protobuf/descriptor.h>
43
+ #include <google/protobuf/compiler/java/context.h>
44
+ #include <google/protobuf/descriptor.pb.h>
45
+
46
+ namespace google {
47
+ namespace protobuf {
48
+ namespace compiler {
49
+ namespace java {
50
+
51
+ // Commonly-used separator comments. Thick is a line of '=', thin is a line
52
+ // of '-'.
53
+ extern const char kThickSeparator[];
54
+ extern const char kThinSeparator[];
55
+
56
+ bool IsForbiddenKotlin(const std::string& field_name);
57
+
58
+ // If annotation_file is non-empty, prints a javax.annotation.Generated
59
+ // annotation to the given Printer. annotation_file will be referenced in the
60
+ // annotation's comments field. delimiter should be the Printer's delimiter
61
+ // character. annotation_file will be included verbatim into a Java literal
62
+ // string, so it should not contain quotes or invalid Java escape sequences;
63
+ // however, these are unlikely to appear in practice, as the value of
64
+ // annotation_file should be generated from the filename of the source file
65
+ // being annotated (which in turn must be a Java identifier plus ".java").
66
+ void PrintGeneratedAnnotation(io::Printer* printer, char delimiter = '$',
67
+ const std::string& annotation_file = "");
68
+
69
+ // If a GeneratedMessageLite contains non-lite enums, then its verifier
70
+ // must be instantiated inline, rather than retrieved from the enum class.
71
+ void PrintEnumVerifierLogic(io::Printer* printer,
72
+ const FieldDescriptor* descriptor,
73
+ const std::map<std::string, std::string>& variables,
74
+ const char* var_name,
75
+ const char* terminating_string, bool enforce_lite);
76
+
77
+ // Converts a name to camel-case. If cap_first_letter is true, capitalize the
78
+ // first letter.
79
+ std::string ToCamelCase(const std::string& input, bool lower_first);
80
+
81
+ char ToUpperCh(char ch);
82
+ char ToLowerCh(char ch);
83
+
84
+ // Converts a name to camel-case. If cap_first_letter is true, capitalize the
85
+ // first letter.
86
+ std::string UnderscoresToCamelCase(const std::string& name,
87
+ bool cap_first_letter);
88
+ // Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
89
+ // "fooBarBaz" or "FooBarBaz", respectively.
90
+ std::string UnderscoresToCamelCase(const FieldDescriptor* field);
91
+ std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
92
+
93
+ // Similar, but for method names. (Typically, this merely has the effect
94
+ // of lower-casing the first letter of the name.)
95
+ std::string UnderscoresToCamelCase(const MethodDescriptor* method);
96
+
97
+ // Same as UnderscoresToCamelCase, but checks for reserved keywords
98
+ std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field);
99
+
100
+ // Similar to UnderscoresToCamelCase, but guarantees that the result is a
101
+ // complete Java identifier by adding a _ if needed.
102
+ std::string CamelCaseFieldName(const FieldDescriptor* field);
103
+
104
+ // Get an identifier that uniquely identifies this type within the file.
105
+ // This is used to declare static variables related to this type at the
106
+ // outermost file scope.
107
+ std::string UniqueFileScopeIdentifier(const Descriptor* descriptor);
108
+
109
+ // Gets the unqualified class name for the file. For each .proto file, there
110
+ // will be one Java class containing all the immutable messages and another
111
+ // Java class containing all the mutable messages.
112
+ // TODO(xiaofeng): remove the default value after updating client code.
113
+ std::string FileClassName(const FileDescriptor* file, bool immutable = true);
114
+
115
+ // Returns the file's Java package name.
116
+ std::string FileJavaPackage(const FileDescriptor* file, bool immutable);
117
+
118
+ // Returns output directory for the given package name.
119
+ std::string JavaPackageToDir(std::string package_name);
120
+
121
+ // Comma-separate list of option-specified interfaces implemented by the
122
+ // Message, to follow the "implements" declaration of the Message definition.
123
+ std::string ExtraMessageInterfaces(const Descriptor* descriptor);
124
+ // Comma-separate list of option-specified interfaces implemented by the
125
+ // MutableMessage, to follow the "implements" declaration of the MutableMessage
126
+ // definition.
127
+ std::string ExtraMutableMessageInterfaces(const Descriptor* descriptor);
128
+ // Comma-separate list of option-specified interfaces implemented by the
129
+ // Builder, to follow the "implements" declaration of the Builder definition.
130
+ std::string ExtraBuilderInterfaces(const Descriptor* descriptor);
131
+ // Comma-separate list of option-specified interfaces extended by the
132
+ // MessageOrBuilder, to follow the "extends" declaration of the
133
+ // MessageOrBuilder definition.
134
+ std::string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor);
135
+
136
+ // Get the unqualified Java class name for mutable messages. i.e. without
137
+ // package or outer classnames.
138
+ inline std::string ShortMutableJavaClassName(const Descriptor* descriptor) {
139
+ return descriptor->name();
140
+ }
141
+
142
+ // Whether the given descriptor is for one of the core descriptor protos. We
143
+ // cannot currently use the new runtime with core protos since there is a
144
+ // bootstrapping problem with obtaining their descriptors.
145
+ inline bool IsDescriptorProto(const Descriptor* descriptor) {
146
+ return descriptor->file()->name() == "net/proto2/proto/descriptor.proto" ||
147
+ descriptor->file()->name() == "google/protobuf/descriptor.proto";
148
+ }
149
+
150
+ // Returns the stored type string used by the experimental runtime for oneof
151
+ // fields.
152
+ std::string GetOneofStoredType(const FieldDescriptor* field);
153
+
154
+ // We use either the proto1 enums if the enum is generated, otherwise fall back
155
+ // to use integers.
156
+ enum class Proto1EnumRepresentation {
157
+ kEnum,
158
+ kInteger,
159
+ };
160
+
161
+ // Returns which representation we should use.
162
+ inline Proto1EnumRepresentation GetProto1EnumRepresentation(
163
+ const EnumDescriptor* descriptor) {
164
+ if (descriptor->containing_type() != nullptr) {
165
+ return Proto1EnumRepresentation::kEnum;
166
+ }
167
+ return Proto1EnumRepresentation::kInteger;
168
+ }
169
+
170
+ // Whether we should generate multiple java files for messages.
171
+ inline bool MultipleJavaFiles(const FileDescriptor* descriptor,
172
+ bool immutable) {
173
+ (void)immutable;
174
+ return descriptor->options().java_multiple_files();
175
+ }
176
+
177
+
178
+ // Returns true if `descriptor` will be written to its own .java file.
179
+ // `immutable` should be set to true if we're generating for the immutable API.
180
+ template <typename Descriptor>
181
+ bool IsOwnFile(const Descriptor* descriptor, bool immutable) {
182
+ return descriptor->containing_type() == NULL &&
183
+ MultipleJavaFiles(descriptor->file(), immutable);
184
+ }
185
+
186
+ template <>
187
+ inline bool IsOwnFile(const ServiceDescriptor* descriptor, bool immutable) {
188
+ return MultipleJavaFiles(descriptor->file(), immutable);
189
+ }
190
+
191
+ // If `descriptor` describes an object with its own .java file,
192
+ // returns the name (relative to that .java file) of the file that stores
193
+ // annotation data for that descriptor. `suffix` is usually empty, but may
194
+ // (e.g.) be "OrBuilder" for some generated interfaces.
195
+ template <typename Descriptor>
196
+ std::string AnnotationFileName(const Descriptor* descriptor,
197
+ const std::string& suffix) {
198
+ return descriptor->name() + suffix + ".java.pb.meta";
199
+ }
200
+
201
+ template <typename Descriptor>
202
+ void MaybePrintGeneratedAnnotation(Context* context, io::Printer* printer,
203
+ Descriptor* descriptor, bool immutable,
204
+ const std::string& suffix = "") {
205
+ if (IsOwnFile(descriptor, immutable)) {
206
+ PrintGeneratedAnnotation(printer, '$',
207
+ context->options().annotate_code
208
+ ? AnnotationFileName(descriptor, suffix)
209
+ : "");
210
+ }
211
+ }
212
+
213
+ // Get the unqualified name that should be used for a field's field
214
+ // number constant.
215
+ std::string FieldConstantName(const FieldDescriptor* field);
216
+
217
+ // Returns the type of the FieldDescriptor.
218
+ // This does nothing interesting for the open source release, but is used for
219
+ // hacks that improve compatibility with version 1 protocol buffers at Google.
220
+ FieldDescriptor::Type GetType(const FieldDescriptor* field);
221
+
222
+ enum JavaType {
223
+ JAVATYPE_INT,
224
+ JAVATYPE_LONG,
225
+ JAVATYPE_FLOAT,
226
+ JAVATYPE_DOUBLE,
227
+ JAVATYPE_BOOLEAN,
228
+ JAVATYPE_STRING,
229
+ JAVATYPE_BYTES,
230
+ JAVATYPE_ENUM,
231
+ JAVATYPE_MESSAGE
232
+ };
233
+
234
+ JavaType GetJavaType(const FieldDescriptor* field);
235
+
236
+ const char* PrimitiveTypeName(JavaType type);
237
+
238
+ // Get the fully-qualified class name for a boxed primitive type, e.g.
239
+ // "java.lang.Integer" for JAVATYPE_INT. Returns NULL for enum and message
240
+ // types.
241
+ const char* BoxedPrimitiveTypeName(JavaType type);
242
+
243
+ // Kotlin source does not distinguish between primitives and non-primitives,
244
+ // but does use Kotlin-specific qualified types for them.
245
+ const char* KotlinTypeName(JavaType type);
246
+
247
+ // Get the name of the java enum constant representing this type. E.g.,
248
+ // "INT32" for FieldDescriptor::TYPE_INT32. The enum constant's full
249
+ // name is "com.google.protobuf.WireFormat.FieldType.INT32".
250
+ const char* FieldTypeName(const FieldDescriptor::Type field_type);
251
+
252
+ class ClassNameResolver;
253
+ std::string DefaultValue(const FieldDescriptor* field, bool immutable,
254
+ ClassNameResolver* name_resolver);
255
+ inline std::string ImmutableDefaultValue(const FieldDescriptor* field,
256
+ ClassNameResolver* name_resolver) {
257
+ return DefaultValue(field, true, name_resolver);
258
+ }
259
+ bool IsDefaultValueJavaDefault(const FieldDescriptor* field);
260
+ bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field);
261
+
262
+ // Does this message class have descriptor and reflection methods?
263
+ inline bool HasDescriptorMethods(const Descriptor* /* descriptor */,
264
+ bool enforce_lite) {
265
+ return !enforce_lite;
266
+ }
267
+ inline bool HasDescriptorMethods(const EnumDescriptor* /* descriptor */,
268
+ bool enforce_lite) {
269
+ return !enforce_lite;
270
+ }
271
+ inline bool HasDescriptorMethods(const FileDescriptor* /* descriptor */,
272
+ bool enforce_lite) {
273
+ return !enforce_lite;
274
+ }
275
+
276
+ // Should we generate generic services for this file?
277
+ inline bool HasGenericServices(const FileDescriptor* file, bool enforce_lite) {
278
+ return file->service_count() > 0 &&
279
+ HasDescriptorMethods(file, enforce_lite) &&
280
+ file->options().java_generic_services();
281
+ }
282
+
283
+ // Methods for shared bitfields.
284
+
285
+ // Gets the name of the shared bitfield for the given index.
286
+ std::string GetBitFieldName(int index);
287
+
288
+ // Gets the name of the shared bitfield for the given bit index.
289
+ // Effectively, GetBitFieldName(bitIndex / 32)
290
+ std::string GetBitFieldNameForBit(int bitIndex);
291
+
292
+ // Generates the java code for the expression that returns the boolean value
293
+ // of the bit of the shared bitfields for the given bit index.
294
+ // Example: "((bitField1_ & 0x04) == 0x04)"
295
+ std::string GenerateGetBit(int bitIndex);
296
+
297
+ // Generates the java code for the expression that sets the bit of the shared
298
+ // bitfields for the given bit index.
299
+ // Example: "bitField1_ = (bitField1_ | 0x04)"
300
+ std::string GenerateSetBit(int bitIndex);
301
+
302
+ // Generates the java code for the expression that clears the bit of the shared
303
+ // bitfields for the given bit index.
304
+ // Example: "bitField1_ = (bitField1_ & ~0x04)"
305
+ std::string GenerateClearBit(int bitIndex);
306
+
307
+ // Does the same as GenerateGetBit but operates on the bit field on a local
308
+ // variable. This is used by the builder to copy the value in the builder to
309
+ // the message.
310
+ // Example: "((from_bitField1_ & 0x04) == 0x04)"
311
+ std::string GenerateGetBitFromLocal(int bitIndex);
312
+
313
+ // Does the same as GenerateSetBit but operates on the bit field on a local
314
+ // variable. This is used by the builder to copy the value in the builder to
315
+ // the message.
316
+ // Example: "to_bitField1_ = (to_bitField1_ | 0x04)"
317
+ std::string GenerateSetBitToLocal(int bitIndex);
318
+
319
+ // Does the same as GenerateGetBit but operates on the bit field on a local
320
+ // variable. This is used by the parsing constructor to record if a repeated
321
+ // field is mutable.
322
+ // Example: "((mutable_bitField1_ & 0x04) == 0x04)"
323
+ std::string GenerateGetBitMutableLocal(int bitIndex);
324
+
325
+ // Does the same as GenerateSetBit but operates on the bit field on a local
326
+ // variable. This is used by the parsing constructor to record if a repeated
327
+ // field is mutable.
328
+ // Example: "mutable_bitField1_ = (mutable_bitField1_ | 0x04)"
329
+ std::string GenerateSetBitMutableLocal(int bitIndex);
330
+
331
+ // Returns whether the JavaType is a reference type.
332
+ bool IsReferenceType(JavaType type);
333
+
334
+ // Returns the capitalized name for calling relative functions in
335
+ // CodedInputStream
336
+ const char* GetCapitalizedType(const FieldDescriptor* field, bool immutable);
337
+
338
+ // For encodings with fixed sizes, returns that size in bytes. Otherwise
339
+ // returns -1.
340
+ int FixedSize(FieldDescriptor::Type type);
341
+
342
+ // Comparators used to sort fields in MessageGenerator
343
+ struct FieldOrderingByNumber {
344
+ inline bool operator()(const FieldDescriptor* a,
345
+ const FieldDescriptor* b) const {
346
+ return a->number() < b->number();
347
+ }
348
+ };
349
+
350
+ struct ExtensionRangeOrdering {
351
+ bool operator()(const Descriptor::ExtensionRange* a,
352
+ const Descriptor::ExtensionRange* b) const {
353
+ return a->start < b->start;
354
+ }
355
+ };
356
+
357
+ // Sort the fields of the given Descriptor by number into a new[]'d array
358
+ // and return it. The caller should delete the returned array.
359
+ const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor);
360
+
361
+ // Does this message class have any packed fields?
362
+ inline bool HasPackedFields(const Descriptor* descriptor) {
363
+ for (int i = 0; i < descriptor->field_count(); i++) {
364
+ if (descriptor->field(i)->is_packed()) {
365
+ return true;
366
+ }
367
+ }
368
+ return false;
369
+ }
370
+
371
+ // Check a message type and its sub-message types recursively to see if any of
372
+ // them has a required field. Return true if a required field is found.
373
+ bool HasRequiredFields(const Descriptor* descriptor);
374
+
375
+ inline bool IsProto2(const FileDescriptor* descriptor) {
376
+ return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO2;
377
+ }
378
+
379
+ inline bool IsRealOneof(const FieldDescriptor* descriptor) {
380
+ return descriptor->containing_oneof() &&
381
+ !descriptor->containing_oneof()->is_synthetic();
382
+ }
383
+
384
+ inline bool HasHazzer(const FieldDescriptor* descriptor) {
385
+ return !descriptor->is_repeated() &&
386
+ (descriptor->message_type() || descriptor->has_optional_keyword() ||
387
+ IsProto2(descriptor->file()) || IsRealOneof(descriptor));
388
+ }
389
+
390
+ inline bool HasHasbit(const FieldDescriptor* descriptor) {
391
+ // Note that currently message fields inside oneofs have hasbits. This is
392
+ // surprising, as the oneof case should avoid any need for a hasbit. But if
393
+ // you change this method to remove hasbits for oneofs, a few tests fail.
394
+ // TODO(b/124347790): remove hasbits for oneofs
395
+ return !descriptor->is_repeated() &&
396
+ (descriptor->has_optional_keyword() || IsProto2(descriptor->file()));
397
+ }
398
+
399
+ // Whether generate classes expose public PARSER instances.
400
+ inline bool ExposePublicParser(const FileDescriptor* descriptor) {
401
+ // TODO(liujisi): Mark the PARSER private in 3.1.x releases.
402
+ return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO2;
403
+ }
404
+
405
+ // Whether unknown enum values are kept (i.e., not stored in UnknownFieldSet
406
+ // but in the message and can be queried using additional getters that return
407
+ // ints.
408
+ inline bool SupportUnknownEnumValue(const FileDescriptor* descriptor) {
409
+ return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO3;
410
+ }
411
+
412
+ inline bool SupportUnknownEnumValue(const FieldDescriptor* field) {
413
+ return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3;
414
+ }
415
+
416
+ // Check whether a message has repeated fields.
417
+ bool HasRepeatedFields(const Descriptor* descriptor);
418
+
419
+ inline bool IsMapEntry(const Descriptor* descriptor) {
420
+ return descriptor->options().map_entry();
421
+ }
422
+
423
+ inline bool IsMapField(const FieldDescriptor* descriptor) {
424
+ return descriptor->is_map();
425
+ }
426
+
427
+ inline bool IsAnyMessage(const Descriptor* descriptor) {
428
+ return descriptor->full_name() == "google.protobuf.Any";
429
+ }
430
+
431
+ inline bool IsWrappersProtoFile(const FileDescriptor* descriptor) {
432
+ return descriptor->name() == "google/protobuf/wrappers.proto";
433
+ }
434
+
435
+ inline bool CheckUtf8(const FieldDescriptor* descriptor) {
436
+ return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ||
437
+ descriptor->file()->options().java_string_check_utf8();
438
+ }
439
+
440
+ inline std::string GeneratedCodeVersionSuffix() {
441
+ return "V3";
442
+ }
443
+
444
+ void WriteUInt32ToUtf16CharSequence(uint32_t number,
445
+ std::vector<uint16_t>* output);
446
+
447
+ inline void WriteIntToUtf16CharSequence(int value,
448
+ std::vector<uint16_t>* output) {
449
+ WriteUInt32ToUtf16CharSequence(static_cast<uint32_t>(value), output);
450
+ }
451
+
452
+ // Escape a UTF-16 character so it can be embedded in a Java string literal.
453
+ void EscapeUtf16ToString(uint16_t code, std::string* output);
454
+
455
+ // Only the lowest two bytes of the return value are used. The lowest byte
456
+ // is the integer value of a j/c/g/protobuf/FieldType enum. For the other
457
+ // byte:
458
+ // bit 0: whether the field is required.
459
+ // bit 1: whether the field requires UTF-8 validation.
460
+ // bit 2: whether the field needs isInitialized check.
461
+ // bit 3: whether the field is a map field with proto2 enum value.
462
+ // bits 4-7: unused
463
+ int GetExperimentalJavaFieldType(const FieldDescriptor* field);
464
+
465
+ // To get the total number of entries need to be built for experimental runtime
466
+ // and the first field number that are not in the table part
467
+ std::pair<int, int> GetTableDrivenNumberOfEntriesAndLookUpStartFieldNumber(
468
+ const FieldDescriptor** fields, int count);
469
+ } // namespace java
470
+ } // namespace compiler
471
+ } // namespace protobuf
472
+ } // namespace google
473
+
474
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/java_generator.h ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_
2
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_
3
+
4
+ #include <google/protobuf/compiler/java/generator.h>
5
+
6
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/kotlin_generator.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Generates Kotlin code for a given .proto file.
32
+
33
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__
34
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__
35
+
36
+ #include <string>
37
+
38
+ #include <google/protobuf/compiler/code_generator.h>
39
+
40
+ // Must be included last.
41
+ #include <google/protobuf/port_def.inc>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+
48
+ // CodeGenerator implementation which generates Kotlin code. If you create your
49
+ // own protocol compiler binary and you want it to support Kotlin output, you
50
+ // can do so by registering an instance of this CodeGenerator with the
51
+ // CommandLineInterface in your main() function.
52
+ class PROTOC_EXPORT KotlinGenerator : public CodeGenerator {
53
+ public:
54
+ KotlinGenerator();
55
+ ~KotlinGenerator() override;
56
+
57
+ // implements CodeGenerator ----------------------------------------
58
+ bool Generate(const FileDescriptor* file, const std::string& parameter,
59
+ GeneratorContext* context, std::string* error) const override;
60
+
61
+ uint64_t GetSupportedFeatures() const override;
62
+
63
+ private:
64
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(KotlinGenerator);
65
+ };
66
+
67
+ } // namespace java
68
+ } // namespace compiler
69
+ } // namespace protobuf
70
+ } // namespace google
71
+
72
+ #include <google/protobuf/port_undef.inc>
73
+
74
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/map_field_lite.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__
33
+
34
+ #include <cstdint>
35
+
36
+ #include <google/protobuf/compiler/java/field.h>
37
+
38
+ namespace google {
39
+ namespace protobuf {
40
+ namespace compiler {
41
+ namespace java {
42
+
43
+ class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator {
44
+ public:
45
+ explicit ImmutableMapFieldLiteGenerator(const FieldDescriptor* descriptor,
46
+ int messageBitIndex,
47
+ Context* context);
48
+ ~ImmutableMapFieldLiteGenerator() override;
49
+
50
+ // implements ImmutableFieldLiteGenerator ------------------------------------
51
+ int GetNumBitsForMessage() const override;
52
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
53
+ void GenerateMembers(io::Printer* printer) const override;
54
+ void GenerateBuilderMembers(io::Printer* printer) const override;
55
+ void GenerateInitializationCode(io::Printer* printer) const override;
56
+ void GenerateFieldInfo(io::Printer* printer,
57
+ std::vector<uint16_t>* output) const override;
58
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
59
+
60
+ std::string GetBoxedType() const override;
61
+
62
+ private:
63
+ const FieldDescriptor* descriptor_;
64
+ std::map<std::string, std::string> variables_;
65
+ Context* context_;
66
+ ClassNameResolver* name_resolver_;
67
+ };
68
+
69
+ } // namespace java
70
+ } // namespace compiler
71
+ } // namespace protobuf
72
+ } // namespace google
73
+
74
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message.h ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/compiler/java/field.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+ class Context; // context.h
48
+ class ClassNameResolver; // name_resolver.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ namespace io {
52
+ class Printer; // printer.h
53
+ }
54
+ } // namespace protobuf
55
+ } // namespace google
56
+
57
+ namespace google {
58
+ namespace protobuf {
59
+ namespace compiler {
60
+ namespace java {
61
+
62
+ static const int kMaxStaticSize = 1 << 15; // aka 32k
63
+
64
+ class MessageGenerator {
65
+ public:
66
+ explicit MessageGenerator(const Descriptor* descriptor);
67
+ virtual ~MessageGenerator();
68
+
69
+ // All static variables have to be declared at the top-level of the file
70
+ // so that we can control initialization order, which is important for
71
+ // DescriptorProto bootstrapping to work.
72
+ virtual void GenerateStaticVariables(io::Printer* printer,
73
+ int* bytecode_estimate) = 0;
74
+
75
+ // Output code which initializes the static variables generated by
76
+ // GenerateStaticVariables(). Returns an estimate of bytecode size.
77
+ virtual int GenerateStaticVariableInitializers(io::Printer* printer) = 0;
78
+
79
+ // Generate the class itself.
80
+ virtual void Generate(io::Printer* printer) = 0;
81
+
82
+ // Generates the base interface that both the class and its builder
83
+ // implement
84
+ virtual void GenerateInterface(io::Printer* printer) = 0;
85
+
86
+ // Generate code to register all contained extensions with an
87
+ // ExtensionRegistry.
88
+ virtual void GenerateExtensionRegistrationCode(io::Printer* printer) = 0;
89
+ virtual void GenerateKotlinDsl(io::Printer* printer) const = 0;
90
+ virtual void GenerateKotlinMembers(io::Printer* printer) const = 0;
91
+ virtual void GenerateTopLevelKotlinMembers(io::Printer* printer) const = 0;
92
+
93
+ protected:
94
+ const Descriptor* descriptor_;
95
+ std::set<const OneofDescriptor*> oneofs_;
96
+
97
+ private:
98
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
99
+ };
100
+
101
+ class ImmutableMessageGenerator : public MessageGenerator {
102
+ public:
103
+ ImmutableMessageGenerator(const Descriptor* descriptor, Context* context);
104
+ ~ImmutableMessageGenerator() override;
105
+
106
+ void Generate(io::Printer* printer) override;
107
+ void GenerateInterface(io::Printer* printer) override;
108
+ void GenerateExtensionRegistrationCode(io::Printer* printer) override;
109
+ void GenerateStaticVariables(io::Printer* printer,
110
+ int* bytecode_estimate) override;
111
+
112
+ // Returns an estimate of the number of bytes the printed code will compile to
113
+ int GenerateStaticVariableInitializers(io::Printer* printer) override;
114
+ void GenerateKotlinDsl(io::Printer* printer) const override;
115
+ void GenerateKotlinMembers(io::Printer* printer) const override;
116
+ void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;
117
+
118
+ private:
119
+ void GenerateFieldAccessorTable(io::Printer* printer, int* bytecode_estimate);
120
+
121
+ // Returns an estimate of the number of bytes the printed code will compile to
122
+ int GenerateFieldAccessorTableInitializer(io::Printer* printer);
123
+
124
+ void GenerateMessageSerializationMethods(io::Printer* printer);
125
+ void GenerateParseFromMethods(io::Printer* printer);
126
+ void GenerateSerializeOneField(io::Printer* printer,
127
+ const FieldDescriptor* field);
128
+ void GenerateSerializeOneExtensionRange(
129
+ io::Printer* printer, const Descriptor::ExtensionRange* range);
130
+
131
+ void GenerateBuilder(io::Printer* printer);
132
+ void GenerateIsInitialized(io::Printer* printer);
133
+ void GenerateDescriptorMethods(io::Printer* printer);
134
+ void GenerateInitializers(io::Printer* printer);
135
+ void GenerateEqualsAndHashCode(io::Printer* printer);
136
+ void GenerateParser(io::Printer* printer);
137
+ void GenerateParsingConstructor(io::Printer* printer);
138
+ void GenerateMutableCopy(io::Printer* printer);
139
+ void GenerateKotlinExtensions(io::Printer* printer) const;
140
+ void GenerateKotlinOrNull(io::Printer* printer) const;
141
+ void GenerateAnyMethods(io::Printer* printer);
142
+
143
+ Context* context_;
144
+ ClassNameResolver* name_resolver_;
145
+ FieldGeneratorMap<ImmutableFieldGenerator> field_generators_;
146
+
147
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageGenerator);
148
+ };
149
+
150
+ } // namespace java
151
+ } // namespace compiler
152
+ } // namespace protobuf
153
+ } // namespace google
154
+
155
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_builder.h ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: dweis@google.com (Daniel Weis)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/compiler/java/field.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+ class Context; // context.h
48
+ class ClassNameResolver; // name_resolver.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ namespace io {
52
+ class Printer; // printer.h
53
+ }
54
+ } // namespace protobuf
55
+ } // namespace google
56
+
57
+ namespace google {
58
+ namespace protobuf {
59
+ namespace compiler {
60
+ namespace java {
61
+
62
+ class MessageBuilderGenerator {
63
+ public:
64
+ explicit MessageBuilderGenerator(const Descriptor* descriptor,
65
+ Context* context);
66
+ virtual ~MessageBuilderGenerator();
67
+
68
+ virtual void Generate(io::Printer* printer);
69
+
70
+ private:
71
+ void GenerateCommonBuilderMethods(io::Printer* printer);
72
+ void GenerateDescriptorMethods(io::Printer* printer);
73
+ void GenerateBuilderParsingMethods(io::Printer* printer);
74
+ void GenerateBuilderFieldParsingCases(io::Printer* printer);
75
+ void GenerateBuilderFieldParsingCase(io::Printer* printer,
76
+ const FieldDescriptor* field);
77
+ void GenerateBuilderPackedFieldParsingCase(io::Printer* printer,
78
+ const FieldDescriptor* field);
79
+ void GenerateIsInitialized(io::Printer* printer);
80
+
81
+ const Descriptor* descriptor_;
82
+ Context* context_;
83
+ ClassNameResolver* name_resolver_;
84
+ FieldGeneratorMap<ImmutableFieldGenerator> field_generators_;
85
+ std::set<const OneofDescriptor*> oneofs_;
86
+
87
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageBuilderGenerator);
88
+ };
89
+
90
+ } // namespace java
91
+ } // namespace compiler
92
+ } // namespace protobuf
93
+ } // namespace google
94
+
95
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_field.h ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/compiler/java/field.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+ class Context; // context.h
48
+ class ClassNameResolver; // name_resolver.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ } // namespace protobuf
52
+ } // namespace google
53
+
54
+ namespace google {
55
+ namespace protobuf {
56
+ namespace compiler {
57
+ namespace java {
58
+
59
+ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator {
60
+ public:
61
+ explicit ImmutableMessageFieldGenerator(const FieldDescriptor* descriptor,
62
+ int messageBitIndex,
63
+ int builderBitIndex,
64
+ Context* context);
65
+ ~ImmutableMessageFieldGenerator() override;
66
+
67
+ // implements ImmutableFieldGenerator
68
+ // ---------------------------------------
69
+ int GetNumBitsForMessage() const override;
70
+ int GetNumBitsForBuilder() const override;
71
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
72
+ void GenerateMembers(io::Printer* printer) const override;
73
+ void GenerateBuilderMembers(io::Printer* printer) const override;
74
+ void GenerateInitializationCode(io::Printer* printer) const override;
75
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
76
+ void GenerateMergingCode(io::Printer* printer) const override;
77
+ void GenerateBuildingCode(io::Printer* printer) const override;
78
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
79
+ void GenerateSerializationCode(io::Printer* printer) const override;
80
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
81
+ void GenerateFieldBuilderInitializationCode(
82
+ io::Printer* printer) const override;
83
+ void GenerateEqualsCode(io::Printer* printer) const override;
84
+ void GenerateHashCode(io::Printer* printer) const override;
85
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
86
+
87
+ std::string GetBoxedType() const override;
88
+
89
+ protected:
90
+ const FieldDescriptor* descriptor_;
91
+ std::map<std::string, std::string> variables_;
92
+ ClassNameResolver* name_resolver_;
93
+
94
+ void PrintNestedBuilderCondition(io::Printer* printer,
95
+ const char* regular_case,
96
+ const char* nested_builder_case) const;
97
+ void PrintNestedBuilderFunction(io::Printer* printer,
98
+ const char* method_prototype,
99
+ const char* regular_case,
100
+ const char* nested_builder_case,
101
+ const char* trailing_code) const;
102
+
103
+ private:
104
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageFieldGenerator);
105
+ void GenerateKotlinOrNull(io::Printer* printer) const;
106
+ };
107
+
108
+ class ImmutableMessageOneofFieldGenerator
109
+ : public ImmutableMessageFieldGenerator {
110
+ public:
111
+ ImmutableMessageOneofFieldGenerator(const FieldDescriptor* descriptor,
112
+ int messageBitIndex, int builderBitIndex,
113
+ Context* context);
114
+ ~ImmutableMessageOneofFieldGenerator() override;
115
+
116
+ void GenerateMembers(io::Printer* printer) const override;
117
+ void GenerateBuilderMembers(io::Printer* printer) const override;
118
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
119
+ void GenerateBuildingCode(io::Printer* printer) const override;
120
+ void GenerateMergingCode(io::Printer* printer) const override;
121
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
122
+ void GenerateSerializationCode(io::Printer* printer) const override;
123
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
124
+
125
+ private:
126
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldGenerator);
127
+ };
128
+
129
+ class RepeatedImmutableMessageFieldGenerator : public ImmutableFieldGenerator {
130
+ public:
131
+ explicit RepeatedImmutableMessageFieldGenerator(
132
+ const FieldDescriptor* descriptor, int messageBitIndex,
133
+ int builderBitIndex, Context* context);
134
+ ~RepeatedImmutableMessageFieldGenerator() override;
135
+
136
+ // implements ImmutableFieldGenerator ---------------------------------------
137
+ int GetNumBitsForMessage() const override;
138
+ int GetNumBitsForBuilder() const override;
139
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
140
+ void GenerateMembers(io::Printer* printer) const override;
141
+ void GenerateBuilderMembers(io::Printer* printer) const override;
142
+ void GenerateInitializationCode(io::Printer* printer) const override;
143
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
144
+ void GenerateMergingCode(io::Printer* printer) const override;
145
+ void GenerateBuildingCode(io::Printer* printer) const override;
146
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
147
+ void GenerateSerializationCode(io::Printer* printer) const override;
148
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
149
+ void GenerateFieldBuilderInitializationCode(
150
+ io::Printer* printer) const override;
151
+ void GenerateEqualsCode(io::Printer* printer) const override;
152
+ void GenerateHashCode(io::Printer* printer) const override;
153
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
154
+
155
+ std::string GetBoxedType() const override;
156
+
157
+ protected:
158
+ const FieldDescriptor* descriptor_;
159
+ std::map<std::string, std::string> variables_;
160
+ ClassNameResolver* name_resolver_;
161
+
162
+ void PrintNestedBuilderCondition(io::Printer* printer,
163
+ const char* regular_case,
164
+ const char* nested_builder_case) const;
165
+ void PrintNestedBuilderFunction(io::Printer* printer,
166
+ const char* method_prototype,
167
+ const char* regular_case,
168
+ const char* nested_builder_case,
169
+ const char* trailing_code) const;
170
+
171
+ private:
172
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableMessageFieldGenerator);
173
+ };
174
+
175
+ } // namespace java
176
+ } // namespace compiler
177
+ } // namespace protobuf
178
+ } // namespace google
179
+
180
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/message_field_lite.h ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__
37
+
38
+ #include <cstdint>
39
+ #include <map>
40
+ #include <string>
41
+
42
+ #include <google/protobuf/compiler/java/field.h>
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+ namespace compiler {
47
+ namespace java {
48
+ class Context; // context.h
49
+ class ClassNameResolver; // name_resolver.h
50
+ } // namespace java
51
+ } // namespace compiler
52
+ } // namespace protobuf
53
+ } // namespace google
54
+
55
+ namespace google {
56
+ namespace protobuf {
57
+ namespace compiler {
58
+ namespace java {
59
+
60
+ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator {
61
+ public:
62
+ explicit ImmutableMessageFieldLiteGenerator(const FieldDescriptor* descriptor,
63
+ int messageBitIndex,
64
+ Context* context);
65
+ ~ImmutableMessageFieldLiteGenerator() override;
66
+
67
+ // implements ImmutableFieldLiteGenerator
68
+ // ------------------------------------
69
+ int GetNumBitsForMessage() const override;
70
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
71
+ void GenerateMembers(io::Printer* printer) const override;
72
+ void GenerateBuilderMembers(io::Printer* printer) const override;
73
+ void GenerateInitializationCode(io::Printer* printer) const override;
74
+ void GenerateFieldInfo(io::Printer* printer,
75
+ std::vector<uint16_t>* output) const override;
76
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
77
+
78
+ std::string GetBoxedType() const override;
79
+
80
+ protected:
81
+ const FieldDescriptor* descriptor_;
82
+ std::map<std::string, std::string> variables_;
83
+ const int messageBitIndex_;
84
+ ClassNameResolver* name_resolver_;
85
+
86
+ private:
87
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageFieldLiteGenerator);
88
+ void GenerateKotlinOrNull(io::Printer* printer) const;
89
+ };
90
+
91
+ class ImmutableMessageOneofFieldLiteGenerator
92
+ : public ImmutableMessageFieldLiteGenerator {
93
+ public:
94
+ ImmutableMessageOneofFieldLiteGenerator(const FieldDescriptor* descriptor,
95
+ int messageBitIndex,
96
+ Context* context);
97
+ ~ImmutableMessageOneofFieldLiteGenerator() override;
98
+
99
+ void GenerateMembers(io::Printer* printer) const override;
100
+ void GenerateBuilderMembers(io::Printer* printer) const override;
101
+ void GenerateFieldInfo(io::Printer* printer,
102
+ std::vector<uint16_t>* output) const override;
103
+
104
+ private:
105
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldLiteGenerator);
106
+ };
107
+
108
+ class RepeatedImmutableMessageFieldLiteGenerator
109
+ : public ImmutableFieldLiteGenerator {
110
+ public:
111
+ explicit RepeatedImmutableMessageFieldLiteGenerator(
112
+ const FieldDescriptor* descriptor, int messageBitIndex, Context* context);
113
+ ~RepeatedImmutableMessageFieldLiteGenerator() override;
114
+
115
+ // implements ImmutableFieldLiteGenerator ------------------------------------
116
+ int GetNumBitsForMessage() const override;
117
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
118
+ void GenerateMembers(io::Printer* printer) const override;
119
+ void GenerateBuilderMembers(io::Printer* printer) const override;
120
+ void GenerateInitializationCode(io::Printer* printer) const override;
121
+ void GenerateFieldInfo(io::Printer* printer,
122
+ std::vector<uint16_t>* output) const override;
123
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
124
+
125
+ std::string GetBoxedType() const override;
126
+
127
+ protected:
128
+ const FieldDescriptor* descriptor_;
129
+ std::map<std::string, std::string> variables_;
130
+ ClassNameResolver* name_resolver_;
131
+
132
+ private:
133
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableMessageFieldLiteGenerator);
134
+ };
135
+
136
+ } // namespace java
137
+ } // namespace compiler
138
+ } // namespace protobuf
139
+ } // namespace google
140
+
141
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/name_resolver.h ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__
33
+
34
+ #include <map>
35
+ #include <string>
36
+
37
+ #include <google/protobuf/stubs/common.h>
38
+
39
+ // Must be last.
40
+ #include <google/protobuf/port_def.inc>
41
+
42
+ namespace google {
43
+ namespace protobuf {
44
+ class Descriptor;
45
+ class EnumDescriptor;
46
+ class FieldDescriptor;
47
+ class FileDescriptor;
48
+ class ServiceDescriptor;
49
+
50
+ namespace compiler {
51
+ namespace java {
52
+
53
+ // Indicates how closely the two class names match.
54
+ enum NameEquality { NO_MATCH, EXACT_EQUAL, EQUAL_IGNORE_CASE };
55
+
56
+ // Used to get the Java class related names for a given descriptor. It caches
57
+ // the results to avoid redundant calculation across multiple name queries.
58
+ // Thread-safety note: This class is *not* thread-safe.
59
+ class ClassNameResolver {
60
+ public:
61
+ ClassNameResolver();
62
+ ~ClassNameResolver();
63
+
64
+ // Gets the unqualified outer class name for the file.
65
+ std::string GetFileClassName(const FileDescriptor* file, bool immutable);
66
+ std::string GetFileClassName(const FileDescriptor* file, bool immutable,
67
+ bool kotlin);
68
+ // Gets the unqualified immutable outer class name of a file.
69
+ std::string GetFileImmutableClassName(const FileDescriptor* file);
70
+ // Gets the unqualified default immutable outer class name of a file
71
+ // (converted from the proto file's name).
72
+ std::string GetFileDefaultImmutableClassName(const FileDescriptor* file);
73
+
74
+ // Check whether there is any type defined in the proto file that has
75
+ // the given class name.
76
+ bool HasConflictingClassName(const FileDescriptor* file,
77
+ const std::string& classname,
78
+ NameEquality equality_mode);
79
+
80
+ // Gets the name of the outer class that holds descriptor information.
81
+ // Descriptors are shared between immutable messages and mutable messages.
82
+ // Since both of them are generated optionally, the descriptors need to be
83
+ // put in another common place.
84
+ std::string GetDescriptorClassName(const FileDescriptor* file);
85
+
86
+ // Gets the fully-qualified class name corresponding to the given descriptor.
87
+ std::string GetClassName(const Descriptor* descriptor, bool immutable);
88
+ std::string GetClassName(const Descriptor* descriptor, bool immutable,
89
+ bool kotlin);
90
+ std::string GetClassName(const EnumDescriptor* descriptor, bool immutable);
91
+ std::string GetClassName(const EnumDescriptor* descriptor, bool immutable,
92
+ bool kotlin);
93
+ std::string GetClassName(const ServiceDescriptor* descriptor, bool immutable);
94
+ std::string GetClassName(const ServiceDescriptor* descriptor, bool immutable,
95
+ bool kotlin);
96
+ std::string GetClassName(const FileDescriptor* descriptor, bool immutable);
97
+ std::string GetClassName(const FileDescriptor* descriptor, bool immutable,
98
+ bool kotlin);
99
+
100
+ template <class DescriptorType>
101
+ std::string GetImmutableClassName(const DescriptorType* descriptor) {
102
+ return GetClassName(descriptor, true);
103
+ }
104
+ template <class DescriptorType>
105
+ std::string GetMutableClassName(const DescriptorType* descriptor) {
106
+ return GetClassName(descriptor, false);
107
+ }
108
+
109
+ // Gets the fully qualified name of an extension identifier.
110
+ std::string GetExtensionIdentifierName(const FieldDescriptor* descriptor,
111
+ bool immutable);
112
+ std::string GetExtensionIdentifierName(const FieldDescriptor* descriptor,
113
+ bool immutable, bool kotlin);
114
+
115
+ // Gets the fully qualified name for generated classes in Java convention.
116
+ // Nested classes will be separated using '$' instead of '.'
117
+ // For example:
118
+ // com.package.OuterClass$OuterMessage$InnerMessage
119
+ std::string GetJavaImmutableClassName(const Descriptor* descriptor);
120
+ std::string GetJavaImmutableClassName(const EnumDescriptor* descriptor);
121
+ std::string GetKotlinFactoryName(const Descriptor* descriptor);
122
+ std::string GetKotlinExtensionsClassName(const Descriptor* descriptor);
123
+ std::string GetJavaMutableClassName(const Descriptor* descriptor);
124
+ std::string GetJavaMutableClassName(const EnumDescriptor* descriptor);
125
+ // Gets the outer class and the actual class for downgraded mutable messages.
126
+ std::string GetDowngradedFileClassName(const FileDescriptor* file);
127
+ std::string GetDowngradedClassName(const Descriptor* descriptor);
128
+
129
+ // Get the full name of a Java class by prepending the Java package name
130
+ // or outer class name.
131
+ std::string GetClassFullName(const std::string& name_without_package,
132
+ const FileDescriptor* file, bool immutable,
133
+ bool is_own_file);
134
+ std::string GetClassFullName(const std::string& name_without_package,
135
+ const FileDescriptor* file, bool immutable,
136
+ bool is_own_file, bool kotlin);
137
+
138
+ private:
139
+ // Get the Java Class style full name of a message.
140
+ std::string GetJavaClassFullName(const std::string& name_without_package,
141
+ const FileDescriptor* file, bool immutable);
142
+ std::string GetJavaClassFullName(const std::string& name_without_package,
143
+ const FileDescriptor* file, bool immutable,
144
+ bool kotlin);
145
+ // Caches the result to provide better performance.
146
+ std::map<const FileDescriptor*, std::string>
147
+ file_immutable_outer_class_names_;
148
+
149
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ClassNameResolver);
150
+ };
151
+
152
+ } // namespace java
153
+ } // namespace compiler
154
+ } // namespace protobuf
155
+ } // namespace google
156
+
157
+ #include <google/protobuf/port_undef.inc>
158
+
159
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/names.h ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Provides a mechanism for mapping a descriptor to the
36
+ // fully-qualified name of the corresponding Java class.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
39
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
40
+
41
+ #include <string>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+
46
+ class Descriptor;
47
+ class EnumDescriptor;
48
+ class FileDescriptor;
49
+ class FieldDescriptor;
50
+ class ServiceDescriptor;
51
+
52
+ namespace compiler {
53
+ namespace java {
54
+
55
+ // Requires:
56
+ // descriptor != NULL
57
+ //
58
+ // Returns:
59
+ // The fully-qualified Java class name.
60
+ std::string ClassName(const Descriptor* descriptor);
61
+
62
+ // Requires:
63
+ // descriptor != NULL
64
+ //
65
+ // Returns:
66
+ // The fully-qualified Java class name.
67
+ std::string ClassName(const EnumDescriptor* descriptor);
68
+
69
+ // Requires:
70
+ // descriptor != NULL
71
+ //
72
+ // Returns:
73
+ // The fully-qualified Java class name.
74
+ std::string ClassName(const FileDescriptor* descriptor);
75
+
76
+ // Requires:
77
+ // descriptor != NULL
78
+ //
79
+ // Returns:
80
+ // The fully-qualified Java class name.
81
+ std::string ClassName(const ServiceDescriptor* descriptor);
82
+
83
+ // Requires:
84
+ // descriptor != NULL
85
+ //
86
+ // Returns:
87
+ // Java package name.
88
+ std::string FileJavaPackage(const FileDescriptor* descriptor);
89
+
90
+ // Requires:
91
+ // descriptor != NULL
92
+ // Returns:
93
+ // Capitalized camel case name field name.
94
+ std::string CapitalizedFieldName(const FieldDescriptor* descriptor);
95
+
96
+ } // namespace java
97
+ } // namespace compiler
98
+ } // namespace protobuf
99
+ } // namespace google
100
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/primitive_field.h ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__
37
+
38
+ #include <map>
39
+ #include <string>
40
+
41
+ #include <google/protobuf/compiler/java/field.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+ class Context; // context.h
48
+ class ClassNameResolver; // name_resolver.h
49
+ } // namespace java
50
+ } // namespace compiler
51
+ } // namespace protobuf
52
+ } // namespace google
53
+
54
+ namespace google {
55
+ namespace protobuf {
56
+ namespace compiler {
57
+ namespace java {
58
+
59
+ class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator {
60
+ public:
61
+ explicit ImmutablePrimitiveFieldGenerator(const FieldDescriptor* descriptor,
62
+ int messageBitIndex,
63
+ int builderBitIndex,
64
+ Context* context);
65
+ ~ImmutablePrimitiveFieldGenerator() override;
66
+
67
+ // implements ImmutableFieldGenerator
68
+ // ---------------------------------------
69
+ int GetNumBitsForMessage() const override;
70
+ int GetNumBitsForBuilder() const override;
71
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
72
+ void GenerateMembers(io::Printer* printer) const override;
73
+ void GenerateBuilderMembers(io::Printer* printer) const override;
74
+ void GenerateInitializationCode(io::Printer* printer) const override;
75
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
76
+ void GenerateMergingCode(io::Printer* printer) const override;
77
+ void GenerateBuildingCode(io::Printer* printer) const override;
78
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
79
+ void GenerateSerializationCode(io::Printer* printer) const override;
80
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
81
+ void GenerateFieldBuilderInitializationCode(
82
+ io::Printer* printer) const override;
83
+ void GenerateEqualsCode(io::Printer* printer) const override;
84
+ void GenerateHashCode(io::Printer* printer) const override;
85
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
86
+
87
+ std::string GetBoxedType() const override;
88
+
89
+ protected:
90
+ const FieldDescriptor* descriptor_;
91
+ std::map<std::string, std::string> variables_;
92
+ ClassNameResolver* name_resolver_;
93
+
94
+ private:
95
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveFieldGenerator);
96
+ };
97
+
98
+ class ImmutablePrimitiveOneofFieldGenerator
99
+ : public ImmutablePrimitiveFieldGenerator {
100
+ public:
101
+ ImmutablePrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor,
102
+ int messageBitIndex,
103
+ int builderBitIndex, Context* context);
104
+ ~ImmutablePrimitiveOneofFieldGenerator() override;
105
+
106
+ void GenerateMembers(io::Printer* printer) const override;
107
+ void GenerateBuilderMembers(io::Printer* printer) const override;
108
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
109
+ void GenerateBuildingCode(io::Printer* printer) const override;
110
+ void GenerateMergingCode(io::Printer* printer) const override;
111
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
112
+ void GenerateSerializationCode(io::Printer* printer) const override;
113
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
114
+
115
+ private:
116
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldGenerator);
117
+ };
118
+
119
+ class RepeatedImmutablePrimitiveFieldGenerator
120
+ : public ImmutableFieldGenerator {
121
+ public:
122
+ explicit RepeatedImmutablePrimitiveFieldGenerator(
123
+ const FieldDescriptor* descriptor, int messageBitIndex,
124
+ int builderBitIndex, Context* context);
125
+ ~RepeatedImmutablePrimitiveFieldGenerator() override;
126
+
127
+ // implements ImmutableFieldGenerator ---------------------------------------
128
+ int GetNumBitsForMessage() const override;
129
+ int GetNumBitsForBuilder() const override;
130
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
131
+ void GenerateMembers(io::Printer* printer) const override;
132
+ void GenerateBuilderMembers(io::Printer* printer) const override;
133
+ void GenerateInitializationCode(io::Printer* printer) const override;
134
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
135
+ void GenerateMergingCode(io::Printer* printer) const override;
136
+ void GenerateBuildingCode(io::Printer* printer) const override;
137
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
138
+ void GenerateBuilderParsingCodeFromPacked(
139
+ io::Printer* printer) const override;
140
+ void GenerateSerializationCode(io::Printer* printer) const override;
141
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
142
+ void GenerateFieldBuilderInitializationCode(
143
+ io::Printer* printer) const override;
144
+ void GenerateEqualsCode(io::Printer* printer) const override;
145
+ void GenerateHashCode(io::Printer* printer) const override;
146
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
147
+
148
+ std::string GetBoxedType() const override;
149
+
150
+ private:
151
+ const FieldDescriptor* descriptor_;
152
+ std::map<std::string, std::string> variables_;
153
+ ClassNameResolver* name_resolver_;
154
+
155
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutablePrimitiveFieldGenerator);
156
+ };
157
+
158
+ } // namespace java
159
+ } // namespace compiler
160
+ } // namespace protobuf
161
+ } // namespace google
162
+
163
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/primitive_field_lite.h ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__
37
+
38
+ #include <cstdint>
39
+ #include <map>
40
+ #include <string>
41
+
42
+ #include <google/protobuf/compiler/java/field.h>
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+ namespace compiler {
47
+ namespace java {
48
+ class Context; // context.h
49
+ class ClassNameResolver; // name_resolver.h
50
+ } // namespace java
51
+ } // namespace compiler
52
+ } // namespace protobuf
53
+ } // namespace google
54
+
55
+ namespace google {
56
+ namespace protobuf {
57
+ namespace compiler {
58
+ namespace java {
59
+
60
+ class ImmutablePrimitiveFieldLiteGenerator
61
+ : public ImmutableFieldLiteGenerator {
62
+ public:
63
+ explicit ImmutablePrimitiveFieldLiteGenerator(
64
+ const FieldDescriptor* descriptor, int messageBitIndex, Context* context);
65
+ ~ImmutablePrimitiveFieldLiteGenerator() override;
66
+
67
+ // implements ImmutableFieldLiteGenerator
68
+ // ------------------------------------
69
+ int GetNumBitsForMessage() const override;
70
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
71
+ void GenerateMembers(io::Printer* printer) const override;
72
+ void GenerateBuilderMembers(io::Printer* printer) const override;
73
+ void GenerateInitializationCode(io::Printer* printer) const override;
74
+ void GenerateFieldInfo(io::Printer* printer,
75
+ std::vector<uint16_t>* output) const override;
76
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
77
+
78
+ std::string GetBoxedType() const override;
79
+
80
+ protected:
81
+ const FieldDescriptor* descriptor_;
82
+ std::map<std::string, std::string> variables_;
83
+ const int messageBitIndex_;
84
+ ClassNameResolver* name_resolver_;
85
+
86
+ private:
87
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveFieldLiteGenerator);
88
+ };
89
+
90
+ class ImmutablePrimitiveOneofFieldLiteGenerator
91
+ : public ImmutablePrimitiveFieldLiteGenerator {
92
+ public:
93
+ ImmutablePrimitiveOneofFieldLiteGenerator(const FieldDescriptor* descriptor,
94
+ int messageBitIndex,
95
+ Context* context);
96
+ ~ImmutablePrimitiveOneofFieldLiteGenerator() override;
97
+
98
+ void GenerateMembers(io::Printer* printer) const override;
99
+ void GenerateBuilderMembers(io::Printer* printer) const override;
100
+
101
+ void GenerateFieldInfo(io::Printer* printer,
102
+ std::vector<uint16_t>* output) const override;
103
+
104
+ private:
105
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldLiteGenerator);
106
+ };
107
+
108
+ class RepeatedImmutablePrimitiveFieldLiteGenerator
109
+ : public ImmutableFieldLiteGenerator {
110
+ public:
111
+ explicit RepeatedImmutablePrimitiveFieldLiteGenerator(
112
+ const FieldDescriptor* descriptor, int messageBitIndex, Context* context);
113
+ ~RepeatedImmutablePrimitiveFieldLiteGenerator() override;
114
+
115
+ // implements ImmutableFieldLiteGenerator ------------------------------------
116
+ int GetNumBitsForMessage() const override;
117
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
118
+ void GenerateMembers(io::Printer* printer) const override;
119
+ void GenerateBuilderMembers(io::Printer* printer) const override;
120
+ void GenerateInitializationCode(io::Printer* printer) const override;
121
+ void GenerateFieldInfo(io::Printer* printer,
122
+ std::vector<uint16_t>* output) const override;
123
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
124
+
125
+ std::string GetBoxedType() const override;
126
+
127
+ private:
128
+ const FieldDescriptor* descriptor_;
129
+ std::map<std::string, std::string> variables_;
130
+ Context* context_;
131
+ ClassNameResolver* name_resolver_;
132
+
133
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutablePrimitiveFieldLiteGenerator);
134
+ };
135
+
136
+ } // namespace java
137
+ } // namespace compiler
138
+ } // namespace protobuf
139
+ } // namespace google
140
+
141
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/shared_code_generator.h ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: xiaofeng@google.com (Feng Xiao)
32
+ //
33
+ // Generators that generate shared code between immutable API and mutable API.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
36
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
37
+
38
+ #include <memory>
39
+ #include <string>
40
+ #include <vector>
41
+
42
+ #include <google/protobuf/stubs/common.h>
43
+ #include <google/protobuf/compiler/java/options.h>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ class FileDescriptor; // descriptor.h
48
+ namespace compiler {
49
+ class GeneratorContext; // code_generator.h
50
+ namespace java {
51
+ class ClassNameResolver; // name_resolver.h
52
+ }
53
+ } // namespace compiler
54
+ namespace io {
55
+ class Printer; // printer.h
56
+ }
57
+ } // namespace protobuf
58
+ } // namespace google
59
+
60
+ namespace google {
61
+ namespace protobuf {
62
+ namespace compiler {
63
+ namespace java {
64
+
65
+ // A generator that generates code that are shared between immutable API
66
+ // and mutable API. Currently only descriptors are shared.
67
+ class SharedCodeGenerator {
68
+ public:
69
+ SharedCodeGenerator(const FileDescriptor* file, const Options& options);
70
+ ~SharedCodeGenerator();
71
+
72
+ void Generate(GeneratorContext* generator_context,
73
+ std::vector<std::string>* file_list,
74
+ std::vector<std::string>* annotation_file_list);
75
+
76
+ void GenerateDescriptors(io::Printer* printer);
77
+
78
+ private:
79
+ std::unique_ptr<ClassNameResolver> name_resolver_;
80
+ const FileDescriptor* file_;
81
+ const Options options_;
82
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator);
83
+ };
84
+
85
+ } // namespace java
86
+ } // namespace compiler
87
+ } // namespace protobuf
88
+ } // namespace google
89
+
90
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/string_field.h ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Author: jonp@google.com (Jon Perlow)
33
+ // Based on original Protocol Buffers design by
34
+ // Sanjay Ghemawat, Jeff Dean, and others.
35
+
36
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__
37
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__
38
+
39
+ #include <map>
40
+ #include <string>
41
+
42
+ #include <google/protobuf/compiler/java/field.h>
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+ namespace compiler {
47
+ namespace java {
48
+ class Context; // context.h
49
+ class ClassNameResolver; // name_resolver.h
50
+ } // namespace java
51
+ } // namespace compiler
52
+ } // namespace protobuf
53
+ } // namespace google
54
+
55
+ namespace google {
56
+ namespace protobuf {
57
+ namespace compiler {
58
+ namespace java {
59
+
60
+ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator {
61
+ public:
62
+ explicit ImmutableStringFieldGenerator(const FieldDescriptor* descriptor,
63
+ int messageBitIndex,
64
+ int builderBitIndex, Context* context);
65
+ ~ImmutableStringFieldGenerator() override;
66
+
67
+ // implements ImmutableFieldGenerator
68
+ // ---------------------------------------
69
+ int GetNumBitsForMessage() const override;
70
+ int GetNumBitsForBuilder() const override;
71
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
72
+ void GenerateMembers(io::Printer* printer) const override;
73
+ void GenerateBuilderMembers(io::Printer* printer) const override;
74
+ void GenerateInitializationCode(io::Printer* printer) const override;
75
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
76
+ void GenerateMergingCode(io::Printer* printer) const override;
77
+ void GenerateBuildingCode(io::Printer* printer) const override;
78
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
79
+ void GenerateSerializationCode(io::Printer* printer) const override;
80
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
81
+ void GenerateFieldBuilderInitializationCode(
82
+ io::Printer* printer) const override;
83
+ void GenerateEqualsCode(io::Printer* printer) const override;
84
+ void GenerateHashCode(io::Printer* printer) const override;
85
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
86
+
87
+ std::string GetBoxedType() const override;
88
+
89
+ protected:
90
+ const FieldDescriptor* descriptor_;
91
+ std::map<std::string, std::string> variables_;
92
+ ClassNameResolver* name_resolver_;
93
+
94
+ private:
95
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringFieldGenerator);
96
+ };
97
+
98
+ class ImmutableStringOneofFieldGenerator
99
+ : public ImmutableStringFieldGenerator {
100
+ public:
101
+ ImmutableStringOneofFieldGenerator(const FieldDescriptor* descriptor,
102
+ int messageBitIndex, int builderBitIndex,
103
+ Context* context);
104
+ ~ImmutableStringOneofFieldGenerator() override;
105
+
106
+ private:
107
+ void GenerateMembers(io::Printer* printer) const override;
108
+ void GenerateBuilderMembers(io::Printer* printer) const override;
109
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
110
+ void GenerateMergingCode(io::Printer* printer) const override;
111
+ void GenerateBuildingCode(io::Printer* printer) const override;
112
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
113
+ void GenerateSerializationCode(io::Printer* printer) const override;
114
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
115
+
116
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldGenerator);
117
+ };
118
+
119
+ class RepeatedImmutableStringFieldGenerator : public ImmutableFieldGenerator {
120
+ public:
121
+ explicit RepeatedImmutableStringFieldGenerator(
122
+ const FieldDescriptor* descriptor, int messageBitIndex,
123
+ int builderBitIndex, Context* context);
124
+ ~RepeatedImmutableStringFieldGenerator() override;
125
+
126
+ // implements ImmutableFieldGenerator ---------------------------------------
127
+ int GetNumBitsForMessage() const override;
128
+ int GetNumBitsForBuilder() const override;
129
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
130
+ void GenerateMembers(io::Printer* printer) const override;
131
+ void GenerateBuilderMembers(io::Printer* printer) const override;
132
+ void GenerateInitializationCode(io::Printer* printer) const override;
133
+ void GenerateBuilderClearCode(io::Printer* printer) const override;
134
+ void GenerateMergingCode(io::Printer* printer) const override;
135
+ void GenerateBuildingCode(io::Printer* printer) const override;
136
+ void GenerateBuilderParsingCode(io::Printer* printer) const override;
137
+ void GenerateSerializationCode(io::Printer* printer) const override;
138
+ void GenerateSerializedSizeCode(io::Printer* printer) const override;
139
+ void GenerateFieldBuilderInitializationCode(
140
+ io::Printer* printer) const override;
141
+ void GenerateEqualsCode(io::Printer* printer) const override;
142
+ void GenerateHashCode(io::Printer* printer) const override;
143
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
144
+
145
+ std::string GetBoxedType() const override;
146
+
147
+ private:
148
+ const FieldDescriptor* descriptor_;
149
+ std::map<std::string, std::string> variables_;
150
+ ClassNameResolver* name_resolver_;
151
+
152
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableStringFieldGenerator);
153
+ };
154
+
155
+ } // namespace java
156
+ } // namespace compiler
157
+ } // namespace protobuf
158
+ } // namespace google
159
+
160
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/compiler/java/string_field_lite.h ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Author: jonp@google.com (Jon Perlow)
33
+ // Based on original Protocol Buffers design by
34
+ // Sanjay Ghemawat, Jeff Dean, and others.
35
+
36
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__
37
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__
38
+
39
+ #include <cstdint>
40
+ #include <map>
41
+ #include <string>
42
+
43
+ #include <google/protobuf/compiler/java/field.h>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ namespace compiler {
48
+ namespace java {
49
+ class Context; // context.h
50
+ class ClassNameResolver; // name_resolver.h
51
+ } // namespace java
52
+ } // namespace compiler
53
+ } // namespace protobuf
54
+ } // namespace google
55
+
56
+ namespace google {
57
+ namespace protobuf {
58
+ namespace compiler {
59
+ namespace java {
60
+
61
+ class ImmutableStringFieldLiteGenerator : public ImmutableFieldLiteGenerator {
62
+ public:
63
+ explicit ImmutableStringFieldLiteGenerator(const FieldDescriptor* descriptor,
64
+ int messageBitIndex,
65
+ Context* context);
66
+ ~ImmutableStringFieldLiteGenerator() override;
67
+
68
+ // implements ImmutableFieldLiteGenerator
69
+ // ------------------------------------
70
+ int GetNumBitsForMessage() const override;
71
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
72
+ void GenerateMembers(io::Printer* printer) const override;
73
+ void GenerateBuilderMembers(io::Printer* printer) const override;
74
+ void GenerateInitializationCode(io::Printer* printer) const override;
75
+ void GenerateFieldInfo(io::Printer* printer,
76
+ std::vector<uint16_t>* output) const override;
77
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
78
+
79
+ std::string GetBoxedType() const override;
80
+
81
+ protected:
82
+ const FieldDescriptor* descriptor_;
83
+ std::map<std::string, std::string> variables_;
84
+ const int messageBitIndex_;
85
+ ClassNameResolver* name_resolver_;
86
+
87
+ private:
88
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringFieldLiteGenerator);
89
+ };
90
+
91
+ class ImmutableStringOneofFieldLiteGenerator
92
+ : public ImmutableStringFieldLiteGenerator {
93
+ public:
94
+ ImmutableStringOneofFieldLiteGenerator(const FieldDescriptor* descriptor,
95
+ int messageBitIndex, Context* context);
96
+ ~ImmutableStringOneofFieldLiteGenerator() override;
97
+
98
+ private:
99
+ void GenerateMembers(io::Printer* printer) const override;
100
+ void GenerateBuilderMembers(io::Printer* printer) const override;
101
+ void GenerateFieldInfo(io::Printer* printer,
102
+ std::vector<uint16_t>* output) const override;
103
+
104
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldLiteGenerator);
105
+ };
106
+
107
+ class RepeatedImmutableStringFieldLiteGenerator
108
+ : public ImmutableFieldLiteGenerator {
109
+ public:
110
+ explicit RepeatedImmutableStringFieldLiteGenerator(
111
+ const FieldDescriptor* descriptor, int messageBitIndex, Context* context);
112
+ ~RepeatedImmutableStringFieldLiteGenerator() override;
113
+
114
+ // implements ImmutableFieldLiteGenerator ------------------------------------
115
+ int GetNumBitsForMessage() const override;
116
+ void GenerateInterfaceMembers(io::Printer* printer) const override;
117
+ void GenerateMembers(io::Printer* printer) const override;
118
+ void GenerateBuilderMembers(io::Printer* printer) const override;
119
+ void GenerateInitializationCode(io::Printer* printer) const override;
120
+ void GenerateFieldInfo(io::Printer* printer,
121
+ std::vector<uint16_t>* output) const override;
122
+ void GenerateKotlinDslMembers(io::Printer* printer) const override;
123
+
124
+ std::string GetBoxedType() const override;
125
+
126
+ private:
127
+ const FieldDescriptor* descriptor_;
128
+ std::map<std::string, std::string> variables_;
129
+ ClassNameResolver* name_resolver_;
130
+
131
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableStringFieldLiteGenerator);
132
+ };
133
+
134
+ } // namespace java
135
+ } // namespace compiler
136
+ } // namespace protobuf
137
+ } // namespace google
138
+
139
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/bytestream.h ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // This file declares the ByteSink and ByteSource abstract interfaces. These
32
+ // interfaces represent objects that consume (ByteSink) or produce (ByteSource)
33
+ // a sequence of bytes. Using these abstract interfaces in your APIs can help
34
+ // make your code work with a variety of input and output types.
35
+ //
36
+ // This file also declares the following commonly used implementations of these
37
+ // interfaces.
38
+ //
39
+ // ByteSink:
40
+ // UncheckedArrayByteSink Writes to an array, without bounds checking
41
+ // CheckedArrayByteSink Writes to an array, with bounds checking
42
+ // GrowingArrayByteSink Allocates and writes to a growable buffer
43
+ // StringByteSink Writes to an STL string
44
+ // NullByteSink Consumes a never-ending stream of bytes
45
+ //
46
+ // ByteSource:
47
+ // ArrayByteSource Reads from an array or string/StringPiece
48
+ // LimitedByteSource Limits the number of bytes read from an
49
+
50
+ #ifndef GOOGLE_PROTOBUF_STUBS_BYTESTREAM_H_
51
+ #define GOOGLE_PROTOBUF_STUBS_BYTESTREAM_H_
52
+
53
+ #include <stddef.h>
54
+ #include <string>
55
+
56
+ #include <google/protobuf/stubs/common.h>
57
+ #include <google/protobuf/stubs/stringpiece.h>
58
+
59
+ #include <google/protobuf/port_def.inc>
60
+
61
+ class CordByteSink;
62
+
63
+ namespace google {
64
+ namespace protobuf {
65
+ namespace strings {
66
+
67
+ // An abstract interface for an object that consumes a sequence of bytes. This
68
+ // interface offers a way to append data as well as a Flush() function.
69
+ //
70
+ // Example:
71
+ //
72
+ // string my_data;
73
+ // ...
74
+ // ByteSink* sink = ...
75
+ // sink->Append(my_data.data(), my_data.size());
76
+ // sink->Flush();
77
+ //
78
+ class PROTOBUF_EXPORT ByteSink {
79
+ public:
80
+ ByteSink() {}
81
+ virtual ~ByteSink() {}
82
+
83
+ // Appends the "n" bytes starting at "bytes".
84
+ virtual void Append(const char* bytes, size_t n) = 0;
85
+
86
+ // Flushes internal buffers. The default implementation does nothing. ByteSink
87
+ // subclasses may use internal buffers that require calling Flush() at the end
88
+ // of the stream.
89
+ virtual void Flush();
90
+
91
+ private:
92
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ByteSink);
93
+ };
94
+
95
+ // An abstract interface for an object that produces a fixed-size sequence of
96
+ // bytes.
97
+ //
98
+ // Example:
99
+ //
100
+ // ByteSource* source = ...
101
+ // while (source->Available() > 0) {
102
+ // StringPiece data = source->Peek();
103
+ // ... do something with "data" ...
104
+ // source->Skip(data.length());
105
+ // }
106
+ //
107
+ class PROTOBUF_EXPORT ByteSource {
108
+ public:
109
+ ByteSource() {}
110
+ virtual ~ByteSource() {}
111
+
112
+ // Returns the number of bytes left to read from the source. Available()
113
+ // should decrease by N each time Skip(N) is called. Available() may not
114
+ // increase. Available() returning 0 indicates that the ByteSource is
115
+ // exhausted.
116
+ //
117
+ // Note: Size() may have been a more appropriate name as it's more
118
+ // indicative of the fixed-size nature of a ByteSource.
119
+ virtual size_t Available() const = 0;
120
+
121
+ // Returns a StringPiece of the next contiguous region of the source. Does not
122
+ // reposition the source. The returned region is empty iff Available() == 0.
123
+ //
124
+ // The returned region is valid until the next call to Skip() or until this
125
+ // object is destroyed, whichever occurs first.
126
+ //
127
+ // The length of the returned StringPiece will be <= Available().
128
+ virtual StringPiece Peek() = 0;
129
+
130
+ // Skips the next n bytes. Invalidates any StringPiece returned by a previous
131
+ // call to Peek().
132
+ //
133
+ // REQUIRES: Available() >= n
134
+ virtual void Skip(size_t n) = 0;
135
+
136
+ // Writes the next n bytes in this ByteSource to the given ByteSink, and
137
+ // advances this ByteSource past the copied bytes. The default implementation
138
+ // of this method just copies the bytes normally, but subclasses might
139
+ // override CopyTo to optimize certain cases.
140
+ //
141
+ // REQUIRES: Available() >= n
142
+ virtual void CopyTo(ByteSink* sink, size_t n);
143
+
144
+ private:
145
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ByteSource);
146
+ };
147
+
148
+ //
149
+ // Some commonly used implementations of ByteSink
150
+ //
151
+
152
+ // Implementation of ByteSink that writes to an unsized byte array. No
153
+ // bounds-checking is performed--it is the caller's responsibility to ensure
154
+ // that the destination array is large enough.
155
+ //
156
+ // Example:
157
+ //
158
+ // char buf[10];
159
+ // UncheckedArrayByteSink sink(buf);
160
+ // sink.Append("hi", 2); // OK
161
+ // sink.Append(data, 100); // WOOPS! Overflows buf[10].
162
+ //
163
+ class PROTOBUF_EXPORT UncheckedArrayByteSink : public ByteSink {
164
+ public:
165
+ explicit UncheckedArrayByteSink(char* dest) : dest_(dest) {}
166
+ virtual void Append(const char* data, size_t n) override;
167
+
168
+ // Returns the current output pointer so that a caller can see how many bytes
169
+ // were produced.
170
+ //
171
+ // Note: this method is not part of the ByteSink interface.
172
+ char* CurrentDestination() const { return dest_; }
173
+
174
+ private:
175
+ char* dest_;
176
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UncheckedArrayByteSink);
177
+ };
178
+
179
+ // Implementation of ByteSink that writes to a sized byte array. This sink will
180
+ // not write more than "capacity" bytes to outbuf. Once "capacity" bytes are
181
+ // appended, subsequent bytes will be ignored and Overflowed() will return true.
182
+ // Overflowed() does not cause a runtime error (i.e., it does not CHECK fail).
183
+ //
184
+ // Example:
185
+ //
186
+ // char buf[10];
187
+ // CheckedArrayByteSink sink(buf, 10);
188
+ // sink.Append("hi", 2); // OK
189
+ // sink.Append(data, 100); // Will only write 8 more bytes
190
+ //
191
+ class PROTOBUF_EXPORT CheckedArrayByteSink : public ByteSink {
192
+ public:
193
+ CheckedArrayByteSink(char* outbuf, size_t capacity);
194
+ virtual void Append(const char* bytes, size_t n) override;
195
+
196
+ // Returns the number of bytes actually written to the sink.
197
+ size_t NumberOfBytesWritten() const { return size_; }
198
+
199
+ // Returns true if any bytes were discarded, i.e., if there was an
200
+ // attempt to write more than 'capacity' bytes.
201
+ bool Overflowed() const { return overflowed_; }
202
+
203
+ private:
204
+ char* outbuf_;
205
+ const size_t capacity_;
206
+ size_t size_;
207
+ bool overflowed_;
208
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CheckedArrayByteSink);
209
+ };
210
+
211
+ // Implementation of ByteSink that allocates an internal buffer (a char array)
212
+ // and expands it as needed to accommodate appended data (similar to a string),
213
+ // and allows the caller to take ownership of the internal buffer via the
214
+ // GetBuffer() method. The buffer returned from GetBuffer() must be deleted by
215
+ // the caller with delete[]. GetBuffer() also sets the internal buffer to be
216
+ // empty, and subsequent appends to the sink will create a new buffer. The
217
+ // destructor will free the internal buffer if GetBuffer() was not called.
218
+ //
219
+ // Example:
220
+ //
221
+ // GrowingArrayByteSink sink(10);
222
+ // sink.Append("hi", 2);
223
+ // sink.Append(data, n);
224
+ // const char* buf = sink.GetBuffer(); // Ownership transferred
225
+ // delete[] buf;
226
+ //
227
+ class PROTOBUF_EXPORT GrowingArrayByteSink : public strings::ByteSink {
228
+ public:
229
+ explicit GrowingArrayByteSink(size_t estimated_size);
230
+ virtual ~GrowingArrayByteSink();
231
+ virtual void Append(const char* bytes, size_t n) override;
232
+
233
+ // Returns the allocated buffer, and sets nbytes to its size. The caller takes
234
+ // ownership of the buffer and must delete it with delete[].
235
+ char* GetBuffer(size_t* nbytes);
236
+
237
+ private:
238
+ void Expand(size_t amount);
239
+ void ShrinkToFit();
240
+
241
+ size_t capacity_;
242
+ char* buf_;
243
+ size_t size_;
244
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GrowingArrayByteSink);
245
+ };
246
+
247
+ // Implementation of ByteSink that appends to the given string.
248
+ // Existing contents of "dest" are not modified; new data is appended.
249
+ //
250
+ // Example:
251
+ //
252
+ // string dest = "Hello ";
253
+ // StringByteSink sink(&dest);
254
+ // sink.Append("World", 5);
255
+ // assert(dest == "Hello World");
256
+ //
257
+ class PROTOBUF_EXPORT StringByteSink : public ByteSink {
258
+ public:
259
+ explicit StringByteSink(std::string* dest) : dest_(dest) {}
260
+ virtual void Append(const char* data, size_t n) override;
261
+
262
+ private:
263
+ std::string* dest_;
264
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringByteSink);
265
+ };
266
+
267
+ // Implementation of ByteSink that discards all data.
268
+ //
269
+ // Example:
270
+ //
271
+ // NullByteSink sink;
272
+ // sink.Append(data, data.size()); // All data ignored.
273
+ //
274
+ class PROTOBUF_EXPORT NullByteSink : public ByteSink {
275
+ public:
276
+ NullByteSink() {}
277
+ void Append(const char* /*data*/, size_t /*n*/) override {}
278
+
279
+ private:
280
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NullByteSink);
281
+ };
282
+
283
+ //
284
+ // Some commonly used implementations of ByteSource
285
+ //
286
+
287
+ // Implementation of ByteSource that reads from a StringPiece.
288
+ //
289
+ // Example:
290
+ //
291
+ // string data = "Hello";
292
+ // ArrayByteSource source(data);
293
+ // assert(source.Available() == 5);
294
+ // assert(source.Peek() == "Hello");
295
+ //
296
+ class PROTOBUF_EXPORT ArrayByteSource : public ByteSource {
297
+ public:
298
+ explicit ArrayByteSource(StringPiece s) : input_(s) {}
299
+
300
+ virtual size_t Available() const override;
301
+ virtual StringPiece Peek() override;
302
+ virtual void Skip(size_t n) override;
303
+
304
+ private:
305
+ StringPiece input_;
306
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArrayByteSource);
307
+ };
308
+
309
+ // Implementation of ByteSource that wraps another ByteSource, limiting the
310
+ // number of bytes returned.
311
+ //
312
+ // The caller maintains ownership of the underlying source, and may not use the
313
+ // underlying source while using the LimitByteSource object. The underlying
314
+ // source's pointer is advanced by n bytes every time this LimitByteSource
315
+ // object is advanced by n.
316
+ //
317
+ // Example:
318
+ //
319
+ // string data = "Hello World";
320
+ // ArrayByteSource abs(data);
321
+ // assert(abs.Available() == data.size());
322
+ //
323
+ // LimitByteSource limit(abs, 5);
324
+ // assert(limit.Available() == 5);
325
+ // assert(limit.Peek() == "Hello");
326
+ //
327
+ class PROTOBUF_EXPORT LimitByteSource : public ByteSource {
328
+ public:
329
+ // Returns at most "limit" bytes from "source".
330
+ LimitByteSource(ByteSource* source, size_t limit);
331
+
332
+ virtual size_t Available() const override;
333
+ virtual StringPiece Peek() override;
334
+ virtual void Skip(size_t n) override;
335
+
336
+ // We override CopyTo so that we can forward to the underlying source, in
337
+ // case it has an efficient implementation of CopyTo.
338
+ virtual void CopyTo(ByteSink* sink, size_t n) override;
339
+
340
+ private:
341
+ ByteSource* source_;
342
+ size_t limit_;
343
+ };
344
+
345
+ } // namespace strings
346
+ } // namespace protobuf
347
+ } // namespace google
348
+
349
+ #include <google/protobuf/port_undef.inc>
350
+
351
+ #endif // GOOGLE_PROTOBUF_STUBS_BYTESTREAM_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/callback.h ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef GOOGLE_PROTOBUF_STUBS_CALLBACK_H_
2
+ #define GOOGLE_PROTOBUF_STUBS_CALLBACK_H_
3
+
4
+ #include <type_traits>
5
+
6
+ #include <google/protobuf/stubs/macros.h>
7
+
8
+ #include <google/protobuf/port_def.inc>
9
+
10
+ // ===================================================================
11
+ // emulates google3/base/callback.h
12
+
13
+ namespace google {
14
+ namespace protobuf {
15
+
16
+ // Abstract interface for a callback. When calling an RPC, you must provide
17
+ // a Closure to call when the procedure completes. See the Service interface
18
+ // in service.h.
19
+ //
20
+ // To automatically construct a Closure which calls a particular function or
21
+ // method with a particular set of parameters, use the NewCallback() function.
22
+ // Example:
23
+ // void FooDone(const FooResponse* response) {
24
+ // ...
25
+ // }
26
+ //
27
+ // void CallFoo() {
28
+ // ...
29
+ // // When done, call FooDone() and pass it a pointer to the response.
30
+ // Closure* callback = NewCallback(&FooDone, response);
31
+ // // Make the call.
32
+ // service->Foo(controller, request, response, callback);
33
+ // }
34
+ //
35
+ // Example that calls a method:
36
+ // class Handler {
37
+ // public:
38
+ // ...
39
+ //
40
+ // void FooDone(const FooResponse* response) {
41
+ // ...
42
+ // }
43
+ //
44
+ // void CallFoo() {
45
+ // ...
46
+ // // When done, call FooDone() and pass it a pointer to the response.
47
+ // Closure* callback = NewCallback(this, &Handler::FooDone, response);
48
+ // // Make the call.
49
+ // service->Foo(controller, request, response, callback);
50
+ // }
51
+ // };
52
+ //
53
+ // Currently NewCallback() supports binding zero, one, or two arguments.
54
+ //
55
+ // Callbacks created with NewCallback() automatically delete themselves when
56
+ // executed. They should be used when a callback is to be called exactly
57
+ // once (usually the case with RPC callbacks). If a callback may be called
58
+ // a different number of times (including zero), create it with
59
+ // NewPermanentCallback() instead. You are then responsible for deleting the
60
+ // callback (using the "delete" keyword as normal).
61
+ //
62
+ // Note that NewCallback() is a bit touchy regarding argument types. Generally,
63
+ // the values you provide for the parameter bindings must exactly match the
64
+ // types accepted by the callback function. For example:
65
+ // void Foo(std::string s);
66
+ // NewCallback(&Foo, "foo"); // WON'T WORK: const char* != string
67
+ // NewCallback(&Foo, std::string("foo")); // WORKS
68
+ // Also note that the arguments cannot be references:
69
+ // void Foo(const std::string& s);
70
+ // std::string my_str;
71
+ // NewCallback(&Foo, my_str); // WON'T WORK: Can't use references.
72
+ // However, correctly-typed pointers will work just fine.
73
+ class PROTOBUF_EXPORT Closure {
74
+ public:
75
+ Closure() {}
76
+ virtual ~Closure();
77
+
78
+ virtual void Run() = 0;
79
+
80
+ private:
81
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Closure);
82
+ };
83
+
84
+ template<typename R>
85
+ class ResultCallback {
86
+ public:
87
+ ResultCallback() {}
88
+ virtual ~ResultCallback() {}
89
+
90
+ virtual R Run() = 0;
91
+
92
+ private:
93
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ResultCallback);
94
+ };
95
+
96
+ template <typename R, typename A1>
97
+ class PROTOBUF_EXPORT ResultCallback1 {
98
+ public:
99
+ ResultCallback1() {}
100
+ virtual ~ResultCallback1() {}
101
+
102
+ virtual R Run(A1) = 0;
103
+
104
+ private:
105
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ResultCallback1);
106
+ };
107
+
108
+ template <typename R, typename A1, typename A2>
109
+ class PROTOBUF_EXPORT ResultCallback2 {
110
+ public:
111
+ ResultCallback2() {}
112
+ virtual ~ResultCallback2() {}
113
+
114
+ virtual R Run(A1,A2) = 0;
115
+
116
+ private:
117
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ResultCallback2);
118
+ };
119
+
120
+ namespace internal {
121
+
122
+ class PROTOBUF_EXPORT FunctionClosure0 : public Closure {
123
+ public:
124
+ typedef void (*FunctionType)();
125
+
126
+ FunctionClosure0(FunctionType function, bool self_deleting)
127
+ : function_(function), self_deleting_(self_deleting) {}
128
+ ~FunctionClosure0();
129
+
130
+ void Run() override {
131
+ bool needs_delete = self_deleting_; // read in case callback deletes
132
+ function_();
133
+ if (needs_delete) delete this;
134
+ }
135
+
136
+ private:
137
+ FunctionType function_;
138
+ bool self_deleting_;
139
+ };
140
+
141
+ template <typename Class>
142
+ class MethodClosure0 : public Closure {
143
+ public:
144
+ typedef void (Class::*MethodType)();
145
+
146
+ MethodClosure0(Class* object, MethodType method, bool self_deleting)
147
+ : object_(object), method_(method), self_deleting_(self_deleting) {}
148
+ ~MethodClosure0() {}
149
+
150
+ void Run() override {
151
+ bool needs_delete = self_deleting_; // read in case callback deletes
152
+ (object_->*method_)();
153
+ if (needs_delete) delete this;
154
+ }
155
+
156
+ private:
157
+ Class* object_;
158
+ MethodType method_;
159
+ bool self_deleting_;
160
+ };
161
+
162
+ template <typename Arg1>
163
+ class FunctionClosure1 : public Closure {
164
+ public:
165
+ typedef void (*FunctionType)(Arg1 arg1);
166
+
167
+ FunctionClosure1(FunctionType function, bool self_deleting,
168
+ Arg1 arg1)
169
+ : function_(function), self_deleting_(self_deleting),
170
+ arg1_(arg1) {}
171
+ ~FunctionClosure1() {}
172
+
173
+ void Run() override {
174
+ bool needs_delete = self_deleting_; // read in case callback deletes
175
+ function_(arg1_);
176
+ if (needs_delete) delete this;
177
+ }
178
+
179
+ private:
180
+ FunctionType function_;
181
+ bool self_deleting_;
182
+ Arg1 arg1_;
183
+ };
184
+
185
+ template <typename Class, typename Arg1>
186
+ class MethodClosure1 : public Closure {
187
+ public:
188
+ typedef void (Class::*MethodType)(Arg1 arg1);
189
+
190
+ MethodClosure1(Class* object, MethodType method, bool self_deleting,
191
+ Arg1 arg1)
192
+ : object_(object), method_(method), self_deleting_(self_deleting),
193
+ arg1_(arg1) {}
194
+ ~MethodClosure1() {}
195
+
196
+ void Run() override {
197
+ bool needs_delete = self_deleting_; // read in case callback deletes
198
+ (object_->*method_)(arg1_);
199
+ if (needs_delete) delete this;
200
+ }
201
+
202
+ private:
203
+ Class* object_;
204
+ MethodType method_;
205
+ bool self_deleting_;
206
+ Arg1 arg1_;
207
+ };
208
+
209
+ template <typename Arg1, typename Arg2>
210
+ class FunctionClosure2 : public Closure {
211
+ public:
212
+ typedef void (*FunctionType)(Arg1 arg1, Arg2 arg2);
213
+
214
+ FunctionClosure2(FunctionType function, bool self_deleting,
215
+ Arg1 arg1, Arg2 arg2)
216
+ : function_(function), self_deleting_(self_deleting),
217
+ arg1_(arg1), arg2_(arg2) {}
218
+ ~FunctionClosure2() {}
219
+
220
+ void Run() override {
221
+ bool needs_delete = self_deleting_; // read in case callback deletes
222
+ function_(arg1_, arg2_);
223
+ if (needs_delete) delete this;
224
+ }
225
+
226
+ private:
227
+ FunctionType function_;
228
+ bool self_deleting_;
229
+ Arg1 arg1_;
230
+ Arg2 arg2_;
231
+ };
232
+
233
+ template <typename Class, typename Arg1, typename Arg2>
234
+ class MethodClosure2 : public Closure {
235
+ public:
236
+ typedef void (Class::*MethodType)(Arg1 arg1, Arg2 arg2);
237
+
238
+ MethodClosure2(Class* object, MethodType method, bool self_deleting,
239
+ Arg1 arg1, Arg2 arg2)
240
+ : object_(object), method_(method), self_deleting_(self_deleting),
241
+ arg1_(arg1), arg2_(arg2) {}
242
+ ~MethodClosure2() {}
243
+
244
+ void Run() override {
245
+ bool needs_delete = self_deleting_; // read in case callback deletes
246
+ (object_->*method_)(arg1_, arg2_);
247
+ if (needs_delete) delete this;
248
+ }
249
+
250
+ private:
251
+ Class* object_;
252
+ MethodType method_;
253
+ bool self_deleting_;
254
+ Arg1 arg1_;
255
+ Arg2 arg2_;
256
+ };
257
+
258
+ template<typename R>
259
+ class FunctionResultCallback_0_0 : public ResultCallback<R> {
260
+ public:
261
+ typedef R (*FunctionType)();
262
+
263
+ FunctionResultCallback_0_0(FunctionType function, bool self_deleting)
264
+ : function_(function), self_deleting_(self_deleting) {}
265
+ ~FunctionResultCallback_0_0() {}
266
+
267
+ R Run() override {
268
+ bool needs_delete = self_deleting_; // read in case callback deletes
269
+ R result = function_();
270
+ if (needs_delete) delete this;
271
+ return result;
272
+ }
273
+
274
+ private:
275
+ FunctionType function_;
276
+ bool self_deleting_;
277
+ };
278
+
279
+ template<typename R, typename P1>
280
+ class FunctionResultCallback_1_0 : public ResultCallback<R> {
281
+ public:
282
+ typedef R (*FunctionType)(P1);
283
+
284
+ FunctionResultCallback_1_0(FunctionType function, bool self_deleting,
285
+ P1 p1)
286
+ : function_(function), self_deleting_(self_deleting), p1_(p1) {}
287
+ ~FunctionResultCallback_1_0() {}
288
+
289
+ R Run() override {
290
+ bool needs_delete = self_deleting_; // read in case callback deletes
291
+ R result = function_(p1_);
292
+ if (needs_delete) delete this;
293
+ return result;
294
+ }
295
+
296
+ private:
297
+ FunctionType function_;
298
+ bool self_deleting_;
299
+ P1 p1_;
300
+ };
301
+
302
+ template<typename R, typename Arg1>
303
+ class FunctionResultCallback_0_1 : public ResultCallback1<R, Arg1> {
304
+ public:
305
+ typedef R (*FunctionType)(Arg1 arg1);
306
+
307
+ FunctionResultCallback_0_1(FunctionType function, bool self_deleting)
308
+ : function_(function), self_deleting_(self_deleting) {}
309
+ ~FunctionResultCallback_0_1() {}
310
+
311
+ R Run(Arg1 a1) override {
312
+ bool needs_delete = self_deleting_; // read in case callback deletes
313
+ R result = function_(a1);
314
+ if (needs_delete) delete this;
315
+ return result;
316
+ }
317
+
318
+ private:
319
+ FunctionType function_;
320
+ bool self_deleting_;
321
+ };
322
+
323
+ template<typename R, typename P1, typename A1>
324
+ class FunctionResultCallback_1_1 : public ResultCallback1<R, A1> {
325
+ public:
326
+ typedef R (*FunctionType)(P1, A1);
327
+
328
+ FunctionResultCallback_1_1(FunctionType function, bool self_deleting,
329
+ P1 p1)
330
+ : function_(function), self_deleting_(self_deleting), p1_(p1) {}
331
+ ~FunctionResultCallback_1_1() {}
332
+
333
+ R Run(A1 a1) override {
334
+ bool needs_delete = self_deleting_; // read in case callback deletes
335
+ R result = function_(p1_, a1);
336
+ if (needs_delete) delete this;
337
+ return result;
338
+ }
339
+
340
+ private:
341
+ FunctionType function_;
342
+ bool self_deleting_;
343
+ P1 p1_;
344
+ };
345
+
346
+ template <typename T>
347
+ struct InternalConstRef {
348
+ typedef typename std::remove_reference<T>::type base_type;
349
+ typedef const base_type& type;
350
+ };
351
+
352
+ template<typename R, typename T>
353
+ class MethodResultCallback_0_0 : public ResultCallback<R> {
354
+ public:
355
+ typedef R (T::*MethodType)();
356
+ MethodResultCallback_0_0(T* object, MethodType method, bool self_deleting)
357
+ : object_(object),
358
+ method_(method),
359
+ self_deleting_(self_deleting) {}
360
+ ~MethodResultCallback_0_0() {}
361
+
362
+ R Run() {
363
+ bool needs_delete = self_deleting_;
364
+ R result = (object_->*method_)();
365
+ if (needs_delete) delete this;
366
+ return result;
367
+ }
368
+
369
+ private:
370
+ T* object_;
371
+ MethodType method_;
372
+ bool self_deleting_;
373
+ };
374
+
375
+ template <typename R, typename T, typename P1, typename P2, typename P3,
376
+ typename P4, typename P5, typename P6, typename A1, typename A2>
377
+ class MethodResultCallback_6_2 : public ResultCallback2<R, A1, A2> {
378
+ public:
379
+ typedef R (T::*MethodType)(P1, P2, P3, P4, P5, P6, A1, A2);
380
+ MethodResultCallback_6_2(T* object, MethodType method, bool self_deleting,
381
+ P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
382
+ : object_(object),
383
+ method_(method),
384
+ self_deleting_(self_deleting),
385
+ p1_(p1),
386
+ p2_(p2),
387
+ p3_(p3),
388
+ p4_(p4),
389
+ p5_(p5),
390
+ p6_(p6) {}
391
+ ~MethodResultCallback_6_2() {}
392
+
393
+ R Run(A1 a1, A2 a2) override {
394
+ bool needs_delete = self_deleting_;
395
+ R result = (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, a1, a2);
396
+ if (needs_delete) delete this;
397
+ return result;
398
+ }
399
+
400
+ private:
401
+ T* object_;
402
+ MethodType method_;
403
+ bool self_deleting_;
404
+ typename std::remove_reference<P1>::type p1_;
405
+ typename std::remove_reference<P2>::type p2_;
406
+ typename std::remove_reference<P3>::type p3_;
407
+ typename std::remove_reference<P4>::type p4_;
408
+ typename std::remove_reference<P5>::type p5_;
409
+ typename std::remove_reference<P6>::type p6_;
410
+ };
411
+
412
+ } // namespace internal
413
+
414
+ // See Closure.
415
+ inline Closure* NewCallback(void (*function)()) {
416
+ return new internal::FunctionClosure0(function, true);
417
+ }
418
+
419
+ // See Closure.
420
+ inline Closure* NewPermanentCallback(void (*function)()) {
421
+ return new internal::FunctionClosure0(function, false);
422
+ }
423
+
424
+ // See Closure.
425
+ template <typename Class>
426
+ inline Closure* NewCallback(Class* object, void (Class::*method)()) {
427
+ return new internal::MethodClosure0<Class>(object, method, true);
428
+ }
429
+
430
+ // See Closure.
431
+ template <typename Class>
432
+ inline Closure* NewPermanentCallback(Class* object, void (Class::*method)()) {
433
+ return new internal::MethodClosure0<Class>(object, method, false);
434
+ }
435
+
436
+ // See Closure.
437
+ template <typename Arg1>
438
+ inline Closure* NewCallback(void (*function)(Arg1),
439
+ Arg1 arg1) {
440
+ return new internal::FunctionClosure1<Arg1>(function, true, arg1);
441
+ }
442
+
443
+ // See Closure.
444
+ template <typename Arg1>
445
+ inline Closure* NewPermanentCallback(void (*function)(Arg1),
446
+ Arg1 arg1) {
447
+ return new internal::FunctionClosure1<Arg1>(function, false, arg1);
448
+ }
449
+
450
+ // See Closure.
451
+ template <typename Class, typename Arg1>
452
+ inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1),
453
+ Arg1 arg1) {
454
+ return new internal::MethodClosure1<Class, Arg1>(object, method, true, arg1);
455
+ }
456
+
457
+ // See Closure.
458
+ template <typename Class, typename Arg1>
459
+ inline Closure* NewPermanentCallback(Class* object, void (Class::*method)(Arg1),
460
+ Arg1 arg1) {
461
+ return new internal::MethodClosure1<Class, Arg1>(object, method, false, arg1);
462
+ }
463
+
464
+ // See Closure.
465
+ template <typename Arg1, typename Arg2>
466
+ inline Closure* NewCallback(void (*function)(Arg1, Arg2),
467
+ Arg1 arg1, Arg2 arg2) {
468
+ return new internal::FunctionClosure2<Arg1, Arg2>(
469
+ function, true, arg1, arg2);
470
+ }
471
+
472
+ // See Closure.
473
+ template <typename Arg1, typename Arg2>
474
+ inline Closure* NewPermanentCallback(void (*function)(Arg1, Arg2),
475
+ Arg1 arg1, Arg2 arg2) {
476
+ return new internal::FunctionClosure2<Arg1, Arg2>(
477
+ function, false, arg1, arg2);
478
+ }
479
+
480
+ // See Closure.
481
+ template <typename Class, typename Arg1, typename Arg2>
482
+ inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1, Arg2),
483
+ Arg1 arg1, Arg2 arg2) {
484
+ return new internal::MethodClosure2<Class, Arg1, Arg2>(
485
+ object, method, true, arg1, arg2);
486
+ }
487
+
488
+ // See Closure.
489
+ template <typename Class, typename Arg1, typename Arg2>
490
+ inline Closure* NewPermanentCallback(
491
+ Class* object, void (Class::*method)(Arg1, Arg2),
492
+ Arg1 arg1, Arg2 arg2) {
493
+ return new internal::MethodClosure2<Class, Arg1, Arg2>(
494
+ object, method, false, arg1, arg2);
495
+ }
496
+
497
+ // See ResultCallback
498
+ template<typename R>
499
+ inline ResultCallback<R>* NewCallback(R (*function)()) {
500
+ return new internal::FunctionResultCallback_0_0<R>(function, true);
501
+ }
502
+
503
+ // See ResultCallback
504
+ template<typename R>
505
+ inline ResultCallback<R>* NewPermanentCallback(R (*function)()) {
506
+ return new internal::FunctionResultCallback_0_0<R>(function, false);
507
+ }
508
+
509
+ // See ResultCallback
510
+ template<typename R, typename P1>
511
+ inline ResultCallback<R>* NewCallback(R (*function)(P1), P1 p1) {
512
+ return new internal::FunctionResultCallback_1_0<R, P1>(
513
+ function, true, p1);
514
+ }
515
+
516
+ // See ResultCallback
517
+ template<typename R, typename P1>
518
+ inline ResultCallback<R>* NewPermanentCallback(
519
+ R (*function)(P1), P1 p1) {
520
+ return new internal::FunctionResultCallback_1_0<R, P1>(
521
+ function, false, p1);
522
+ }
523
+
524
+ // See ResultCallback1
525
+ template<typename R, typename A1>
526
+ inline ResultCallback1<R, A1>* NewCallback(R (*function)(A1)) {
527
+ return new internal::FunctionResultCallback_0_1<R, A1>(function, true);
528
+ }
529
+
530
+ // See ResultCallback1
531
+ template<typename R, typename A1>
532
+ inline ResultCallback1<R, A1>* NewPermanentCallback(R (*function)(A1)) {
533
+ return new internal::FunctionResultCallback_0_1<R, A1>(function, false);
534
+ }
535
+
536
+ // See ResultCallback1
537
+ template<typename R, typename P1, typename A1>
538
+ inline ResultCallback1<R, A1>* NewCallback(R (*function)(P1, A1), P1 p1) {
539
+ return new internal::FunctionResultCallback_1_1<R, P1, A1>(
540
+ function, true, p1);
541
+ }
542
+
543
+ // See ResultCallback1
544
+ template<typename R, typename P1, typename A1>
545
+ inline ResultCallback1<R, A1>* NewPermanentCallback(
546
+ R (*function)(P1, A1), P1 p1) {
547
+ return new internal::FunctionResultCallback_1_1<R, P1, A1>(
548
+ function, false, p1);
549
+ }
550
+
551
+ // See MethodResultCallback_0_0
552
+ template <typename R, typename T1, typename T2>
553
+ inline ResultCallback<R>* NewPermanentCallback(
554
+ T1* object, R (T2::*function)()) {
555
+ return new internal::MethodResultCallback_0_0<R, T1>(object, function, false);
556
+ }
557
+
558
+ // See MethodResultCallback_6_2
559
+ template <typename R, typename T, typename P1, typename P2, typename P3,
560
+ typename P4, typename P5, typename P6, typename A1, typename A2>
561
+ inline ResultCallback2<R, A1, A2>* NewPermanentCallback(
562
+ T* object, R (T::*function)(P1, P2, P3, P4, P5, P6, A1, A2),
563
+ typename internal::InternalConstRef<P1>::type p1,
564
+ typename internal::InternalConstRef<P2>::type p2,
565
+ typename internal::InternalConstRef<P3>::type p3,
566
+ typename internal::InternalConstRef<P4>::type p4,
567
+ typename internal::InternalConstRef<P5>::type p5,
568
+ typename internal::InternalConstRef<P6>::type p6) {
569
+ return new internal::MethodResultCallback_6_2<R, T, P1, P2, P3, P4, P5, P6,
570
+ A1, A2>(object, function, false,
571
+ p1, p2, p3, p4, p5, p6);
572
+ }
573
+
574
+ // A function which does nothing. Useful for creating no-op callbacks, e.g.:
575
+ // Closure* nothing = NewCallback(&DoNothing);
576
+ void PROTOBUF_EXPORT DoNothing();
577
+
578
+ } // namespace protobuf
579
+ } // namespace google
580
+
581
+ #include <google/protobuf/port_undef.inc>
582
+
583
+ #endif // GOOGLE_PROTOBUF_STUBS_CALLBACK_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/casts.h ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2014 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_CASTS_H__
32
+ #define GOOGLE_PROTOBUF_CASTS_H__
33
+
34
+ #include <google/protobuf/stubs/common.h>
35
+
36
+ #include <google/protobuf/port_def.inc>
37
+ #include <type_traits>
38
+
39
+ namespace google {
40
+ namespace protobuf {
41
+ namespace internal {
42
+
43
+ // Use implicit_cast as a safe version of static_cast or const_cast
44
+ // for upcasting in the type hierarchy (i.e. casting a pointer to Foo
45
+ // to a pointer to SuperclassOfFoo or casting a pointer to Foo to
46
+ // a const pointer to Foo).
47
+ // When you use implicit_cast, the compiler checks that the cast is safe.
48
+ // Such explicit implicit_casts are necessary in surprisingly many
49
+ // situations where C++ demands an exact type match instead of an
50
+ // argument type convertible to a target type.
51
+ //
52
+ // The From type can be inferred, so the preferred syntax for using
53
+ // implicit_cast is the same as for static_cast etc.:
54
+ //
55
+ // implicit_cast<ToType>(expr)
56
+ //
57
+ // implicit_cast would have been part of the C++ standard library,
58
+ // but the proposal was submitted too late. It will probably make
59
+ // its way into the language in the future.
60
+ template<typename To, typename From>
61
+ inline To implicit_cast(From const &f) {
62
+ return f;
63
+ }
64
+
65
+ // When you upcast (that is, cast a pointer from type Foo to type
66
+ // SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts
67
+ // always succeed. When you downcast (that is, cast a pointer from
68
+ // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
69
+ // how do you know the pointer is really of type SubclassOfFoo? It
70
+ // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
71
+ // when you downcast, you should use this macro. In debug mode, we
72
+ // use dynamic_cast<> to double-check the downcast is legal (we die
73
+ // if it's not). In normal mode, we do the efficient static_cast<>
74
+ // instead. Thus, it's important to test in debug mode to make sure
75
+ // the cast is legal!
76
+ // This is the only place in the code we should use dynamic_cast<>.
77
+ // In particular, you SHOULDN'T be using dynamic_cast<> in order to
78
+ // do RTTI (eg code like this:
79
+ // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
80
+ // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
81
+ // You should design the code some other way not to need this.
82
+
83
+ template<typename To, typename From> // use like this: down_cast<T*>(foo);
84
+ inline To down_cast(From* f) { // so we only accept pointers
85
+ // Ensures that To is a sub-type of From *. This test is here only
86
+ // for compile-time type checking, and has no overhead in an
87
+ // optimized build at run-time, as it will be optimized away
88
+ // completely.
89
+ if (false) {
90
+ implicit_cast<From*, To>(0);
91
+ }
92
+
93
+ #if !defined(NDEBUG) && PROTOBUF_RTTI
94
+ assert(f == nullptr || dynamic_cast<To>(f) != nullptr); // RTTI: debug mode only!
95
+ #endif
96
+ return static_cast<To>(f);
97
+ }
98
+
99
+ template<typename To, typename From> // use like this: down_cast<T&>(foo);
100
+ inline To down_cast(From& f) {
101
+ typedef typename std::remove_reference<To>::type* ToAsPointer;
102
+ // Ensures that To is a sub-type of From *. This test is here only
103
+ // for compile-time type checking, and has no overhead in an
104
+ // optimized build at run-time, as it will be optimized away
105
+ // completely.
106
+ if (false) {
107
+ implicit_cast<From*, ToAsPointer>(0);
108
+ }
109
+
110
+ #if !defined(NDEBUG) && PROTOBUF_RTTI
111
+ // RTTI: debug mode only!
112
+ assert(dynamic_cast<ToAsPointer>(&f) != nullptr);
113
+ #endif
114
+ return *static_cast<ToAsPointer>(&f);
115
+ }
116
+
117
+ template<typename To, typename From>
118
+ inline To bit_cast(const From& from) {
119
+ static_assert(sizeof(From) == sizeof(To), "bit_cast_with_different_sizes");
120
+ To dest;
121
+ memcpy(&dest, &from, sizeof(dest));
122
+ return dest;
123
+ }
124
+
125
+ } // namespace internal
126
+
127
+ // We made these internal so that they would show up as such in the docs,
128
+ // but we don't want to stick "internal::" in front of them everywhere.
129
+ using internal::implicit_cast;
130
+ using internal::down_cast;
131
+ using internal::bit_cast;
132
+
133
+ } // namespace protobuf
134
+ } // namespace google
135
+
136
+ #include <google/protobuf/port_undef.inc>
137
+
138
+ #endif // GOOGLE_PROTOBUF_CASTS_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/common.h ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda) and others
32
+ //
33
+ // Contains basic types and utilities used by the rest of the library.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMMON_H__
36
+ #define GOOGLE_PROTOBUF_COMMON_H__
37
+
38
+ #include <algorithm>
39
+ #include <iostream>
40
+ #include <map>
41
+ #include <memory>
42
+ #include <set>
43
+ #include <string>
44
+ #include <vector>
45
+
46
+ #include <google/protobuf/stubs/macros.h>
47
+ #include <google/protobuf/stubs/platform_macros.h>
48
+ #include <google/protobuf/stubs/port.h>
49
+ #include <google/protobuf/stubs/stringpiece.h>
50
+
51
+ #ifndef PROTOBUF_USE_EXCEPTIONS
52
+ #if defined(_MSC_VER) && defined(_CPPUNWIND)
53
+ #define PROTOBUF_USE_EXCEPTIONS 1
54
+ #elif defined(__EXCEPTIONS)
55
+ #define PROTOBUF_USE_EXCEPTIONS 1
56
+ #else
57
+ #define PROTOBUF_USE_EXCEPTIONS 0
58
+ #endif
59
+ #endif
60
+
61
+ #if PROTOBUF_USE_EXCEPTIONS
62
+ #include <exception>
63
+ #endif
64
+ #if defined(__APPLE__)
65
+ #include <TargetConditionals.h> // for TARGET_OS_IPHONE
66
+ #endif
67
+
68
+ #if defined(__ANDROID__) || defined(GOOGLE_PROTOBUF_OS_ANDROID) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || defined(GOOGLE_PROTOBUF_OS_IPHONE)
69
+ #include <pthread.h>
70
+ #endif
71
+
72
+ #include <google/protobuf/port_def.inc>
73
+
74
+ namespace std {}
75
+
76
+ namespace google {
77
+ namespace protobuf {
78
+ namespace internal {
79
+
80
+ // Some of these constants are macros rather than const ints so that they can
81
+ // be used in #if directives.
82
+
83
+ // The current version, represented as a single integer to make comparison
84
+ // easier: major * 10^6 + minor * 10^3 + micro
85
+ #define GOOGLE_PROTOBUF_VERSION 3021009
86
+
87
+ // A suffix string for alpha, beta or rc releases. Empty for stable releases.
88
+ #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
89
+
90
+ // The minimum header version which works with the current version of
91
+ // the library. This constant should only be used by protoc's C++ code
92
+ // generator.
93
+ static const int kMinHeaderVersionForLibrary = 3021000;
94
+
95
+ // The minimum protoc version which works with the current version of the
96
+ // headers.
97
+ #define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3021000
98
+
99
+ // The minimum header version which works with the current version of
100
+ // protoc. This constant should only be used in VerifyVersion().
101
+ static const int kMinHeaderVersionForProtoc = 3021000;
102
+
103
+ // Verifies that the headers and libraries are compatible. Use the macro
104
+ // below to call this.
105
+ void PROTOBUF_EXPORT VerifyVersion(int headerVersion, int minLibraryVersion,
106
+ const char* filename);
107
+
108
+ // Converts a numeric version number to a string.
109
+ std::string PROTOBUF_EXPORT VersionString(int version);
110
+
111
+ } // namespace internal
112
+
113
+ // Place this macro in your main() function (or somewhere before you attempt
114
+ // to use the protobuf library) to verify that the version you link against
115
+ // matches the headers you compiled against. If a version mismatch is
116
+ // detected, the process will abort.
117
+ #define GOOGLE_PROTOBUF_VERIFY_VERSION \
118
+ ::google::protobuf::internal::VerifyVersion( \
119
+ GOOGLE_PROTOBUF_VERSION, GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION, \
120
+ __FILE__)
121
+
122
+
123
+ // ===================================================================
124
+ // from google3/util/utf8/public/unilib.h
125
+
126
+ namespace internal {
127
+
128
+ // Checks if the buffer contains structurally-valid UTF-8. Implemented in
129
+ // structurally_valid.cc.
130
+ PROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);
131
+
132
+ inline bool IsStructurallyValidUTF8(StringPiece str) {
133
+ return IsStructurallyValidUTF8(str.data(), static_cast<int>(str.length()));
134
+ }
135
+
136
+ // Returns initial number of bytes of structurally valid UTF-8.
137
+ PROTOBUF_EXPORT int UTF8SpnStructurallyValid(StringPiece str);
138
+
139
+ // Coerce UTF-8 byte string in src_str to be
140
+ // a structurally-valid equal-length string by selectively
141
+ // overwriting illegal bytes with replace_char (typically ' ' or '?').
142
+ // replace_char must be legal printable 7-bit Ascii 0x20..0x7e.
143
+ // src_str is read-only.
144
+ //
145
+ // Returns pointer to output buffer, src_str.data() if no changes were made,
146
+ // or idst if some bytes were changed. idst is allocated by the caller
147
+ // and must be at least as big as src_str
148
+ //
149
+ // Optimized for: all structurally valid and no byte copying is done.
150
+ //
151
+ PROTOBUF_EXPORT char* UTF8CoerceToStructurallyValid(StringPiece str, char* dst,
152
+ char replace_char);
153
+
154
+ } // namespace internal
155
+
156
+ // This lives in message_lite.h now, but we leave this here for any users that
157
+ // #include common.h and not message_lite.h.
158
+ PROTOBUF_EXPORT void ShutdownProtobufLibrary();
159
+
160
+ namespace internal {
161
+
162
+ // Strongly references the given variable such that the linker will be forced
163
+ // to pull in this variable's translation unit.
164
+ template <typename T>
165
+ void StrongReference(const T& var) {
166
+ auto volatile unused = &var;
167
+ (void)&unused; // Use address to avoid an extra load of "unused".
168
+ }
169
+
170
+ } // namespace internal
171
+
172
+ #if PROTOBUF_USE_EXCEPTIONS
173
+ class FatalException : public std::exception {
174
+ public:
175
+ FatalException(const char* filename, int line, const std::string& message)
176
+ : filename_(filename), line_(line), message_(message) {}
177
+ virtual ~FatalException() throw();
178
+
179
+ const char* what() const throw() override;
180
+
181
+ const char* filename() const { return filename_; }
182
+ int line() const { return line_; }
183
+ const std::string& message() const { return message_; }
184
+
185
+ private:
186
+ const char* filename_;
187
+ const int line_;
188
+ const std::string message_;
189
+ };
190
+ #endif
191
+
192
+ } // namespace protobuf
193
+ } // namespace google
194
+
195
+ #include <google/protobuf/port_undef.inc>
196
+
197
+ #endif // GOOGLE_PROTOBUF_COMMON_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/hash.h ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+
33
+ #ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__
34
+ #define GOOGLE_PROTOBUF_STUBS_HASH_H__
35
+
36
+ #include <cstring>
37
+ #include <string>
38
+ #include <unordered_map>
39
+ #include <unordered_set>
40
+
41
+ # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \
42
+ namespace google { \
43
+ namespace protobuf {
44
+ # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }}
45
+
46
+ namespace google {
47
+ namespace protobuf {
48
+
49
+ template <typename Key>
50
+ struct hash : public std::hash<Key> {};
51
+
52
+ template <typename Key>
53
+ struct hash<const Key*> {
54
+ inline size_t operator()(const Key* key) const {
55
+ return reinterpret_cast<size_t>(key);
56
+ }
57
+ };
58
+
59
+ // Unlike the old SGI version, the TR1 "hash" does not special-case char*. So,
60
+ // we go ahead and provide our own implementation.
61
+ template <>
62
+ struct hash<const char*> {
63
+ inline size_t operator()(const char* str) const {
64
+ size_t result = 0;
65
+ for (; *str != '\0'; str++) {
66
+ result = 5 * result + static_cast<size_t>(*str);
67
+ }
68
+ return result;
69
+ }
70
+ };
71
+
72
+ template<>
73
+ struct hash<bool> {
74
+ size_t operator()(bool x) const {
75
+ return static_cast<size_t>(x);
76
+ }
77
+ };
78
+
79
+ template <>
80
+ struct hash<std::string> {
81
+ inline size_t operator()(const std::string& key) const {
82
+ return hash<const char*>()(key.c_str());
83
+ }
84
+
85
+ static const size_t bucket_size = 4;
86
+ static const size_t min_buckets = 8;
87
+ inline bool operator()(const std::string& a, const std::string& b) const {
88
+ return a < b;
89
+ }
90
+ };
91
+
92
+ template <typename First, typename Second>
93
+ struct hash<std::pair<First, Second> > {
94
+ inline size_t operator()(const std::pair<First, Second>& key) const {
95
+ size_t first_hash = hash<First>()(key.first);
96
+ size_t second_hash = hash<Second>()(key.second);
97
+
98
+ // FIXME(kenton): What is the best way to compute this hash? I have
99
+ // no idea! This seems a bit better than an XOR.
100
+ return first_hash * ((1 << 16) - 1) + second_hash;
101
+ }
102
+
103
+ static const size_t bucket_size = 4;
104
+ static const size_t min_buckets = 8;
105
+ inline bool operator()(const std::pair<First, Second>& a,
106
+ const std::pair<First, Second>& b) const {
107
+ return a < b;
108
+ }
109
+ };
110
+
111
+ } // namespace protobuf
112
+ } // namespace google
113
+
114
+ #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/int128.h ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ #ifndef GOOGLE_PROTOBUF_STUBS_INT128_H_
31
+ #define GOOGLE_PROTOBUF_STUBS_INT128_H_
32
+
33
+ #include <google/protobuf/stubs/common.h>
34
+
35
+ #include <iosfwd>
36
+
37
+ #include <google/protobuf/port_def.inc>
38
+
39
+ namespace google {
40
+ namespace protobuf {
41
+
42
+ struct uint128_pod;
43
+
44
+ // TODO(xiaofeng): Define GOOGLE_PROTOBUF_HAS_CONSTEXPR when constexpr is
45
+ // available.
46
+ #ifdef GOOGLE_PROTOBUF_HAS_CONSTEXPR
47
+ # define UINT128_CONSTEXPR constexpr
48
+ #else
49
+ # define UINT128_CONSTEXPR
50
+ #endif
51
+
52
+ // An unsigned 128-bit integer type. Thread-compatible.
53
+ class PROTOBUF_EXPORT uint128 {
54
+ public:
55
+ UINT128_CONSTEXPR uint128(); // Sets to 0, but don't trust on this behavior.
56
+ UINT128_CONSTEXPR uint128(uint64_t top, uint64_t bottom);
57
+ #ifndef SWIG
58
+ UINT128_CONSTEXPR uint128(int bottom);
59
+ UINT128_CONSTEXPR uint128(uint32_t bottom); // Top 96 bits = 0
60
+ #endif
61
+ UINT128_CONSTEXPR uint128(uint64_t bottom); // hi_ = 0
62
+ UINT128_CONSTEXPR uint128(const uint128_pod &val);
63
+
64
+ // Trivial copy constructor, assignment operator and destructor.
65
+
66
+ void Initialize(uint64_t top, uint64_t bottom);
67
+
68
+ // Arithmetic operators.
69
+ uint128& operator+=(const uint128& b);
70
+ uint128& operator-=(const uint128& b);
71
+ uint128& operator*=(const uint128& b);
72
+ // Long division/modulo for uint128.
73
+ uint128& operator/=(const uint128& b);
74
+ uint128& operator%=(const uint128& b);
75
+ uint128 operator++(int);
76
+ uint128 operator--(int);
77
+ uint128& operator<<=(int);
78
+ uint128& operator>>=(int);
79
+ uint128& operator&=(const uint128& b);
80
+ uint128& operator|=(const uint128& b);
81
+ uint128& operator^=(const uint128& b);
82
+ uint128& operator++();
83
+ uint128& operator--();
84
+
85
+ friend uint64_t Uint128Low64(const uint128& v);
86
+ friend uint64_t Uint128High64(const uint128& v);
87
+
88
+ // We add "std::" to avoid including all of port.h.
89
+ PROTOBUF_EXPORT friend std::ostream& operator<<(std::ostream& o,
90
+ const uint128& b);
91
+
92
+ private:
93
+ static void DivModImpl(uint128 dividend, uint128 divisor,
94
+ uint128* quotient_ret, uint128* remainder_ret);
95
+
96
+ // Little-endian memory order optimizations can benefit from
97
+ // having lo_ first, hi_ last.
98
+ // See util/endian/endian.h and Load128/Store128 for storing a uint128.
99
+ uint64_t lo_;
100
+ uint64_t hi_;
101
+
102
+ // Not implemented, just declared for catching automatic type conversions.
103
+ uint128(uint8_t);
104
+ uint128(uint16_t);
105
+ uint128(float v);
106
+ uint128(double v);
107
+ };
108
+
109
+ // This is a POD form of uint128 which can be used for static variables which
110
+ // need to be operated on as uint128.
111
+ struct uint128_pod {
112
+ // Note: The ordering of fields is different than 'class uint128' but the
113
+ // same as its 2-arg constructor. This enables more obvious initialization
114
+ // of static instances, which is the primary reason for this struct in the
115
+ // first place. This does not seem to defeat any optimizations wrt
116
+ // operations involving this struct.
117
+ uint64_t hi;
118
+ uint64_t lo;
119
+ };
120
+
121
+ PROTOBUF_EXPORT extern const uint128_pod kuint128max;
122
+
123
+ // allow uint128 to be logged
124
+ PROTOBUF_EXPORT extern std::ostream& operator<<(std::ostream& o,
125
+ const uint128& b);
126
+
127
+ // Methods to access low and high pieces of 128-bit value.
128
+ // Defined externally from uint128 to facilitate conversion
129
+ // to native 128-bit types when compilers support them.
130
+ inline uint64_t Uint128Low64(const uint128& v) { return v.lo_; }
131
+ inline uint64_t Uint128High64(const uint128& v) { return v.hi_; }
132
+
133
+ // TODO: perhaps it would be nice to have int128, a signed 128-bit type?
134
+
135
+ // --------------------------------------------------------------------------
136
+ // Implementation details follow
137
+ // --------------------------------------------------------------------------
138
+ inline bool operator==(const uint128& lhs, const uint128& rhs) {
139
+ return (Uint128Low64(lhs) == Uint128Low64(rhs) &&
140
+ Uint128High64(lhs) == Uint128High64(rhs));
141
+ }
142
+ inline bool operator!=(const uint128& lhs, const uint128& rhs) {
143
+ return !(lhs == rhs);
144
+ }
145
+
146
+ inline UINT128_CONSTEXPR uint128::uint128() : lo_(0), hi_(0) {}
147
+ inline UINT128_CONSTEXPR uint128::uint128(uint64_t top, uint64_t bottom)
148
+ : lo_(bottom), hi_(top) {}
149
+ inline UINT128_CONSTEXPR uint128::uint128(const uint128_pod& v)
150
+ : lo_(v.lo), hi_(v.hi) {}
151
+ inline UINT128_CONSTEXPR uint128::uint128(uint64_t bottom)
152
+ : lo_(bottom), hi_(0) {}
153
+ #ifndef SWIG
154
+ inline UINT128_CONSTEXPR uint128::uint128(uint32_t bottom)
155
+ : lo_(bottom), hi_(0) {}
156
+ inline UINT128_CONSTEXPR uint128::uint128(int bottom)
157
+ : lo_(bottom), hi_(static_cast<int64_t>((bottom < 0) ? -1 : 0)) {}
158
+ #endif
159
+
160
+ #undef UINT128_CONSTEXPR
161
+
162
+ inline void uint128::Initialize(uint64_t top, uint64_t bottom) {
163
+ hi_ = top;
164
+ lo_ = bottom;
165
+ }
166
+
167
+ // Comparison operators.
168
+
169
+ #define CMP128(op) \
170
+ inline bool operator op(const uint128& lhs, const uint128& rhs) { \
171
+ return (Uint128High64(lhs) == Uint128High64(rhs)) ? \
172
+ (Uint128Low64(lhs) op Uint128Low64(rhs)) : \
173
+ (Uint128High64(lhs) op Uint128High64(rhs)); \
174
+ }
175
+
176
+ CMP128(<)
177
+ CMP128(>)
178
+ CMP128(>=)
179
+ CMP128(<=)
180
+
181
+ #undef CMP128
182
+
183
+ // Unary operators
184
+
185
+ inline uint128 operator-(const uint128& val) {
186
+ const uint64_t hi_flip = ~Uint128High64(val);
187
+ const uint64_t lo_flip = ~Uint128Low64(val);
188
+ const uint64_t lo_add = lo_flip + 1;
189
+ if (lo_add < lo_flip) {
190
+ return uint128(hi_flip + 1, lo_add);
191
+ }
192
+ return uint128(hi_flip, lo_add);
193
+ }
194
+
195
+ inline bool operator!(const uint128& val) {
196
+ return !Uint128High64(val) && !Uint128Low64(val);
197
+ }
198
+
199
+ // Logical operators.
200
+
201
+ inline uint128 operator~(const uint128& val) {
202
+ return uint128(~Uint128High64(val), ~Uint128Low64(val));
203
+ }
204
+
205
+ #define LOGIC128(op) \
206
+ inline uint128 operator op(const uint128& lhs, const uint128& rhs) { \
207
+ return uint128(Uint128High64(lhs) op Uint128High64(rhs), \
208
+ Uint128Low64(lhs) op Uint128Low64(rhs)); \
209
+ }
210
+
211
+ LOGIC128(|)
212
+ LOGIC128(&)
213
+ LOGIC128(^)
214
+
215
+ #undef LOGIC128
216
+
217
+ #define LOGICASSIGN128(op) \
218
+ inline uint128& uint128::operator op(const uint128& other) { \
219
+ hi_ op other.hi_; \
220
+ lo_ op other.lo_; \
221
+ return *this; \
222
+ }
223
+
224
+ LOGICASSIGN128(|=)
225
+ LOGICASSIGN128(&=)
226
+ LOGICASSIGN128(^=)
227
+
228
+ #undef LOGICASSIGN128
229
+
230
+ // Shift operators.
231
+
232
+ inline uint128 operator<<(const uint128& val, int amount) {
233
+ // uint64 shifts of >= 64 are undefined, so we will need some special-casing.
234
+ if (amount < 64) {
235
+ if (amount == 0) {
236
+ return val;
237
+ }
238
+ uint64_t new_hi = (Uint128High64(val) << amount) |
239
+ (Uint128Low64(val) >> (64 - amount));
240
+ uint64_t new_lo = Uint128Low64(val) << amount;
241
+ return uint128(new_hi, new_lo);
242
+ } else if (amount < 128) {
243
+ return uint128(Uint128Low64(val) << (amount - 64), 0);
244
+ } else {
245
+ return uint128(0, 0);
246
+ }
247
+ }
248
+
249
+ inline uint128 operator>>(const uint128& val, int amount) {
250
+ // uint64 shifts of >= 64 are undefined, so we will need some special-casing.
251
+ if (amount < 64) {
252
+ if (amount == 0) {
253
+ return val;
254
+ }
255
+ uint64_t new_hi = Uint128High64(val) >> amount;
256
+ uint64_t new_lo = (Uint128Low64(val) >> amount) |
257
+ (Uint128High64(val) << (64 - amount));
258
+ return uint128(new_hi, new_lo);
259
+ } else if (amount < 128) {
260
+ return uint128(0, Uint128High64(val) >> (amount - 64));
261
+ } else {
262
+ return uint128(0, 0);
263
+ }
264
+ }
265
+
266
+ inline uint128& uint128::operator<<=(int amount) {
267
+ // uint64 shifts of >= 64 are undefined, so we will need some special-casing.
268
+ if (amount < 64) {
269
+ if (amount != 0) {
270
+ hi_ = (hi_ << amount) | (lo_ >> (64 - amount));
271
+ lo_ = lo_ << amount;
272
+ }
273
+ } else if (amount < 128) {
274
+ hi_ = lo_ << (amount - 64);
275
+ lo_ = 0;
276
+ } else {
277
+ hi_ = 0;
278
+ lo_ = 0;
279
+ }
280
+ return *this;
281
+ }
282
+
283
+ inline uint128& uint128::operator>>=(int amount) {
284
+ // uint64 shifts of >= 64 are undefined, so we will need some special-casing.
285
+ if (amount < 64) {
286
+ if (amount != 0) {
287
+ lo_ = (lo_ >> amount) | (hi_ << (64 - amount));
288
+ hi_ = hi_ >> amount;
289
+ }
290
+ } else if (amount < 128) {
291
+ lo_ = hi_ >> (amount - 64);
292
+ hi_ = 0;
293
+ } else {
294
+ lo_ = 0;
295
+ hi_ = 0;
296
+ }
297
+ return *this;
298
+ }
299
+
300
+ inline uint128 operator+(const uint128& lhs, const uint128& rhs) {
301
+ return uint128(lhs) += rhs;
302
+ }
303
+
304
+ inline uint128 operator-(const uint128& lhs, const uint128& rhs) {
305
+ return uint128(lhs) -= rhs;
306
+ }
307
+
308
+ inline uint128 operator*(const uint128& lhs, const uint128& rhs) {
309
+ return uint128(lhs) *= rhs;
310
+ }
311
+
312
+ inline uint128 operator/(const uint128& lhs, const uint128& rhs) {
313
+ return uint128(lhs) /= rhs;
314
+ }
315
+
316
+ inline uint128 operator%(const uint128& lhs, const uint128& rhs) {
317
+ return uint128(lhs) %= rhs;
318
+ }
319
+
320
+ inline uint128& uint128::operator+=(const uint128& b) {
321
+ hi_ += b.hi_;
322
+ uint64_t lolo = lo_ + b.lo_;
323
+ if (lolo < lo_)
324
+ ++hi_;
325
+ lo_ = lolo;
326
+ return *this;
327
+ }
328
+
329
+ inline uint128& uint128::operator-=(const uint128& b) {
330
+ hi_ -= b.hi_;
331
+ if (b.lo_ > lo_)
332
+ --hi_;
333
+ lo_ -= b.lo_;
334
+ return *this;
335
+ }
336
+
337
+ inline uint128& uint128::operator*=(const uint128& b) {
338
+ uint64_t a96 = hi_ >> 32;
339
+ uint64_t a64 = hi_ & 0xffffffffu;
340
+ uint64_t a32 = lo_ >> 32;
341
+ uint64_t a00 = lo_ & 0xffffffffu;
342
+ uint64_t b96 = b.hi_ >> 32;
343
+ uint64_t b64 = b.hi_ & 0xffffffffu;
344
+ uint64_t b32 = b.lo_ >> 32;
345
+ uint64_t b00 = b.lo_ & 0xffffffffu;
346
+ // multiply [a96 .. a00] x [b96 .. b00]
347
+ // terms higher than c96 disappear off the high side
348
+ // terms c96 and c64 are safe to ignore carry bit
349
+ uint64_t c96 = a96 * b00 + a64 * b32 + a32 * b64 + a00 * b96;
350
+ uint64_t c64 = a64 * b00 + a32 * b32 + a00 * b64;
351
+ this->hi_ = (c96 << 32) + c64;
352
+ this->lo_ = 0;
353
+ // add terms after this one at a time to capture carry
354
+ *this += uint128(a32 * b00) << 32;
355
+ *this += uint128(a00 * b32) << 32;
356
+ *this += a00 * b00;
357
+ return *this;
358
+ }
359
+
360
+ inline uint128 uint128::operator++(int) {
361
+ uint128 tmp(*this);
362
+ *this += 1;
363
+ return tmp;
364
+ }
365
+
366
+ inline uint128 uint128::operator--(int) {
367
+ uint128 tmp(*this);
368
+ *this -= 1;
369
+ return tmp;
370
+ }
371
+
372
+ inline uint128& uint128::operator++() {
373
+ *this += 1;
374
+ return *this;
375
+ }
376
+
377
+ inline uint128& uint128::operator--() {
378
+ *this -= 1;
379
+ return *this;
380
+ }
381
+
382
+ } // namespace protobuf
383
+ } // namespace google
384
+
385
+ #include <google/protobuf/port_undef.inc>
386
+
387
+ #endif // GOOGLE_PROTOBUF_STUBS_INT128_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/logging.h ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_STUBS_LOGGING_H_
32
+ #define GOOGLE_PROTOBUF_STUBS_LOGGING_H_
33
+
34
+ #include <google/protobuf/stubs/macros.h>
35
+ #include <google/protobuf/stubs/port.h>
36
+ #include <google/protobuf/stubs/status.h>
37
+ #include <google/protobuf/stubs/stringpiece.h>
38
+
39
+ #include <google/protobuf/port_def.inc>
40
+
41
+ // ===================================================================
42
+ // emulates google3/base/logging.h
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+
47
+ enum LogLevel {
48
+ LOGLEVEL_INFO, // Informational. This is never actually used by
49
+ // libprotobuf.
50
+ LOGLEVEL_WARNING, // Warns about issues that, although not technically a
51
+ // problem now, could cause problems in the future. For
52
+ // example, a // warning will be printed when parsing a
53
+ // message that is near the message size limit.
54
+ LOGLEVEL_ERROR, // An error occurred which should never happen during
55
+ // normal use.
56
+ LOGLEVEL_FATAL, // An error occurred from which the library cannot
57
+ // recover. This usually indicates a programming error
58
+ // in the code which calls the library, especially when
59
+ // compiled in debug mode.
60
+
61
+ #ifdef NDEBUG
62
+ LOGLEVEL_DFATAL = LOGLEVEL_ERROR
63
+ #else
64
+ LOGLEVEL_DFATAL = LOGLEVEL_FATAL
65
+ #endif
66
+ };
67
+
68
+ class uint128;
69
+ namespace internal {
70
+
71
+ class LogFinisher;
72
+
73
+ class PROTOBUF_EXPORT LogMessage {
74
+ public:
75
+ LogMessage(LogLevel level, const char* filename, int line);
76
+ ~LogMessage();
77
+
78
+ LogMessage& operator<<(const std::string& value);
79
+ LogMessage& operator<<(const char* value);
80
+ LogMessage& operator<<(char value);
81
+ LogMessage& operator<<(int value);
82
+ LogMessage& operator<<(uint value);
83
+ LogMessage& operator<<(long value);
84
+ LogMessage& operator<<(unsigned long value);
85
+ LogMessage& operator<<(long long value);
86
+ LogMessage& operator<<(unsigned long long value);
87
+ LogMessage& operator<<(double value);
88
+ LogMessage& operator<<(void* value);
89
+ LogMessage& operator<<(const StringPiece& value);
90
+ LogMessage& operator<<(const util::Status& status);
91
+ LogMessage& operator<<(const uint128& value);
92
+
93
+ private:
94
+ friend class LogFinisher;
95
+ void Finish();
96
+
97
+ LogLevel level_;
98
+ const char* filename_;
99
+ int line_;
100
+ std::string message_;
101
+ };
102
+
103
+ // Used to make the entire "LOG(BLAH) << etc." expression have a void return
104
+ // type and print a newline after each message.
105
+ class PROTOBUF_EXPORT LogFinisher {
106
+ public:
107
+ void operator=(LogMessage& other);
108
+ };
109
+
110
+ template<typename T>
111
+ bool IsOk(T status) { return status.ok(); }
112
+ template<>
113
+ inline bool IsOk(bool status) { return status; }
114
+
115
+ } // namespace internal
116
+
117
+ // Undef everything in case we're being mixed with some other Google library
118
+ // which already defined them itself. Presumably all Google libraries will
119
+ // support the same syntax for these so it should not be a big deal if they
120
+ // end up using our definitions instead.
121
+ #undef GOOGLE_LOG
122
+ #undef GOOGLE_LOG_IF
123
+
124
+ #undef GOOGLE_CHECK
125
+ #undef GOOGLE_CHECK_OK
126
+ #undef GOOGLE_CHECK_EQ
127
+ #undef GOOGLE_CHECK_NE
128
+ #undef GOOGLE_CHECK_LT
129
+ #undef GOOGLE_CHECK_LE
130
+ #undef GOOGLE_CHECK_GT
131
+ #undef GOOGLE_CHECK_GE
132
+ #undef GOOGLE_CHECK_NOTNULL
133
+
134
+ #undef GOOGLE_DLOG
135
+ #undef GOOGLE_DCHECK
136
+ #undef GOOGLE_DCHECK_OK
137
+ #undef GOOGLE_DCHECK_EQ
138
+ #undef GOOGLE_DCHECK_NE
139
+ #undef GOOGLE_DCHECK_LT
140
+ #undef GOOGLE_DCHECK_LE
141
+ #undef GOOGLE_DCHECK_GT
142
+ #undef GOOGLE_DCHECK_GE
143
+
144
+ #define GOOGLE_LOG(LEVEL) \
145
+ ::google::protobuf::internal::LogFinisher() = \
146
+ ::google::protobuf::internal::LogMessage( \
147
+ ::google::protobuf::LOGLEVEL_##LEVEL, __FILE__, __LINE__)
148
+ #define GOOGLE_LOG_IF(LEVEL, CONDITION) \
149
+ !(CONDITION) ? (void)0 : GOOGLE_LOG(LEVEL)
150
+
151
+ #define GOOGLE_CHECK(EXPRESSION) \
152
+ GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": "
153
+ #define GOOGLE_CHECK_OK(A) GOOGLE_CHECK(::google::protobuf::internal::IsOk(A))
154
+ #define GOOGLE_CHECK_EQ(A, B) GOOGLE_CHECK((A) == (B))
155
+ #define GOOGLE_CHECK_NE(A, B) GOOGLE_CHECK((A) != (B))
156
+ #define GOOGLE_CHECK_LT(A, B) GOOGLE_CHECK((A) < (B))
157
+ #define GOOGLE_CHECK_LE(A, B) GOOGLE_CHECK((A) <= (B))
158
+ #define GOOGLE_CHECK_GT(A, B) GOOGLE_CHECK((A) > (B))
159
+ #define GOOGLE_CHECK_GE(A, B) GOOGLE_CHECK((A) >= (B))
160
+
161
+ namespace internal {
162
+ template<typename T>
163
+ T* CheckNotNull(const char* /* file */, int /* line */,
164
+ const char* name, T* val) {
165
+ if (val == nullptr) {
166
+ GOOGLE_LOG(FATAL) << name;
167
+ }
168
+ return val;
169
+ }
170
+ } // namespace internal
171
+ #define GOOGLE_CHECK_NOTNULL(A) \
172
+ ::google::protobuf::internal::CheckNotNull( \
173
+ __FILE__, __LINE__, "'" #A "' must not be nullptr", (A))
174
+
175
+ #ifdef NDEBUG
176
+
177
+ #define GOOGLE_DLOG(LEVEL) GOOGLE_LOG_IF(LEVEL, false)
178
+
179
+ #define GOOGLE_DCHECK(EXPRESSION) while(false) GOOGLE_CHECK(EXPRESSION)
180
+ #define GOOGLE_DCHECK_OK(E) GOOGLE_DCHECK(::google::protobuf::internal::IsOk(E))
181
+ #define GOOGLE_DCHECK_EQ(A, B) GOOGLE_DCHECK((A) == (B))
182
+ #define GOOGLE_DCHECK_NE(A, B) GOOGLE_DCHECK((A) != (B))
183
+ #define GOOGLE_DCHECK_LT(A, B) GOOGLE_DCHECK((A) < (B))
184
+ #define GOOGLE_DCHECK_LE(A, B) GOOGLE_DCHECK((A) <= (B))
185
+ #define GOOGLE_DCHECK_GT(A, B) GOOGLE_DCHECK((A) > (B))
186
+ #define GOOGLE_DCHECK_GE(A, B) GOOGLE_DCHECK((A) >= (B))
187
+
188
+ #else // NDEBUG
189
+
190
+ #define GOOGLE_DLOG GOOGLE_LOG
191
+
192
+ #define GOOGLE_DCHECK GOOGLE_CHECK
193
+ #define GOOGLE_DCHECK_OK GOOGLE_CHECK_OK
194
+ #define GOOGLE_DCHECK_EQ GOOGLE_CHECK_EQ
195
+ #define GOOGLE_DCHECK_NE GOOGLE_CHECK_NE
196
+ #define GOOGLE_DCHECK_LT GOOGLE_CHECK_LT
197
+ #define GOOGLE_DCHECK_LE GOOGLE_CHECK_LE
198
+ #define GOOGLE_DCHECK_GT GOOGLE_CHECK_GT
199
+ #define GOOGLE_DCHECK_GE GOOGLE_CHECK_GE
200
+
201
+ #endif // !NDEBUG
202
+
203
+ typedef void LogHandler(LogLevel level, const char* filename, int line,
204
+ const std::string& message);
205
+
206
+ // The protobuf library sometimes writes warning and error messages to
207
+ // stderr. These messages are primarily useful for developers, but may
208
+ // also help end users figure out a problem. If you would prefer that
209
+ // these messages be sent somewhere other than stderr, call SetLogHandler()
210
+ // to set your own handler. This returns the old handler. Set the handler
211
+ // to nullptr to ignore log messages (but see also LogSilencer, below).
212
+ //
213
+ // Obviously, SetLogHandler is not thread-safe. You should only call it
214
+ // at initialization time, and probably not from library code. If you
215
+ // simply want to suppress log messages temporarily (e.g. because you
216
+ // have some code that tends to trigger them frequently and you know
217
+ // the warnings are not important to you), use the LogSilencer class
218
+ // below.
219
+ PROTOBUF_EXPORT LogHandler* SetLogHandler(LogHandler* new_func);
220
+
221
+ // Create a LogSilencer if you want to temporarily suppress all log
222
+ // messages. As long as any LogSilencer objects exist, non-fatal
223
+ // log messages will be discarded (the current LogHandler will *not*
224
+ // be called). Constructing a LogSilencer is thread-safe. You may
225
+ // accidentally suppress log messages occurring in another thread, but
226
+ // since messages are generally for debugging purposes only, this isn't
227
+ // a big deal. If you want to intercept log messages, use SetLogHandler().
228
+ class PROTOBUF_EXPORT LogSilencer {
229
+ public:
230
+ LogSilencer();
231
+ ~LogSilencer();
232
+ };
233
+
234
+ } // namespace protobuf
235
+ } // namespace google
236
+
237
+ #include <google/protobuf/port_undef.inc>
238
+
239
+ #endif // GOOGLE_PROTOBUF_STUBS_LOGGING_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/macros.h ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_MACROS_H__
32
+ #define GOOGLE_PROTOBUF_MACROS_H__
33
+
34
+ namespace google {
35
+ namespace protobuf {
36
+
37
+ #undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
38
+ #define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
39
+ TypeName(const TypeName&) = delete; \
40
+ void operator=(const TypeName&) = delete
41
+
42
+ #undef GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS
43
+ #define GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
44
+ TypeName() = delete; \
45
+ TypeName(const TypeName&) = delete; \
46
+ void operator=(const TypeName&) = delete
47
+
48
+ // ===================================================================
49
+ // from google3/base/basictypes.h
50
+
51
+ // The GOOGLE_ARRAYSIZE(arr) macro returns the # of elements in an array arr.
52
+ // The expression is a compile-time constant, and therefore can be
53
+ // used in defining new arrays, for example.
54
+ //
55
+ // GOOGLE_ARRAYSIZE catches a few type errors. If you see a compiler error
56
+ //
57
+ // "warning: division by zero in ..."
58
+ //
59
+ // when using GOOGLE_ARRAYSIZE, you are (wrongfully) giving it a pointer.
60
+ // You should only use GOOGLE_ARRAYSIZE on statically allocated arrays.
61
+ //
62
+ // The following comments are on the implementation details, and can
63
+ // be ignored by the users.
64
+ //
65
+ // ARRAYSIZE(arr) works by inspecting sizeof(arr) (the # of bytes in
66
+ // the array) and sizeof(*(arr)) (the # of bytes in one array
67
+ // element). If the former is divisible by the latter, perhaps arr is
68
+ // indeed an array, in which case the division result is the # of
69
+ // elements in the array. Otherwise, arr cannot possibly be an array,
70
+ // and we generate a compiler error to prevent the code from
71
+ // compiling.
72
+ //
73
+ // Since the size of bool is implementation-defined, we need to cast
74
+ // !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final
75
+ // result has type size_t.
76
+ //
77
+ // This macro is not perfect as it wrongfully accepts certain
78
+ // pointers, namely where the pointer size is divisible by the pointee
79
+ // size. Since all our code has to go through a 32-bit compiler,
80
+ // where a pointer is 4 bytes, this means all pointers to a type whose
81
+ // size is 3 or greater than 4 will be (righteously) rejected.
82
+ //
83
+ // Kudos to Jorg Brown for this simple and elegant implementation.
84
+
85
+ #undef GOOGLE_ARRAYSIZE
86
+ #define GOOGLE_ARRAYSIZE(a) \
87
+ ((sizeof(a) / sizeof(*(a))) / \
88
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
89
+
90
+ } // namespace protobuf
91
+ } // namespace google
92
+
93
+ #endif // GOOGLE_PROTOBUF_MACROS_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/map_util.h ADDED
@@ -0,0 +1,769 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2014 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // from google3/util/gtl/map_util.h
32
+ // Author: Anton Carver
33
+
34
+ #ifndef GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
35
+ #define GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
36
+
37
+ #include <stddef.h>
38
+ #include <iterator>
39
+ #include <string>
40
+ #include <utility>
41
+ #include <vector>
42
+
43
+ #include <google/protobuf/stubs/common.h>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ namespace internal {
48
+ // Local implementation of RemoveConst to avoid including base/type_traits.h.
49
+ template <class T> struct RemoveConst { typedef T type; };
50
+ template <class T> struct RemoveConst<const T> : RemoveConst<T> {};
51
+ } // namespace internal
52
+
53
+ //
54
+ // Find*()
55
+ //
56
+
57
+ // Returns a const reference to the value associated with the given key if it
58
+ // exists. Crashes otherwise.
59
+ //
60
+ // This is intended as a replacement for operator[] as an rvalue (for reading)
61
+ // when the key is guaranteed to exist.
62
+ //
63
+ // operator[] for lookup is discouraged for several reasons:
64
+ // * It has a side-effect of inserting missing keys
65
+ // * It is not thread-safe (even when it is not inserting, it can still
66
+ // choose to resize the underlying storage)
67
+ // * It invalidates iterators (when it chooses to resize)
68
+ // * It default constructs a value object even if it doesn't need to
69
+ //
70
+ // This version assumes the key is printable, and includes it in the fatal log
71
+ // message.
72
+ template <class Collection>
73
+ const typename Collection::value_type::second_type&
74
+ FindOrDie(const Collection& collection,
75
+ const typename Collection::value_type::first_type& key) {
76
+ typename Collection::const_iterator it = collection.find(key);
77
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found: " << key;
78
+ return it->second;
79
+ }
80
+
81
+ // Same as above, but returns a non-const reference.
82
+ template <class Collection>
83
+ typename Collection::value_type::second_type&
84
+ FindOrDie(Collection& collection, // NOLINT
85
+ const typename Collection::value_type::first_type& key) {
86
+ typename Collection::iterator it = collection.find(key);
87
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found: " << key;
88
+ return it->second;
89
+ }
90
+
91
+ // Same as FindOrDie above, but doesn't log the key on failure.
92
+ template <class Collection>
93
+ const typename Collection::value_type::second_type&
94
+ FindOrDieNoPrint(const Collection& collection,
95
+ const typename Collection::value_type::first_type& key) {
96
+ typename Collection::const_iterator it = collection.find(key);
97
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found";
98
+ return it->second;
99
+ }
100
+
101
+ // Same as above, but returns a non-const reference.
102
+ template <class Collection>
103
+ typename Collection::value_type::second_type&
104
+ FindOrDieNoPrint(Collection& collection, // NOLINT
105
+ const typename Collection::value_type::first_type& key) {
106
+ typename Collection::iterator it = collection.find(key);
107
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found";
108
+ return it->second;
109
+ }
110
+
111
+ // Returns a const reference to the value associated with the given key if it
112
+ // exists, otherwise returns a const reference to the provided default value.
113
+ //
114
+ // WARNING: If a temporary object is passed as the default "value,"
115
+ // this function will return a reference to that temporary object,
116
+ // which will be destroyed at the end of the statement. A common
117
+ // example: if you have a map with string values, and you pass a char*
118
+ // as the default "value," either use the returned value immediately
119
+ // or store it in a string (not string&).
120
+ // Details: http://go/findwithdefault
121
+ template <class Collection>
122
+ const typename Collection::value_type::second_type&
123
+ FindWithDefault(const Collection& collection,
124
+ const typename Collection::value_type::first_type& key,
125
+ const typename Collection::value_type::second_type& value) {
126
+ typename Collection::const_iterator it = collection.find(key);
127
+ if (it == collection.end()) {
128
+ return value;
129
+ }
130
+ return it->second;
131
+ }
132
+
133
+ // Returns a pointer to the const value associated with the given key if it
134
+ // exists, or nullptr otherwise.
135
+ template <class Collection>
136
+ const typename Collection::value_type::second_type*
137
+ FindOrNull(const Collection& collection,
138
+ const typename Collection::value_type::first_type& key) {
139
+ typename Collection::const_iterator it = collection.find(key);
140
+ if (it == collection.end()) {
141
+ return 0;
142
+ }
143
+ return &it->second;
144
+ }
145
+
146
+ // Same as above but returns a pointer to the non-const value.
147
+ template <class Collection>
148
+ typename Collection::value_type::second_type*
149
+ FindOrNull(Collection& collection, // NOLINT
150
+ const typename Collection::value_type::first_type& key) {
151
+ typename Collection::iterator it = collection.find(key);
152
+ if (it == collection.end()) {
153
+ return 0;
154
+ }
155
+ return &it->second;
156
+ }
157
+
158
+ // Returns the pointer value associated with the given key. If none is found,
159
+ // nullptr is returned. The function is designed to be used with a map of keys to
160
+ // pointers.
161
+ //
162
+ // This function does not distinguish between a missing key and a key mapped
163
+ // to nullptr.
164
+ template <class Collection>
165
+ typename Collection::value_type::second_type
166
+ FindPtrOrNull(const Collection& collection,
167
+ const typename Collection::value_type::first_type& key) {
168
+ typename Collection::const_iterator it = collection.find(key);
169
+ if (it == collection.end()) {
170
+ return typename Collection::value_type::second_type();
171
+ }
172
+ return it->second;
173
+ }
174
+
175
+ // Same as above, except takes non-const reference to collection.
176
+ //
177
+ // This function is needed for containers that propagate constness to the
178
+ // pointee, such as boost::ptr_map.
179
+ template <class Collection>
180
+ typename Collection::value_type::second_type
181
+ FindPtrOrNull(Collection& collection, // NOLINT
182
+ const typename Collection::value_type::first_type& key) {
183
+ typename Collection::iterator it = collection.find(key);
184
+ if (it == collection.end()) {
185
+ return typename Collection::value_type::second_type();
186
+ }
187
+ return it->second;
188
+ }
189
+
190
+ // Finds the pointer value associated with the given key in a map whose values
191
+ // are linked_ptrs. Returns nullptr if key is not found.
192
+ template <class Collection>
193
+ typename Collection::value_type::second_type::element_type*
194
+ FindLinkedPtrOrNull(const Collection& collection,
195
+ const typename Collection::value_type::first_type& key) {
196
+ typename Collection::const_iterator it = collection.find(key);
197
+ if (it == collection.end()) {
198
+ return 0;
199
+ }
200
+ // Since linked_ptr::get() is a const member returning a non const,
201
+ // we do not need a version of this function taking a non const collection.
202
+ return it->second.get();
203
+ }
204
+
205
+ // Same as above, but dies if the key is not found.
206
+ template <class Collection>
207
+ typename Collection::value_type::second_type::element_type&
208
+ FindLinkedPtrOrDie(const Collection& collection,
209
+ const typename Collection::value_type::first_type& key) {
210
+ typename Collection::const_iterator it = collection.find(key);
211
+ GOOGLE_CHECK(it != collection.end()) << "key not found: " << key;
212
+ // Since linked_ptr::operator*() is a const member returning a non const,
213
+ // we do not need a version of this function taking a non const collection.
214
+ return *it->second;
215
+ }
216
+
217
+ // Finds the value associated with the given key and copies it to *value (if not
218
+ // nullptr). Returns false if the key was not found, true otherwise.
219
+ template <class Collection, class Key, class Value>
220
+ bool FindCopy(const Collection& collection,
221
+ const Key& key,
222
+ Value* const value) {
223
+ typename Collection::const_iterator it = collection.find(key);
224
+ if (it == collection.end()) {
225
+ return false;
226
+ }
227
+ if (value) {
228
+ *value = it->second;
229
+ }
230
+ return true;
231
+ }
232
+
233
+ //
234
+ // Contains*()
235
+ //
236
+
237
+ // Returns true if and only if the given collection contains the given key.
238
+ template <class Collection, class Key>
239
+ bool ContainsKey(const Collection& collection, const Key& key) {
240
+ return collection.find(key) != collection.end();
241
+ }
242
+
243
+ // Returns true if and only if the given collection contains the given key-value
244
+ // pair.
245
+ template <class Collection, class Key, class Value>
246
+ bool ContainsKeyValuePair(const Collection& collection,
247
+ const Key& key,
248
+ const Value& value) {
249
+ typedef typename Collection::const_iterator const_iterator;
250
+ std::pair<const_iterator, const_iterator> range = collection.equal_range(key);
251
+ for (const_iterator it = range.first; it != range.second; ++it) {
252
+ if (it->second == value) {
253
+ return true;
254
+ }
255
+ }
256
+ return false;
257
+ }
258
+
259
+ //
260
+ // Insert*()
261
+ //
262
+
263
+ // Inserts the given key-value pair into the collection. Returns true if and
264
+ // only if the key from the given pair didn't previously exist. Otherwise, the
265
+ // value in the map is replaced with the value from the given pair.
266
+ template <class Collection>
267
+ bool InsertOrUpdate(Collection* const collection,
268
+ const typename Collection::value_type& vt) {
269
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
270
+ if (!ret.second) {
271
+ // update
272
+ ret.first->second = vt.second;
273
+ return false;
274
+ }
275
+ return true;
276
+ }
277
+
278
+ // Same as above, except that the key and value are passed separately.
279
+ template <class Collection>
280
+ bool InsertOrUpdate(Collection* const collection,
281
+ const typename Collection::value_type::first_type& key,
282
+ const typename Collection::value_type::second_type& value) {
283
+ return InsertOrUpdate(
284
+ collection, typename Collection::value_type(key, value));
285
+ }
286
+
287
+ // Inserts/updates all the key-value pairs from the range defined by the
288
+ // iterators "first" and "last" into the given collection.
289
+ template <class Collection, class InputIterator>
290
+ void InsertOrUpdateMany(Collection* const collection,
291
+ InputIterator first, InputIterator last) {
292
+ for (; first != last; ++first) {
293
+ InsertOrUpdate(collection, *first);
294
+ }
295
+ }
296
+
297
+ // Change the value associated with a particular key in a map or hash_map
298
+ // of the form map<Key, Value*> which owns the objects pointed to by the
299
+ // value pointers. If there was an existing value for the key, it is deleted.
300
+ // True indicates an insert took place, false indicates an update + delete.
301
+ template <class Collection>
302
+ bool InsertAndDeleteExisting(
303
+ Collection* const collection,
304
+ const typename Collection::value_type::first_type& key,
305
+ const typename Collection::value_type::second_type& value) {
306
+ std::pair<typename Collection::iterator, bool> ret =
307
+ collection->insert(typename Collection::value_type(key, value));
308
+ if (!ret.second) {
309
+ delete ret.first->second;
310
+ ret.first->second = value;
311
+ return false;
312
+ }
313
+ return true;
314
+ }
315
+
316
+ // Inserts the given key and value into the given collection if and only if the
317
+ // given key did NOT already exist in the collection. If the key previously
318
+ // existed in the collection, the value is not changed. Returns true if the
319
+ // key-value pair was inserted; returns false if the key was already present.
320
+ template <class Collection>
321
+ bool InsertIfNotPresent(Collection* const collection,
322
+ const typename Collection::value_type& vt) {
323
+ return collection->insert(vt).second;
324
+ }
325
+
326
+ // Same as above except the key and value are passed separately.
327
+ template <class Collection>
328
+ bool InsertIfNotPresent(
329
+ Collection* const collection,
330
+ const typename Collection::value_type::first_type& key,
331
+ const typename Collection::value_type::second_type& value) {
332
+ return InsertIfNotPresent(
333
+ collection, typename Collection::value_type(key, value));
334
+ }
335
+
336
+ // Same as above except dies if the key already exists in the collection.
337
+ template <class Collection>
338
+ void InsertOrDie(Collection* const collection,
339
+ const typename Collection::value_type& value) {
340
+ GOOGLE_CHECK(InsertIfNotPresent(collection, value))
341
+ << "duplicate value: " << value;
342
+ }
343
+
344
+ // Same as above except doesn't log the value on error.
345
+ template <class Collection>
346
+ void InsertOrDieNoPrint(Collection* const collection,
347
+ const typename Collection::value_type& value) {
348
+ GOOGLE_CHECK(InsertIfNotPresent(collection, value)) << "duplicate value.";
349
+ }
350
+
351
+ // Inserts the key-value pair into the collection. Dies if key was already
352
+ // present.
353
+ template <class Collection>
354
+ void InsertOrDie(Collection* const collection,
355
+ const typename Collection::value_type::first_type& key,
356
+ const typename Collection::value_type::second_type& data) {
357
+ GOOGLE_CHECK(InsertIfNotPresent(collection, key, data))
358
+ << "duplicate key: " << key;
359
+ }
360
+
361
+ // Same as above except doesn't log the key on error.
362
+ template <class Collection>
363
+ void InsertOrDieNoPrint(
364
+ Collection* const collection,
365
+ const typename Collection::value_type::first_type& key,
366
+ const typename Collection::value_type::second_type& data) {
367
+ GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key.";
368
+ }
369
+
370
+ // Inserts a new key and default-initialized value. Dies if the key was already
371
+ // present. Returns a reference to the value. Example usage:
372
+ //
373
+ // map<int, SomeProto> m;
374
+ // SomeProto& proto = InsertKeyOrDie(&m, 3);
375
+ // proto.set_field("foo");
376
+ template <class Collection>
377
+ typename Collection::value_type::second_type& InsertKeyOrDie(
378
+ Collection* const collection,
379
+ const typename Collection::value_type::first_type& key) {
380
+ typedef typename Collection::value_type value_type;
381
+ std::pair<typename Collection::iterator, bool> res =
382
+ collection->insert(value_type(key, typename value_type::second_type()));
383
+ GOOGLE_CHECK(res.second) << "duplicate key: " << key;
384
+ return res.first->second;
385
+ }
386
+
387
+ //
388
+ // Lookup*()
389
+ //
390
+
391
+ // Looks up a given key and value pair in a collection and inserts the key-value
392
+ // pair if it's not already present. Returns a reference to the value associated
393
+ // with the key.
394
+ template <class Collection>
395
+ typename Collection::value_type::second_type&
396
+ LookupOrInsert(Collection* const collection,
397
+ const typename Collection::value_type& vt) {
398
+ return collection->insert(vt).first->second;
399
+ }
400
+
401
+ // Same as above except the key-value are passed separately.
402
+ template <class Collection>
403
+ typename Collection::value_type::second_type&
404
+ LookupOrInsert(Collection* const collection,
405
+ const typename Collection::value_type::first_type& key,
406
+ const typename Collection::value_type::second_type& value) {
407
+ return LookupOrInsert(
408
+ collection, typename Collection::value_type(key, value));
409
+ }
410
+
411
+ // Counts the number of equivalent elements in the given "sequence", and stores
412
+ // the results in "count_map" with element as the key and count as the value.
413
+ //
414
+ // Example:
415
+ // vector<string> v = {"a", "b", "c", "a", "b"};
416
+ // map<string, int> m;
417
+ // AddTokenCounts(v, 1, &m);
418
+ // assert(m["a"] == 2);
419
+ // assert(m["b"] == 2);
420
+ // assert(m["c"] == 1);
421
+ template <typename Sequence, typename Collection>
422
+ void AddTokenCounts(
423
+ const Sequence& sequence,
424
+ const typename Collection::value_type::second_type& increment,
425
+ Collection* const count_map) {
426
+ for (typename Sequence::const_iterator it = sequence.begin();
427
+ it != sequence.end(); ++it) {
428
+ typename Collection::value_type::second_type& value =
429
+ LookupOrInsert(count_map, *it,
430
+ typename Collection::value_type::second_type());
431
+ value += increment;
432
+ }
433
+ }
434
+
435
+ // Returns a reference to the value associated with key. If not found, a value
436
+ // is default constructed on the heap and added to the map.
437
+ //
438
+ // This function is useful for containers of the form map<Key, Value*>, where
439
+ // inserting a new key, value pair involves constructing a new heap-allocated
440
+ // Value, and storing a pointer to that in the collection.
441
+ template <class Collection>
442
+ typename Collection::value_type::second_type&
443
+ LookupOrInsertNew(Collection* const collection,
444
+ const typename Collection::value_type::first_type& key) {
445
+ typedef typename std::iterator_traits<
446
+ typename Collection::value_type::second_type>::value_type Element;
447
+ std::pair<typename Collection::iterator, bool> ret =
448
+ collection->insert(typename Collection::value_type(
449
+ key,
450
+ static_cast<typename Collection::value_type::second_type>(nullptr)));
451
+ if (ret.second) {
452
+ ret.first->second = new Element();
453
+ }
454
+ return ret.first->second;
455
+ }
456
+
457
+ // Same as above but constructs the value using the single-argument constructor
458
+ // and the given "arg".
459
+ template <class Collection, class Arg>
460
+ typename Collection::value_type::second_type&
461
+ LookupOrInsertNew(Collection* const collection,
462
+ const typename Collection::value_type::first_type& key,
463
+ const Arg& arg) {
464
+ typedef typename std::iterator_traits<
465
+ typename Collection::value_type::second_type>::value_type Element;
466
+ std::pair<typename Collection::iterator, bool> ret =
467
+ collection->insert(typename Collection::value_type(
468
+ key,
469
+ static_cast<typename Collection::value_type::second_type>(nullptr)));
470
+ if (ret.second) {
471
+ ret.first->second = new Element(arg);
472
+ }
473
+ return ret.first->second;
474
+ }
475
+
476
+ // Lookup of linked/shared pointers is used in two scenarios:
477
+ //
478
+ // Use LookupOrInsertNewLinkedPtr if the container owns the elements.
479
+ // In this case it is fine working with the raw pointer as long as it is
480
+ // guaranteed that no other thread can delete/update an accessed element.
481
+ // A mutex will need to lock the container operation as well as the use
482
+ // of the returned elements. Finding an element may be performed using
483
+ // FindLinkedPtr*().
484
+ //
485
+ // Use LookupOrInsertNewSharedPtr if the container does not own the elements
486
+ // for their whole lifetime. This is typically the case when a reader allows
487
+ // parallel updates to the container. In this case a Mutex only needs to lock
488
+ // container operations, but all element operations must be performed on the
489
+ // shared pointer. Finding an element must be performed using FindPtr*() and
490
+ // cannot be done with FindLinkedPtr*() even though it compiles.
491
+
492
+ // Lookup a key in a map or hash_map whose values are linked_ptrs. If it is
493
+ // missing, set collection[key].reset(new Value::element_type) and return that.
494
+ // Value::element_type must be default constructable.
495
+ template <class Collection>
496
+ typename Collection::value_type::second_type::element_type*
497
+ LookupOrInsertNewLinkedPtr(
498
+ Collection* const collection,
499
+ const typename Collection::value_type::first_type& key) {
500
+ typedef typename Collection::value_type::second_type Value;
501
+ std::pair<typename Collection::iterator, bool> ret =
502
+ collection->insert(typename Collection::value_type(key, Value()));
503
+ if (ret.second) {
504
+ ret.first->second.reset(new typename Value::element_type);
505
+ }
506
+ return ret.first->second.get();
507
+ }
508
+
509
+ // A variant of LookupOrInsertNewLinkedPtr where the value is constructed using
510
+ // a single-parameter constructor. Note: the constructor argument is computed
511
+ // even if it will not be used, so only values cheap to compute should be passed
512
+ // here. On the other hand it does not matter how expensive the construction of
513
+ // the actual stored value is, as that only occurs if necessary.
514
+ template <class Collection, class Arg>
515
+ typename Collection::value_type::second_type::element_type*
516
+ LookupOrInsertNewLinkedPtr(
517
+ Collection* const collection,
518
+ const typename Collection::value_type::first_type& key,
519
+ const Arg& arg) {
520
+ typedef typename Collection::value_type::second_type Value;
521
+ std::pair<typename Collection::iterator, bool> ret =
522
+ collection->insert(typename Collection::value_type(key, Value()));
523
+ if (ret.second) {
524
+ ret.first->second.reset(new typename Value::element_type(arg));
525
+ }
526
+ return ret.first->second.get();
527
+ }
528
+
529
+ // Lookup a key in a map or hash_map whose values are shared_ptrs. If it is
530
+ // missing, set collection[key].reset(new Value::element_type). Unlike
531
+ // LookupOrInsertNewLinkedPtr, this function returns the shared_ptr instead of
532
+ // the raw pointer. Value::element_type must be default constructable.
533
+ template <class Collection>
534
+ typename Collection::value_type::second_type&
535
+ LookupOrInsertNewSharedPtr(
536
+ Collection* const collection,
537
+ const typename Collection::value_type::first_type& key) {
538
+ typedef typename Collection::value_type::second_type SharedPtr;
539
+ typedef typename Collection::value_type::second_type::element_type Element;
540
+ std::pair<typename Collection::iterator, bool> ret =
541
+ collection->insert(typename Collection::value_type(key, SharedPtr()));
542
+ if (ret.second) {
543
+ ret.first->second.reset(new Element());
544
+ }
545
+ return ret.first->second;
546
+ }
547
+
548
+ // A variant of LookupOrInsertNewSharedPtr where the value is constructed using
549
+ // a single-parameter constructor. Note: the constructor argument is computed
550
+ // even if it will not be used, so only values cheap to compute should be passed
551
+ // here. On the other hand it does not matter how expensive the construction of
552
+ // the actual stored value is, as that only occurs if necessary.
553
+ template <class Collection, class Arg>
554
+ typename Collection::value_type::second_type&
555
+ LookupOrInsertNewSharedPtr(
556
+ Collection* const collection,
557
+ const typename Collection::value_type::first_type& key,
558
+ const Arg& arg) {
559
+ typedef typename Collection::value_type::second_type SharedPtr;
560
+ typedef typename Collection::value_type::second_type::element_type Element;
561
+ std::pair<typename Collection::iterator, bool> ret =
562
+ collection->insert(typename Collection::value_type(key, SharedPtr()));
563
+ if (ret.second) {
564
+ ret.first->second.reset(new Element(arg));
565
+ }
566
+ return ret.first->second;
567
+ }
568
+
569
+ //
570
+ // Misc Utility Functions
571
+ //
572
+
573
+ // Updates the value associated with the given key. If the key was not already
574
+ // present, then the key-value pair are inserted and "previous" is unchanged. If
575
+ // the key was already present, the value is updated and "*previous" will
576
+ // contain a copy of the old value.
577
+ //
578
+ // InsertOrReturnExisting has complementary behavior that returns the
579
+ // address of an already existing value, rather than updating it.
580
+ template <class Collection>
581
+ bool UpdateReturnCopy(Collection* const collection,
582
+ const typename Collection::value_type::first_type& key,
583
+ const typename Collection::value_type::second_type& value,
584
+ typename Collection::value_type::second_type* previous) {
585
+ std::pair<typename Collection::iterator, bool> ret =
586
+ collection->insert(typename Collection::value_type(key, value));
587
+ if (!ret.second) {
588
+ // update
589
+ if (previous) {
590
+ *previous = ret.first->second;
591
+ }
592
+ ret.first->second = value;
593
+ return true;
594
+ }
595
+ return false;
596
+ }
597
+
598
+ // Same as above except that the key and value are passed as a pair.
599
+ template <class Collection>
600
+ bool UpdateReturnCopy(Collection* const collection,
601
+ const typename Collection::value_type& vt,
602
+ typename Collection::value_type::second_type* previous) {
603
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
604
+ if (!ret.second) {
605
+ // update
606
+ if (previous) {
607
+ *previous = ret.first->second;
608
+ }
609
+ ret.first->second = vt.second;
610
+ return true;
611
+ }
612
+ return false;
613
+ }
614
+
615
+ // Tries to insert the given key-value pair into the collection. Returns nullptr if
616
+ // the insert succeeds. Otherwise, returns a pointer to the existing value.
617
+ //
618
+ // This complements UpdateReturnCopy in that it allows to update only after
619
+ // verifying the old value and still insert quickly without having to look up
620
+ // twice. Unlike UpdateReturnCopy this also does not come with the issue of an
621
+ // undefined previous* in case new data was inserted.
622
+ template <class Collection>
623
+ typename Collection::value_type::second_type* InsertOrReturnExisting(
624
+ Collection* const collection, const typename Collection::value_type& vt) {
625
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
626
+ if (ret.second) {
627
+ return nullptr; // Inserted, no existing previous value.
628
+ } else {
629
+ return &ret.first->second; // Return address of already existing value.
630
+ }
631
+ }
632
+
633
+ // Same as above, except for explicit key and data.
634
+ template <class Collection>
635
+ typename Collection::value_type::second_type* InsertOrReturnExisting(
636
+ Collection* const collection,
637
+ const typename Collection::value_type::first_type& key,
638
+ const typename Collection::value_type::second_type& data) {
639
+ return InsertOrReturnExisting(collection,
640
+ typename Collection::value_type(key, data));
641
+ }
642
+
643
+ // Erases the collection item identified by the given key, and returns the value
644
+ // associated with that key. It is assumed that the value (i.e., the
645
+ // mapped_type) is a pointer. Returns nullptr if the key was not found in the
646
+ // collection.
647
+ //
648
+ // Examples:
649
+ // map<string, MyType*> my_map;
650
+ //
651
+ // One line cleanup:
652
+ // delete EraseKeyReturnValuePtr(&my_map, "abc");
653
+ //
654
+ // Use returned value:
655
+ // std::unique_ptr<MyType> value_ptr(
656
+ // EraseKeyReturnValuePtr(&my_map, "abc"));
657
+ // if (value_ptr.get())
658
+ // value_ptr->DoSomething();
659
+ //
660
+ template <class Collection>
661
+ typename Collection::value_type::second_type EraseKeyReturnValuePtr(
662
+ Collection* const collection,
663
+ const typename Collection::value_type::first_type& key) {
664
+ typename Collection::iterator it = collection->find(key);
665
+ if (it == collection->end()) {
666
+ return nullptr;
667
+ }
668
+ typename Collection::value_type::second_type v = it->second;
669
+ collection->erase(it);
670
+ return v;
671
+ }
672
+
673
+ // Inserts all the keys from map_container into key_container, which must
674
+ // support insert(MapContainer::key_type).
675
+ //
676
+ // Note: any initial contents of the key_container are not cleared.
677
+ template <class MapContainer, class KeyContainer>
678
+ void InsertKeysFromMap(const MapContainer& map_container,
679
+ KeyContainer* key_container) {
680
+ GOOGLE_CHECK(key_container != nullptr);
681
+ for (typename MapContainer::const_iterator it = map_container.begin();
682
+ it != map_container.end(); ++it) {
683
+ key_container->insert(it->first);
684
+ }
685
+ }
686
+
687
+ // Appends all the keys from map_container into key_container, which must
688
+ // support push_back(MapContainer::key_type).
689
+ //
690
+ // Note: any initial contents of the key_container are not cleared.
691
+ template <class MapContainer, class KeyContainer>
692
+ void AppendKeysFromMap(const MapContainer& map_container,
693
+ KeyContainer* key_container) {
694
+ GOOGLE_CHECK(key_container != nullptr);
695
+ for (typename MapContainer::const_iterator it = map_container.begin();
696
+ it != map_container.end(); ++it) {
697
+ key_container->push_back(it->first);
698
+ }
699
+ }
700
+
701
+ // A more specialized overload of AppendKeysFromMap to optimize reallocations
702
+ // for the common case in which we're appending keys to a vector and hence can
703
+ // (and sometimes should) call reserve() first.
704
+ //
705
+ // (It would be possible to play SFINAE games to call reserve() for any
706
+ // container that supports it, but this seems to get us 99% of what we need
707
+ // without the complexity of a SFINAE-based solution.)
708
+ template <class MapContainer, class KeyType>
709
+ void AppendKeysFromMap(const MapContainer& map_container,
710
+ std::vector<KeyType>* key_container) {
711
+ GOOGLE_CHECK(key_container != nullptr);
712
+ // We now have the opportunity to call reserve(). Calling reserve() every
713
+ // time is a bad idea for some use cases: libstdc++'s implementation of
714
+ // vector<>::reserve() resizes the vector's backing store to exactly the
715
+ // given size (unless it's already at least that big). Because of this,
716
+ // the use case that involves appending a lot of small maps (total size
717
+ // N) one by one to a vector would be O(N^2). But never calling reserve()
718
+ // loses the opportunity to improve the use case of adding from a large
719
+ // map to an empty vector (this improves performance by up to 33%). A
720
+ // number of heuristics are possible; see the discussion in
721
+ // cl/34081696. Here we use the simplest one.
722
+ if (key_container->empty()) {
723
+ key_container->reserve(map_container.size());
724
+ }
725
+ for (typename MapContainer::const_iterator it = map_container.begin();
726
+ it != map_container.end(); ++it) {
727
+ key_container->push_back(it->first);
728
+ }
729
+ }
730
+
731
+ // Inserts all the values from map_container into value_container, which must
732
+ // support push_back(MapContainer::mapped_type).
733
+ //
734
+ // Note: any initial contents of the value_container are not cleared.
735
+ template <class MapContainer, class ValueContainer>
736
+ void AppendValuesFromMap(const MapContainer& map_container,
737
+ ValueContainer* value_container) {
738
+ GOOGLE_CHECK(value_container != nullptr);
739
+ for (typename MapContainer::const_iterator it = map_container.begin();
740
+ it != map_container.end(); ++it) {
741
+ value_container->push_back(it->second);
742
+ }
743
+ }
744
+
745
+ // A more specialized overload of AppendValuesFromMap to optimize reallocations
746
+ // for the common case in which we're appending values to a vector and hence
747
+ // can (and sometimes should) call reserve() first.
748
+ //
749
+ // (It would be possible to play SFINAE games to call reserve() for any
750
+ // container that supports it, but this seems to get us 99% of what we need
751
+ // without the complexity of a SFINAE-based solution.)
752
+ template <class MapContainer, class ValueType>
753
+ void AppendValuesFromMap(const MapContainer& map_container,
754
+ std::vector<ValueType>* value_container) {
755
+ GOOGLE_CHECK(value_container != nullptr);
756
+ // See AppendKeysFromMap for why this is done.
757
+ if (value_container->empty()) {
758
+ value_container->reserve(map_container.size());
759
+ }
760
+ for (typename MapContainer::const_iterator it = map_container.begin();
761
+ it != map_container.end(); ++it) {
762
+ value_container->push_back(it->second);
763
+ }
764
+ }
765
+
766
+ } // namespace protobuf
767
+ } // namespace google
768
+
769
+ #endif // GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/mathutil.h ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ #ifndef GOOGLE_PROTOBUF_STUBS_MATHUTIL_H_
31
+ #define GOOGLE_PROTOBUF_STUBS_MATHUTIL_H_
32
+
33
+ #include <cmath>
34
+ #include <float.h>
35
+ #include <limits>
36
+
37
+ #include <google/protobuf/stubs/common.h>
38
+ #include <google/protobuf/stubs/logging.h>
39
+
40
+ namespace google {
41
+ namespace protobuf {
42
+ namespace internal {
43
+
44
+ // Like std::make_unsigned_t except floating point types map to themselves.
45
+ template <typename T>
46
+ using MakeUnsignedT =
47
+ typename std::conditional<std::is_integral<T>::value, std::make_unsigned<T>,
48
+ std::common_type<T>>::type::type;
49
+
50
+ // Like std::isnan() except a template function that is defined for all numeric
51
+ // types.
52
+ template <typename T,
53
+ typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
54
+ bool IsNan(T /*val*/) {
55
+ return false;
56
+ }
57
+
58
+ template <typename T, typename std::enable_if<std::is_floating_point<T>::value,
59
+ int>::type = 0>
60
+ bool IsNan(T val) {
61
+ return std::isnan(val);
62
+ }
63
+
64
+ template<typename T>
65
+ bool AlmostEquals(T a, T b) {
66
+ return a == b;
67
+ }
68
+ template<>
69
+ inline bool AlmostEquals(float a, float b) {
70
+ return fabs(a - b) < 32 * FLT_EPSILON;
71
+ }
72
+
73
+ template<>
74
+ inline bool AlmostEquals(double a, double b) {
75
+ return fabs(a - b) < 32 * DBL_EPSILON;
76
+ }
77
+
78
+ } // namespace internal
79
+
80
+ class MathUtil {
81
+ public:
82
+ template <typename T>
83
+ static T Sign(T value) {
84
+ if (value == T(0) || internal::IsNan(value)) {
85
+ return value;
86
+ }
87
+ return value > T(0) ? 1 : -1;
88
+ }
89
+
90
+ template <typename T>
91
+ static bool AlmostEquals(T a, T b) {
92
+ return internal::AlmostEquals(a, b);
93
+ }
94
+
95
+ // Largest of two values.
96
+ // Works correctly for special floating point values.
97
+ // Note: 0.0 and -0.0 are not differentiated by Max (Max(0.0, -0.0) is -0.0),
98
+ // which should be OK because, although they (can) have different
99
+ // bit representation, they are observably the same when examined
100
+ // with arithmetic and (in)equality operators.
101
+ template <typename T>
102
+ static T Max(const T x, const T y) {
103
+ return internal::IsNan(x) || x > y ? x : y;
104
+ }
105
+
106
+ // Absolute value of x
107
+ // Works correctly for unsigned types and
108
+ // for special floating point values.
109
+ // Note: 0.0 and -0.0 are not differentiated by Abs (Abs(0.0) is -0.0),
110
+ // which should be OK: see the comment for Max above.
111
+ template<typename T>
112
+ static T Abs(const T x) {
113
+ return x > T(0) ? x : -x;
114
+ }
115
+
116
+ // Absolute value of the difference between two numbers.
117
+ // Works correctly for signed types and special floating point values.
118
+ template <typename T>
119
+ static typename internal::MakeUnsignedT<T> AbsDiff(const T x, const T y) {
120
+ // Carries out arithmetic as unsigned to avoid overflow.
121
+ typedef typename internal::MakeUnsignedT<T> R;
122
+ return x > y ? R(x) - R(y) : R(y) - R(x);
123
+ }
124
+
125
+ // If two (usually floating point) numbers are within a certain
126
+ // fraction of their magnitude or within a certain absolute margin of error.
127
+ // This is the same as the following but faster:
128
+ // WithinFraction(x, y, fraction) || WithinMargin(x, y, margin)
129
+ // E.g. WithinFraction(0.0, 1e-10, 1e-5) is false but
130
+ // WithinFractionOrMargin(0.0, 1e-10, 1e-5, 1e-5) is true.
131
+ template<typename T>
132
+ static bool WithinFractionOrMargin(const T x, const T y,
133
+ const T fraction, const T margin);
134
+ };
135
+
136
+ template<typename T>
137
+ bool MathUtil::WithinFractionOrMargin(const T x, const T y,
138
+ const T fraction, const T margin) {
139
+ // Not just "0 <= fraction" to fool the compiler for unsigned types.
140
+ GOOGLE_DCHECK((T(0) < fraction || T(0) == fraction) &&
141
+ fraction < T(1) &&
142
+ margin >= T(0));
143
+
144
+ // Template specialization will convert the if() condition to a constant,
145
+ // which will cause the compiler to generate code for either the "if" part
146
+ // or the "then" part. In this way we avoid a compiler warning
147
+ // about a potential integer overflow in crosstool v12 (gcc 4.3.1).
148
+ if (std::numeric_limits<T>::is_integer) {
149
+ return x == y;
150
+ } else {
151
+ if (!std::isfinite(x) || !std::isfinite(y)) {
152
+ return false;
153
+ }
154
+ T relative_margin = static_cast<T>(fraction * Max(Abs(x), Abs(y)));
155
+ return AbsDiff(x, y) <= Max(margin, relative_margin);
156
+ }
157
+ }
158
+
159
+ } // namespace protobuf
160
+ } // namespace google
161
+
162
+ #endif // GOOGLE_PROTOBUF_STUBS_MATHUTIL_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/mutex.h ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2006, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ #ifndef GOOGLE_PROTOBUF_STUBS_MUTEX_H_
31
+ #define GOOGLE_PROTOBUF_STUBS_MUTEX_H_
32
+
33
+ #include <mutex>
34
+
35
+ #ifdef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
36
+
37
+ #include <windows.h>
38
+
39
+ // GetMessage conflicts with GeneratedMessageReflection::GetMessage().
40
+ #ifdef GetMessage
41
+ #undef GetMessage
42
+ #endif
43
+
44
+ #endif
45
+
46
+ #include <google/protobuf/stubs/macros.h>
47
+
48
+ // Define thread-safety annotations for use below, if we are building with
49
+ // Clang.
50
+ #if defined(__clang__) && !defined(SWIG)
51
+ #define GOOGLE_PROTOBUF_ACQUIRE(...) \
52
+ __attribute__((acquire_capability(__VA_ARGS__)))
53
+ #define GOOGLE_PROTOBUF_RELEASE(...) \
54
+ __attribute__((release_capability(__VA_ARGS__)))
55
+ #define GOOGLE_PROTOBUF_SCOPED_CAPABILITY __attribute__((scoped_lockable))
56
+ #define GOOGLE_PROTOBUF_CAPABILITY(x) __attribute__((capability(x)))
57
+ #else
58
+ #define GOOGLE_PROTOBUF_ACQUIRE(...)
59
+ #define GOOGLE_PROTOBUF_RELEASE(...)
60
+ #define GOOGLE_PROTOBUF_SCOPED_CAPABILITY
61
+ #define GOOGLE_PROTOBUF_CAPABILITY(x)
62
+ #endif
63
+
64
+ #include <google/protobuf/port_def.inc>
65
+
66
+ // ===================================================================
67
+ // emulates google3/base/mutex.h
68
+ namespace google {
69
+ namespace protobuf {
70
+ namespace internal {
71
+
72
+ #define GOOGLE_PROTOBUF_LINKER_INITIALIZED
73
+
74
+ #ifdef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
75
+
76
+ // This class is a lightweight replacement for std::mutex on Windows platforms.
77
+ // std::mutex does not work on Windows XP SP2 with the latest VC++ libraries,
78
+ // because it utilizes the Concurrency Runtime that is only supported on Windows
79
+ // XP SP3 and above.
80
+ class PROTOBUF_EXPORT CriticalSectionLock {
81
+ public:
82
+ CriticalSectionLock() { InitializeCriticalSection(&critical_section_); }
83
+ ~CriticalSectionLock() { DeleteCriticalSection(&critical_section_); }
84
+ void lock() { EnterCriticalSection(&critical_section_); }
85
+ void unlock() { LeaveCriticalSection(&critical_section_); }
86
+
87
+ private:
88
+ CRITICAL_SECTION critical_section_;
89
+
90
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CriticalSectionLock);
91
+ };
92
+
93
+ #endif
94
+
95
+ // In MSVC std::mutex does not have a constexpr constructor.
96
+ // This wrapper makes the constructor constexpr.
97
+ template <typename T>
98
+ class CallOnceInitializedMutex {
99
+ public:
100
+ constexpr CallOnceInitializedMutex() : flag_{}, buf_{} {}
101
+ ~CallOnceInitializedMutex() { get().~T(); }
102
+
103
+ void lock() { get().lock(); }
104
+ void unlock() { get().unlock(); }
105
+
106
+ private:
107
+ T& get() {
108
+ std::call_once(flag_, [&] { ::new (static_cast<void*>(&buf_)) T(); });
109
+ return reinterpret_cast<T&>(buf_);
110
+ }
111
+
112
+ std::once_flag flag_;
113
+ alignas(T) char buf_[sizeof(T)];
114
+ };
115
+
116
+ // Mutex is a natural type to wrap. As both google and other organization have
117
+ // specialized mutexes. gRPC also provides an injection mechanism for custom
118
+ // mutexes.
119
+ class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
120
+ public:
121
+ #if defined(__QNX__)
122
+ constexpr WrappedMutex() = default;
123
+ #else
124
+ constexpr WrappedMutex() {}
125
+ #endif
126
+ void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
127
+ void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
128
+ // Crash if this Mutex is not held exclusively by this thread.
129
+ // May fail to crash when it should; will never crash when it should not.
130
+ void AssertHeld() const {}
131
+
132
+ private:
133
+ #if defined(GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP)
134
+ CallOnceInitializedMutex<CriticalSectionLock> mu_{};
135
+ #elif defined(_WIN32)
136
+ CallOnceInitializedMutex<std::mutex> mu_{};
137
+ #else
138
+ std::mutex mu_{};
139
+ #endif
140
+ };
141
+
142
+ using Mutex = WrappedMutex;
143
+
144
+ // MutexLock(mu) acquires mu when constructed and releases it when destroyed.
145
+ class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock {
146
+ public:
147
+ explicit MutexLock(Mutex* mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) {
148
+ this->mu_->Lock();
149
+ }
150
+ ~MutexLock() GOOGLE_PROTOBUF_RELEASE() { this->mu_->Unlock(); }
151
+
152
+ private:
153
+ Mutex *const mu_;
154
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock);
155
+ };
156
+
157
+ // TODO(kenton): Implement these? Hard to implement portably.
158
+ typedef MutexLock ReaderMutexLock;
159
+ typedef MutexLock WriterMutexLock;
160
+
161
+ // MutexLockMaybe is like MutexLock, but is a no-op when mu is nullptr.
162
+ class PROTOBUF_EXPORT MutexLockMaybe {
163
+ public:
164
+ explicit MutexLockMaybe(Mutex *mu) :
165
+ mu_(mu) { if (this->mu_ != nullptr) { this->mu_->Lock(); } }
166
+ ~MutexLockMaybe() { if (this->mu_ != nullptr) { this->mu_->Unlock(); } }
167
+ private:
168
+ Mutex *const mu_;
169
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLockMaybe);
170
+ };
171
+
172
+ #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
173
+ template<typename T>
174
+ class ThreadLocalStorage {
175
+ public:
176
+ ThreadLocalStorage() {
177
+ pthread_key_create(&key_, &ThreadLocalStorage::Delete);
178
+ }
179
+ ~ThreadLocalStorage() {
180
+ pthread_key_delete(key_);
181
+ }
182
+ T* Get() {
183
+ T* result = static_cast<T*>(pthread_getspecific(key_));
184
+ if (result == nullptr) {
185
+ result = new T();
186
+ pthread_setspecific(key_, result);
187
+ }
188
+ return result;
189
+ }
190
+ private:
191
+ static void Delete(void* value) {
192
+ delete static_cast<T*>(value);
193
+ }
194
+ pthread_key_t key_;
195
+
196
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ThreadLocalStorage);
197
+ };
198
+ #endif
199
+
200
+ } // namespace internal
201
+
202
+ // We made these internal so that they would show up as such in the docs,
203
+ // but we don't want to stick "internal::" in front of them everywhere.
204
+ using internal::Mutex;
205
+ using internal::MutexLock;
206
+ using internal::ReaderMutexLock;
207
+ using internal::WriterMutexLock;
208
+ using internal::MutexLockMaybe;
209
+
210
+ } // namespace protobuf
211
+ } // namespace google
212
+
213
+ #undef GOOGLE_PROTOBUF_ACQUIRE
214
+ #undef GOOGLE_PROTOBUF_RELEASE
215
+
216
+ #include <google/protobuf/port_undef.inc>
217
+
218
+ #endif // GOOGLE_PROTOBUF_STUBS_MUTEX_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/once.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_STUBS_ONCE_H__
32
+ #define GOOGLE_PROTOBUF_STUBS_ONCE_H__
33
+
34
+ #include <mutex>
35
+ #include <utility>
36
+
37
+ #include <google/protobuf/port_def.inc>
38
+
39
+ namespace google {
40
+ namespace protobuf {
41
+ namespace internal {
42
+
43
+ using once_flag = std::once_flag;
44
+ template <typename... Args>
45
+ void call_once(Args&&... args ) {
46
+ std::call_once(std::forward<Args>(args)...);
47
+ }
48
+
49
+ } // namespace internal
50
+ } // namespace protobuf
51
+ } // namespace google
52
+
53
+ #include <google/protobuf/port_undef.inc>
54
+
55
+ #endif // GOOGLE_PROTOBUF_STUBS_ONCE_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/platform_macros.h ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2012 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
32
+ #define GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
33
+
34
+ #define GOOGLE_PROTOBUF_PLATFORM_ERROR \
35
+ #error "Host platform was not detected as supported by protobuf"
36
+
37
+ // Processor architecture detection. For more info on what's defined, see:
38
+ // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
39
+ // http://www.agner.org/optimize/calling_conventions.pdf
40
+ // or with gcc, run: "echo | gcc -E -dM -"
41
+ #if defined(_M_X64) || defined(__x86_64__)
42
+ #define GOOGLE_PROTOBUF_ARCH_X64 1
43
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
44
+ #elif defined(_M_IX86) || defined(__i386__)
45
+ #define GOOGLE_PROTOBUF_ARCH_IA32 1
46
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
47
+ #elif defined(__QNX__)
48
+ #define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1
49
+ #if defined(__aarch64__)
50
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
51
+ #else
52
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
53
+ #endif
54
+ #elif defined(_M_ARM) || defined(__ARMEL__)
55
+ #define GOOGLE_PROTOBUF_ARCH_ARM 1
56
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
57
+ #elif defined(_M_ARM64)
58
+ #define GOOGLE_PROTOBUF_ARCH_ARM 1
59
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
60
+ #elif defined(__aarch64__)
61
+ #define GOOGLE_PROTOBUF_ARCH_AARCH64 1
62
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
63
+ #elif defined(__mips__)
64
+ #if defined(__LP64__)
65
+ #define GOOGLE_PROTOBUF_ARCH_MIPS64 1
66
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
67
+ #else
68
+ #define GOOGLE_PROTOBUF_ARCH_MIPS 1
69
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
70
+ #endif
71
+ #elif defined(__pnacl__)
72
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
73
+ #elif defined(sparc)
74
+ #define GOOGLE_PROTOBUF_ARCH_SPARC 1
75
+ #if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
76
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
77
+ #else
78
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
79
+ #endif
80
+ #elif defined(_POWER) || defined(__powerpc64__) || defined(__PPC64__)
81
+ #define GOOGLE_PROTOBUF_ARCH_POWER 1
82
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
83
+ #elif defined(__PPC__)
84
+ #define GOOGLE_PROTOBUF_ARCH_PPC 1
85
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
86
+ #elif defined(__GNUC__)
87
+ # if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
88
+ // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h
89
+ # elif defined(__clang__)
90
+ # if !__has_extension(c_atomic)
91
+ GOOGLE_PROTOBUF_PLATFORM_ERROR
92
+ # endif
93
+ // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h
94
+ # endif
95
+ # if __LP64__
96
+ # define GOOGLE_PROTOBUF_ARCH_64_BIT 1
97
+ # else
98
+ # define GOOGLE_PROTOBUF_ARCH_32_BIT 1
99
+ # endif
100
+ #else
101
+ GOOGLE_PROTOBUF_PLATFORM_ERROR
102
+ #endif
103
+
104
+ #if defined(__APPLE__)
105
+ #define GOOGLE_PROTOBUF_OS_APPLE
106
+ #include <Availability.h>
107
+ #include <TargetConditionals.h>
108
+ #if TARGET_OS_IPHONE
109
+ #define GOOGLE_PROTOBUF_OS_IPHONE
110
+ #endif
111
+ #elif defined(__EMSCRIPTEN__)
112
+ #define GOOGLE_PROTOBUF_OS_EMSCRIPTEN
113
+ #elif defined(__native_client__)
114
+ #define GOOGLE_PROTOBUF_OS_NACL
115
+ #elif defined(sun)
116
+ #define GOOGLE_PROTOBUF_OS_SOLARIS
117
+ #elif defined(_AIX)
118
+ #define GOOGLE_PROTOBUF_OS_AIX
119
+ #elif defined(__ANDROID__)
120
+ #define GOOGLE_PROTOBUF_OS_ANDROID
121
+ #endif
122
+
123
+ #undef GOOGLE_PROTOBUF_PLATFORM_ERROR
124
+
125
+ #if defined(GOOGLE_PROTOBUF_OS_ANDROID) || defined(GOOGLE_PROTOBUF_OS_IPHONE)
126
+ // Android ndk does not support the __thread keyword very well yet. Here
127
+ // we use pthread_key_create()/pthread_getspecific()/... methods for
128
+ // TLS support on android.
129
+ // iOS also does not support the __thread keyword.
130
+ #define GOOGLE_PROTOBUF_NO_THREADLOCAL
131
+ #endif
132
+
133
+ #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
134
+ // __thread keyword requires at least 10.7
135
+ #define GOOGLE_PROTOBUF_NO_THREADLOCAL
136
+ #endif
137
+
138
+ #endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/port.h ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_STUBS_PORT_H_
32
+ #define GOOGLE_PROTOBUF_STUBS_PORT_H_
33
+
34
+ #include <assert.h>
35
+ #include <cstdint>
36
+ #include <stdlib.h>
37
+ #include <cstddef>
38
+ #include <string>
39
+ #include <string.h>
40
+
41
+ #include <google/protobuf/stubs/platform_macros.h>
42
+
43
+ #include <google/protobuf/port_def.inc>
44
+
45
+ #undef PROTOBUF_LITTLE_ENDIAN
46
+ #ifdef _WIN32
47
+ // Assuming windows is always little-endian.
48
+ // TODO(xiaofeng): The PROTOBUF_LITTLE_ENDIAN is not only used for
49
+ // optimization but also for correctness. We should define an
50
+ // different macro to test the big-endian code path in coded_stream.
51
+ #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
52
+ #define PROTOBUF_LITTLE_ENDIAN 1
53
+ #endif
54
+ #if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
55
+ // If MSVC has "/RTCc" set, it will complain about truncating casts at
56
+ // runtime. This file contains some intentional truncating casts.
57
+ #pragma runtime_checks("c", off)
58
+ #endif
59
+ #else
60
+ #ifdef __APPLE__
61
+ #include <machine/endian.h> // __BYTE_ORDER
62
+ #elif defined(__FreeBSD__)
63
+ #include <sys/endian.h> // __BYTE_ORDER
64
+ #elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
65
+ #include <sys/isa_defs.h> // __BYTE_ORDER
66
+ #elif defined(_AIX) || defined(__TOS_AIX__)
67
+ #include <sys/machine.h> // BYTE_ORDER
68
+ #else
69
+ #if !defined(__QNX__)
70
+ #include <endian.h> // __BYTE_ORDER
71
+ #endif
72
+ #endif
73
+ #if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
74
+ (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
75
+ (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN)) && \
76
+ !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
77
+ #define PROTOBUF_LITTLE_ENDIAN 1
78
+ #endif
79
+ #endif
80
+
81
+ // These #includes are for the byte swap functions declared later on.
82
+ #ifdef _MSC_VER
83
+ #include <stdlib.h> // NOLINT(build/include)
84
+ #include <intrin.h>
85
+ #elif defined(__APPLE__)
86
+ #include <libkern/OSByteOrder.h>
87
+ #elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__)
88
+ #include <byteswap.h> // IWYU pragma: export
89
+ #endif
90
+
91
+ // Legacy: some users reference these (internal-only) macros even though we
92
+ // don't need them any more.
93
+ #if defined(_MSC_VER) && defined(PROTOBUF_USE_DLLS)
94
+ #ifdef LIBPROTOBUF_EXPORTS
95
+ #define LIBPROTOBUF_EXPORT __declspec(dllexport)
96
+ #else
97
+ #define LIBPROTOBUF_EXPORT __declspec(dllimport)
98
+ #endif
99
+ #ifdef LIBPROTOC_EXPORTS
100
+ #define LIBPROTOC_EXPORT __declspec(dllexport)
101
+ #else
102
+ #define LIBPROTOC_EXPORT __declspec(dllimport)
103
+ #endif
104
+ #else
105
+ #define LIBPROTOBUF_EXPORT
106
+ #define LIBPROTOC_EXPORT
107
+ #endif
108
+
109
+ #define PROTOBUF_RUNTIME_DEPRECATED(message) PROTOBUF_DEPRECATED_MSG(message)
110
+ #define GOOGLE_PROTOBUF_RUNTIME_DEPRECATED(message) \
111
+ PROTOBUF_DEPRECATED_MSG(message)
112
+
113
+ // ===================================================================
114
+ // from google3/base/port.h
115
+
116
+ #if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L || \
117
+ (defined(_MSC_VER) && _MSC_VER >= 1900))
118
+ // Define this to 1 if the code is compiled in C++11 mode; leave it
119
+ // undefined otherwise. Do NOT define it to 0 -- that causes
120
+ // '#ifdef LANG_CXX11' to behave differently from '#if LANG_CXX11'.
121
+ #define LANG_CXX11 1
122
+ #else
123
+ #error "Protobuf requires at least C++11."
124
+ #endif
125
+
126
+ namespace google {
127
+ namespace protobuf {
128
+
129
+ using ConstStringParam = const std::string &;
130
+
131
+ typedef unsigned int uint;
132
+
133
+ typedef int8_t int8;
134
+ typedef int16_t int16;
135
+ typedef int32_t int32;
136
+ typedef int64_t int64;
137
+
138
+ typedef uint8_t uint8;
139
+ typedef uint16_t uint16;
140
+ typedef uint32_t uint32;
141
+ typedef uint64_t uint64;
142
+
143
+ static const int32 kint32max = 0x7FFFFFFF;
144
+ static const int32 kint32min = -kint32max - 1;
145
+ static const int64 kint64max = int64_t{0x7FFFFFFFFFFFFFFF};
146
+ static const int64 kint64min = -kint64max - 1;
147
+ static const uint32 kuint32max = 0xFFFFFFFFu;
148
+ static const uint64 kuint64max = uint64_t{0xFFFFFFFFFFFFFFFFu};
149
+
150
+ #if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) ||\
151
+ defined(MEMORY_SANITIZER)
152
+
153
+ #ifdef __cplusplus
154
+ extern "C" {
155
+ #endif // __cplusplus
156
+ uint16_t __sanitizer_unaligned_load16(const void *p);
157
+ uint32_t __sanitizer_unaligned_load32(const void *p);
158
+ uint64_t __sanitizer_unaligned_load64(const void *p);
159
+ void __sanitizer_unaligned_store16(void *p, uint16_t v);
160
+ void __sanitizer_unaligned_store32(void *p, uint32_t v);
161
+ void __sanitizer_unaligned_store64(void *p, uint64_t v);
162
+ #ifdef __cplusplus
163
+ } // extern "C"
164
+ #endif // __cplusplus
165
+
166
+ inline uint16_t GOOGLE_UNALIGNED_LOAD16(const void *p) {
167
+ return __sanitizer_unaligned_load16(p);
168
+ }
169
+
170
+ inline uint32_t GOOGLE_UNALIGNED_LOAD32(const void *p) {
171
+ return __sanitizer_unaligned_load32(p);
172
+ }
173
+
174
+ inline uint64_t GOOGLE_UNALIGNED_LOAD64(const void *p) {
175
+ return __sanitizer_unaligned_load64(p);
176
+ }
177
+
178
+ inline void GOOGLE_UNALIGNED_STORE16(void *p, uint16_t v) {
179
+ __sanitizer_unaligned_store16(p, v);
180
+ }
181
+
182
+ inline void GOOGLE_UNALIGNED_STORE32(void *p, uint32_t v) {
183
+ __sanitizer_unaligned_store32(p, v);
184
+ }
185
+
186
+ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64_t v) {
187
+ __sanitizer_unaligned_store64(p, v);
188
+ }
189
+
190
+ #elif defined(GOOGLE_PROTOBUF_USE_UNALIGNED) && GOOGLE_PROTOBUF_USE_UNALIGNED
191
+
192
+ #define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16_t *>(_p))
193
+ #define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32_t *>(_p))
194
+ #define GOOGLE_UNALIGNED_LOAD64(_p) (*reinterpret_cast<const uint64_t *>(_p))
195
+
196
+ #define GOOGLE_UNALIGNED_STORE16(_p, _val) (*reinterpret_cast<uint16_t *>(_p) = (_val))
197
+ #define GOOGLE_UNALIGNED_STORE32(_p, _val) (*reinterpret_cast<uint32_t *>(_p) = (_val))
198
+ #define GOOGLE_UNALIGNED_STORE64(_p, _val) (*reinterpret_cast<uint64_t *>(_p) = (_val))
199
+
200
+ #else
201
+ inline uint16_t GOOGLE_UNALIGNED_LOAD16(const void *p) {
202
+ uint16_t t;
203
+ memcpy(&t, p, sizeof t);
204
+ return t;
205
+ }
206
+
207
+ inline uint32_t GOOGLE_UNALIGNED_LOAD32(const void *p) {
208
+ uint32_t t;
209
+ memcpy(&t, p, sizeof t);
210
+ return t;
211
+ }
212
+
213
+ inline uint64_t GOOGLE_UNALIGNED_LOAD64(const void *p) {
214
+ uint64_t t;
215
+ memcpy(&t, p, sizeof t);
216
+ return t;
217
+ }
218
+
219
+ inline void GOOGLE_UNALIGNED_STORE16(void *p, uint16_t v) {
220
+ memcpy(p, &v, sizeof v);
221
+ }
222
+
223
+ inline void GOOGLE_UNALIGNED_STORE32(void *p, uint32_t v) {
224
+ memcpy(p, &v, sizeof v);
225
+ }
226
+
227
+ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64_t v) {
228
+ memcpy(p, &v, sizeof v);
229
+ }
230
+ #endif
231
+
232
+ #if defined(GOOGLE_PROTOBUF_OS_NACL) \
233
+ || (defined(__ANDROID__) && defined(__clang__) \
234
+ && (__clang_major__ == 3 && __clang_minor__ == 8) \
235
+ && (__clang_patchlevel__ < 275480))
236
+ # define GOOGLE_PROTOBUF_USE_PORTABLE_LOG2
237
+ #endif
238
+
239
+ // The following guarantees declaration of the byte swap functions.
240
+ #ifdef _MSC_VER
241
+ #define bswap_16(x) _byteswap_ushort(x)
242
+ #define bswap_32(x) _byteswap_ulong(x)
243
+ #define bswap_64(x) _byteswap_uint64(x)
244
+
245
+ #elif defined(__APPLE__)
246
+ // Mac OS X / Darwin features
247
+ #define bswap_16(x) OSSwapInt16(x)
248
+ #define bswap_32(x) OSSwapInt32(x)
249
+ #define bswap_64(x) OSSwapInt64(x)
250
+
251
+ #elif !defined(__linux__) && !defined(__ANDROID__) && !defined(__CYGWIN__)
252
+
253
+ #ifndef bswap_16
254
+ static inline uint16_t bswap_16(uint16_t x) {
255
+ return static_cast<uint16_t>(((x & 0xFF) << 8) | ((x & 0xFF00) >> 8));
256
+ }
257
+ #define bswap_16(x) bswap_16(x)
258
+ #endif
259
+
260
+ #ifndef bswap_32
261
+ static inline uint32_t bswap_32(uint32_t x) {
262
+ return (((x & 0xFF) << 24) |
263
+ ((x & 0xFF00) << 8) |
264
+ ((x & 0xFF0000) >> 8) |
265
+ ((x & 0xFF000000) >> 24));
266
+ }
267
+ #define bswap_32(x) bswap_32(x)
268
+ #endif
269
+
270
+ #ifndef bswap_64
271
+ static inline uint64_t bswap_64(uint64_t x) {
272
+ return (((x & uint64_t{0xFFu}) << 56) | ((x & uint64_t{0xFF00u}) << 40) |
273
+ ((x & uint64_t{0xFF0000u}) << 24) |
274
+ ((x & uint64_t{0xFF000000u}) << 8) |
275
+ ((x & uint64_t{0xFF00000000u}) >> 8) |
276
+ ((x & uint64_t{0xFF0000000000u}) >> 24) |
277
+ ((x & uint64_t{0xFF000000000000u}) >> 40) |
278
+ ((x & uint64_t{0xFF00000000000000u}) >> 56));
279
+ }
280
+ #define bswap_64(x) bswap_64(x)
281
+ #endif
282
+
283
+ #endif
284
+
285
+ // ===================================================================
286
+ // from google3/util/bits/bits.h
287
+
288
+ class Bits {
289
+ public:
290
+ static uint32_t Log2FloorNonZero(uint32_t n) {
291
+ #if defined(__GNUC__)
292
+ return 31 ^ static_cast<uint32_t>(__builtin_clz(n));
293
+ #elif defined(_MSC_VER)
294
+ unsigned long where;
295
+ _BitScanReverse(&where, n);
296
+ return where;
297
+ #else
298
+ return Log2FloorNonZero_Portable(n);
299
+ #endif
300
+ }
301
+
302
+ static uint32_t Log2FloorNonZero64(uint64_t n) {
303
+ // Older versions of clang run into an instruction-selection failure when
304
+ // it encounters __builtin_clzll:
305
+ // https://bugs.chromium.org/p/nativeclient/issues/detail?id=4395
306
+ // This includes arm-nacl-clang and clang in older Android NDK versions.
307
+ // To work around this, when we build with those we use the portable
308
+ // implementation instead.
309
+ #if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_USE_PORTABLE_LOG2)
310
+ return 63 ^ static_cast<uint32_t>(__builtin_clzll(n));
311
+ #elif defined(_MSC_VER) && defined(_M_X64)
312
+ unsigned long where;
313
+ _BitScanReverse64(&where, n);
314
+ return where;
315
+ #else
316
+ return Log2FloorNonZero64_Portable(n);
317
+ #endif
318
+ }
319
+ private:
320
+ static int Log2FloorNonZero_Portable(uint32_t n) {
321
+ if (n == 0)
322
+ return -1;
323
+ int log = 0;
324
+ uint32_t value = n;
325
+ for (int i = 4; i >= 0; --i) {
326
+ int shift = (1 << i);
327
+ uint32_t x = value >> shift;
328
+ if (x != 0) {
329
+ value = x;
330
+ log += shift;
331
+ }
332
+ }
333
+ assert(value == 1);
334
+ return log;
335
+ }
336
+
337
+ static int Log2FloorNonZero64_Portable(uint64_t n) {
338
+ const uint32_t topbits = static_cast<uint32_t>(n >> 32);
339
+ if (topbits == 0) {
340
+ // Top bits are zero, so scan in bottom bits
341
+ return static_cast<int>(Log2FloorNonZero(static_cast<uint32_t>(n)));
342
+ } else {
343
+ return 32 + static_cast<int>(Log2FloorNonZero(topbits));
344
+ }
345
+ }
346
+ };
347
+
348
+ // ===================================================================
349
+ // from google3/util/endian/endian.h
350
+ PROTOBUF_EXPORT uint32_t ghtonl(uint32_t x);
351
+
352
+ class BigEndian {
353
+ public:
354
+ #ifdef PROTOBUF_LITTLE_ENDIAN
355
+
356
+ static uint16_t FromHost16(uint16_t x) { return bswap_16(x); }
357
+ static uint16_t ToHost16(uint16_t x) { return bswap_16(x); }
358
+
359
+ static uint32_t FromHost32(uint32_t x) { return bswap_32(x); }
360
+ static uint32_t ToHost32(uint32_t x) { return bswap_32(x); }
361
+
362
+ static uint64_t FromHost64(uint64_t x) { return bswap_64(x); }
363
+ static uint64_t ToHost64(uint64_t x) { return bswap_64(x); }
364
+
365
+ static bool IsLittleEndian() { return true; }
366
+
367
+ #else
368
+
369
+ static uint16_t FromHost16(uint16_t x) { return x; }
370
+ static uint16_t ToHost16(uint16_t x) { return x; }
371
+
372
+ static uint32_t FromHost32(uint32_t x) { return x; }
373
+ static uint32_t ToHost32(uint32_t x) { return x; }
374
+
375
+ static uint64_t FromHost64(uint64_t x) { return x; }
376
+ static uint64_t ToHost64(uint64_t x) { return x; }
377
+
378
+ static bool IsLittleEndian() { return false; }
379
+
380
+ #endif /* ENDIAN */
381
+
382
+ // Functions to do unaligned loads and stores in big-endian order.
383
+ static uint16_t Load16(const void *p) {
384
+ return ToHost16(GOOGLE_UNALIGNED_LOAD16(p));
385
+ }
386
+
387
+ static void Store16(void *p, uint16_t v) {
388
+ GOOGLE_UNALIGNED_STORE16(p, FromHost16(v));
389
+ }
390
+
391
+ static uint32_t Load32(const void *p) {
392
+ return ToHost32(GOOGLE_UNALIGNED_LOAD32(p));
393
+ }
394
+
395
+ static void Store32(void *p, uint32_t v) {
396
+ GOOGLE_UNALIGNED_STORE32(p, FromHost32(v));
397
+ }
398
+
399
+ static uint64_t Load64(const void *p) {
400
+ return ToHost64(GOOGLE_UNALIGNED_LOAD64(p));
401
+ }
402
+
403
+ static void Store64(void *p, uint64_t v) {
404
+ GOOGLE_UNALIGNED_STORE64(p, FromHost64(v));
405
+ }
406
+ };
407
+
408
+ } // namespace protobuf
409
+ } // namespace google
410
+
411
+ #include <google/protobuf/port_undef.inc>
412
+
413
+ #endif // GOOGLE_PROTOBUF_STUBS_PORT_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/status.h ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_STUBS_STATUS_H_
32
+ #define GOOGLE_PROTOBUF_STUBS_STATUS_H_
33
+
34
+ #include <string>
35
+
36
+ #include <google/protobuf/stubs/stringpiece.h>
37
+
38
+ #include <google/protobuf/port_def.inc>
39
+
40
+ namespace google {
41
+ namespace protobuf {
42
+ namespace util {
43
+ namespace status_internal {
44
+
45
+ // These values must match error codes defined in google/rpc/code.proto.
46
+ enum class StatusCode : int {
47
+ kOk = 0,
48
+ kCancelled = 1,
49
+ kUnknown = 2,
50
+ kInvalidArgument = 3,
51
+ kDeadlineExceeded = 4,
52
+ kNotFound = 5,
53
+ kAlreadyExists = 6,
54
+ kPermissionDenied = 7,
55
+ kUnauthenticated = 16,
56
+ kResourceExhausted = 8,
57
+ kFailedPrecondition = 9,
58
+ kAborted = 10,
59
+ kOutOfRange = 11,
60
+ kUnimplemented = 12,
61
+ kInternal = 13,
62
+ kUnavailable = 14,
63
+ kDataLoss = 15,
64
+ };
65
+
66
+ class PROTOBUF_EXPORT Status {
67
+ public:
68
+ // Creates a "successful" status.
69
+ Status();
70
+
71
+ // Create a status in the canonical error space with the specified
72
+ // code, and error message. If "code == 0", error_message is
73
+ // ignored and a Status object identical to Status::kOk is
74
+ // constructed.
75
+ Status(StatusCode error_code, StringPiece error_message);
76
+ Status(const Status&);
77
+ Status& operator=(const Status& x);
78
+ ~Status() {}
79
+
80
+ // Accessor
81
+ bool ok() const { return error_code_ == StatusCode::kOk; }
82
+ StatusCode code() const { return error_code_; }
83
+ StringPiece message() const {
84
+ return error_message_;
85
+ }
86
+
87
+ bool operator==(const Status& x) const;
88
+ bool operator!=(const Status& x) const {
89
+ return !operator==(x);
90
+ }
91
+
92
+ // Return a combination of the error code name and message.
93
+ std::string ToString() const;
94
+
95
+ private:
96
+ StatusCode error_code_;
97
+ std::string error_message_;
98
+ };
99
+
100
+ // Returns an OK status, equivalent to a default constructed instance. Prefer
101
+ // usage of `OkStatus()` when constructing such an OK status.
102
+ PROTOBUF_EXPORT Status OkStatus();
103
+
104
+ // Prints a human-readable representation of 'x' to 'os'.
105
+ PROTOBUF_EXPORT std::ostream& operator<<(std::ostream& os, const Status& x);
106
+
107
+ // These convenience functions return `true` if a given status matches the
108
+ // `StatusCode` error code of its associated function.
109
+ PROTOBUF_EXPORT bool IsAborted(const Status& status);
110
+ PROTOBUF_EXPORT bool IsAlreadyExists(const Status& status);
111
+ PROTOBUF_EXPORT bool IsCancelled(const Status& status);
112
+ PROTOBUF_EXPORT bool IsDataLoss(const Status& status);
113
+ PROTOBUF_EXPORT bool IsDeadlineExceeded(const Status& status);
114
+ PROTOBUF_EXPORT bool IsFailedPrecondition(const Status& status);
115
+ PROTOBUF_EXPORT bool IsInternal(const Status& status);
116
+ PROTOBUF_EXPORT bool IsInvalidArgument(const Status& status);
117
+ PROTOBUF_EXPORT bool IsNotFound(const Status& status);
118
+ PROTOBUF_EXPORT bool IsOutOfRange(const Status& status);
119
+ PROTOBUF_EXPORT bool IsPermissionDenied(const Status& status);
120
+ PROTOBUF_EXPORT bool IsResourceExhausted(const Status& status);
121
+ PROTOBUF_EXPORT bool IsUnauthenticated(const Status& status);
122
+ PROTOBUF_EXPORT bool IsUnavailable(const Status& status);
123
+ PROTOBUF_EXPORT bool IsUnimplemented(const Status& status);
124
+ PROTOBUF_EXPORT bool IsUnknown(const Status& status);
125
+
126
+ // These convenience functions create an `Status` object with an error code as
127
+ // indicated by the associated function name, using the error message passed in
128
+ // `message`.
129
+ //
130
+ // These functions are intentionally named `*Error` rather than `*Status` to
131
+ // match the names from Abseil:
132
+ // https://github.com/abseil/abseil-cpp/blob/2e9532cc6c701a8323d0cffb468999ab804095ab/absl/status/status.h#L716
133
+ PROTOBUF_EXPORT Status AbortedError(StringPiece message);
134
+ PROTOBUF_EXPORT Status AlreadyExistsError(StringPiece message);
135
+ PROTOBUF_EXPORT Status CancelledError(StringPiece message);
136
+ PROTOBUF_EXPORT Status DataLossError(StringPiece message);
137
+ PROTOBUF_EXPORT Status DeadlineExceededError(StringPiece message);
138
+ PROTOBUF_EXPORT Status FailedPreconditionError(StringPiece message);
139
+ PROTOBUF_EXPORT Status InternalError(StringPiece message);
140
+ PROTOBUF_EXPORT Status InvalidArgumentError(StringPiece message);
141
+ PROTOBUF_EXPORT Status NotFoundError(StringPiece message);
142
+ PROTOBUF_EXPORT Status OutOfRangeError(StringPiece message);
143
+ PROTOBUF_EXPORT Status PermissionDeniedError(StringPiece message);
144
+ PROTOBUF_EXPORT Status ResourceExhaustedError(StringPiece message);
145
+ PROTOBUF_EXPORT Status UnauthenticatedError(StringPiece message);
146
+ PROTOBUF_EXPORT Status UnavailableError(StringPiece message);
147
+ PROTOBUF_EXPORT Status UnimplementedError(StringPiece message);
148
+ PROTOBUF_EXPORT Status UnknownError(StringPiece message);
149
+
150
+ } // namespace status_internal
151
+
152
+ using ::google::protobuf::util::status_internal::Status;
153
+ using ::google::protobuf::util::status_internal::StatusCode;
154
+
155
+ using ::google::protobuf::util::status_internal::IsAborted;
156
+ using ::google::protobuf::util::status_internal::IsAlreadyExists;
157
+ using ::google::protobuf::util::status_internal::IsCancelled;
158
+ using ::google::protobuf::util::status_internal::IsDataLoss;
159
+ using ::google::protobuf::util::status_internal::IsDeadlineExceeded;
160
+ using ::google::protobuf::util::status_internal::IsFailedPrecondition;
161
+ using ::google::protobuf::util::status_internal::IsInternal;
162
+ using ::google::protobuf::util::status_internal::IsInvalidArgument;
163
+ using ::google::protobuf::util::status_internal::IsNotFound;
164
+ using ::google::protobuf::util::status_internal::IsOutOfRange;
165
+ using ::google::protobuf::util::status_internal::IsPermissionDenied;
166
+ using ::google::protobuf::util::status_internal::IsResourceExhausted;
167
+ using ::google::protobuf::util::status_internal::IsUnauthenticated;
168
+ using ::google::protobuf::util::status_internal::IsUnavailable;
169
+ using ::google::protobuf::util::status_internal::IsUnimplemented;
170
+ using ::google::protobuf::util::status_internal::IsUnknown;
171
+
172
+ using ::google::protobuf::util::status_internal::AbortedError;
173
+ using ::google::protobuf::util::status_internal::AlreadyExistsError;
174
+ using ::google::protobuf::util::status_internal::CancelledError;
175
+ using ::google::protobuf::util::status_internal::DataLossError;
176
+ using ::google::protobuf::util::status_internal::DeadlineExceededError;
177
+ using ::google::protobuf::util::status_internal::FailedPreconditionError;
178
+ using ::google::protobuf::util::status_internal::InternalError;
179
+ using ::google::protobuf::util::status_internal::InvalidArgumentError;
180
+ using ::google::protobuf::util::status_internal::NotFoundError;
181
+ using ::google::protobuf::util::status_internal::OkStatus;
182
+ using ::google::protobuf::util::status_internal::OutOfRangeError;
183
+ using ::google::protobuf::util::status_internal::PermissionDeniedError;
184
+ using ::google::protobuf::util::status_internal::ResourceExhaustedError;
185
+ using ::google::protobuf::util::status_internal::UnauthenticatedError;
186
+ using ::google::protobuf::util::status_internal::UnavailableError;
187
+ using ::google::protobuf::util::status_internal::UnimplementedError;
188
+ using ::google::protobuf::util::status_internal::UnknownError;
189
+
190
+ } // namespace util
191
+ } // namespace protobuf
192
+ } // namespace google
193
+
194
+ #include <google/protobuf/port_undef.inc>
195
+
196
+ #endif // GOOGLE_PROTOBUF_STUBS_STATUS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/status_macros.h ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // From: util/task/contrib/status_macros/status_macros.h
32
+
33
+ #ifndef GOOGLE_PROTOBUF_STUBS_STATUS_MACROS_H_
34
+ #define GOOGLE_PROTOBUF_STUBS_STATUS_MACROS_H_
35
+
36
+ #include <google/protobuf/stubs/common.h>
37
+ #include <google/protobuf/stubs/status.h>
38
+ #include <google/protobuf/stubs/statusor.h>
39
+
40
+ namespace google {
41
+ namespace protobuf {
42
+ namespace util {
43
+
44
+ // Run a command that returns a util::Status. If the called code returns an
45
+ // error status, return that status up out of this method too.
46
+ //
47
+ // Example:
48
+ // RETURN_IF_ERROR(DoThings(4));
49
+ #define RETURN_IF_ERROR(expr) \
50
+ do { \
51
+ /* Using _status below to avoid capture problems if expr is "status". */ \
52
+ const PROTOBUF_NAMESPACE_ID::util::Status _status = (expr); \
53
+ if (PROTOBUF_PREDICT_FALSE(!_status.ok())) return _status; \
54
+ } while (0)
55
+
56
+ // Internal helper for concatenating macro values.
57
+ #define STATUS_MACROS_CONCAT_NAME_INNER(x, y) x##y
58
+ #define STATUS_MACROS_CONCAT_NAME(x, y) STATUS_MACROS_CONCAT_NAME_INNER(x, y)
59
+
60
+ template<typename T>
61
+ Status DoAssignOrReturn(T& lhs, StatusOr<T> result) {
62
+ if (result.ok()) {
63
+ lhs = result.value();
64
+ }
65
+ return result.status();
66
+ }
67
+
68
+ #define ASSIGN_OR_RETURN_IMPL(status, lhs, rexpr) \
69
+ Status status = DoAssignOrReturn(lhs, (rexpr)); \
70
+ if (PROTOBUF_PREDICT_FALSE(!status.ok())) return status;
71
+
72
+ // Executes an expression that returns a util::StatusOr, extracting its value
73
+ // into the variable defined by lhs (or returning on error).
74
+ //
75
+ // Example: Assigning to an existing value
76
+ // ValueType value;
77
+ // ASSIGN_OR_RETURN(value, MaybeGetValue(arg));
78
+ //
79
+ // WARNING: ASSIGN_OR_RETURN expands into multiple statements; it cannot be used
80
+ // in a single statement (e.g. as the body of an if statement without {})!
81
+ #define ASSIGN_OR_RETURN(lhs, rexpr) \
82
+ ASSIGN_OR_RETURN_IMPL( \
83
+ STATUS_MACROS_CONCAT_NAME(_status_or_value, __COUNTER__), lhs, rexpr);
84
+
85
+ } // namespace util
86
+ } // namespace protobuf
87
+ } // namespace google
88
+
89
+ #endif // GOOGLE_PROTOBUF_STUBS_STATUS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/statusor.h ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // StatusOr<T> is the union of a Status object and a T
32
+ // object. StatusOr models the concept of an object that is either a
33
+ // usable value, or an error Status explaining why such a value is
34
+ // not present. To this end, StatusOr<T> does not allow its Status
35
+ // value to be OkStatus(). Further, StatusOr<T*> does not allow the
36
+ // contained pointer to be nullptr.
37
+ //
38
+ // The primary use-case for StatusOr<T> is as the return value of a
39
+ // function which may fail.
40
+ //
41
+ // Example client usage for a StatusOr<T>, where T is not a pointer:
42
+ //
43
+ // StatusOr<float> result = DoBigCalculationThatCouldFail();
44
+ // if (result.ok()) {
45
+ // float answer = result.value();
46
+ // printf("Big calculation yielded: %f", answer);
47
+ // } else {
48
+ // LOG(ERROR) << result.status();
49
+ // }
50
+ //
51
+ // Example client usage for a StatusOr<T*>:
52
+ //
53
+ // StatusOr<Foo*> result = FooFactory::MakeNewFoo(arg);
54
+ // if (result.ok()) {
55
+ // std::unique_ptr<Foo> foo(result.value());
56
+ // foo->DoSomethingCool();
57
+ // } else {
58
+ // LOG(ERROR) << result.status();
59
+ // }
60
+ //
61
+ // Example factory implementation returning StatusOr<T*>:
62
+ //
63
+ // StatusOr<Foo*> FooFactory::MakeNewFoo(int arg) {
64
+ // if (arg <= 0) {
65
+ // return InvalidArgumentError("Arg must be positive");
66
+ // } else {
67
+ // return new Foo(arg);
68
+ // }
69
+ // }
70
+ //
71
+
72
+ #ifndef GOOGLE_PROTOBUF_STUBS_STATUSOR_H_
73
+ #define GOOGLE_PROTOBUF_STUBS_STATUSOR_H_
74
+
75
+ #include <new>
76
+ #include <string>
77
+ #include <utility>
78
+
79
+ #include <google/protobuf/stubs/status.h>
80
+
81
+ #include <google/protobuf/port_def.inc>
82
+
83
+ namespace google {
84
+ namespace protobuf {
85
+ namespace util {
86
+ namespace statusor_internal {
87
+
88
+ template<typename T>
89
+ class StatusOr {
90
+ template<typename U> friend class StatusOr;
91
+
92
+ public:
93
+ using value_type = T;
94
+
95
+ // Construct a new StatusOr with Status::UNKNOWN status.
96
+ // Construct a new StatusOr with UnknownError() status.
97
+ explicit StatusOr();
98
+
99
+ // Construct a new StatusOr with the given non-ok status. After calling
100
+ // this constructor, calls to value() will CHECK-fail.
101
+ //
102
+ // NOTE: Not explicit - we want to use StatusOr<T> as a return
103
+ // value, so it is convenient and sensible to be able to do 'return
104
+ // Status()' when the return type is StatusOr<T>.
105
+ //
106
+ // REQUIRES: status != OkStatus(). This requirement is DCHECKed.
107
+ // In optimized builds, passing OkStatus() here will have the effect
108
+ // of passing PosixErrorSpace::EINVAL as a fallback.
109
+ StatusOr(const Status& status); // NOLINT
110
+
111
+ // Construct a new StatusOr with the given value. If T is a plain pointer,
112
+ // value must not be nullptr. After calling this constructor, calls to
113
+ // value() will succeed, and calls to status() will return OK.
114
+ //
115
+ // NOTE: Not explicit - we want to use StatusOr<T> as a return type
116
+ // so it is convenient and sensible to be able to do 'return T()'
117
+ // when when the return type is StatusOr<T>.
118
+ //
119
+ // REQUIRES: if T is a plain pointer, value != nullptr. This requirement is
120
+ // DCHECKed. In optimized builds, passing a null pointer here will have
121
+ // the effect of passing PosixErrorSpace::EINVAL as a fallback.
122
+ StatusOr(const T& value); // NOLINT
123
+
124
+ // Copy constructor.
125
+ StatusOr(const StatusOr& other);
126
+
127
+ // Conversion copy constructor, T must be copy constructible from U
128
+ template<typename U>
129
+ StatusOr(const StatusOr<U>& other);
130
+
131
+ // Assignment operator.
132
+ StatusOr& operator=(const StatusOr& other);
133
+
134
+ // Conversion assignment operator, T must be assignable from U
135
+ template<typename U>
136
+ StatusOr& operator=(const StatusOr<U>& other);
137
+
138
+ // Returns a reference to our status. If this contains a T, then
139
+ // returns OkStatus().
140
+ const Status& status() const;
141
+
142
+ // Returns this->status().ok()
143
+ bool ok() const;
144
+
145
+ // Returns a reference to our current value, or CHECK-fails if !this->ok().
146
+ const T& value () const;
147
+
148
+ private:
149
+ Status status_;
150
+ T value_;
151
+ };
152
+
153
+ ////////////////////////////////////////////////////////////////////////////////
154
+ // Implementation details for StatusOr<T>
155
+
156
+ class PROTOBUF_EXPORT StatusOrHelper {
157
+ public:
158
+ // Move type-agnostic error handling to the .cc.
159
+ static void Crash(const util::Status& status);
160
+
161
+ // Customized behavior for StatusOr<T> vs. StatusOr<T*>
162
+ template<typename T>
163
+ struct Specialize;
164
+ };
165
+
166
+ template<typename T>
167
+ struct StatusOrHelper::Specialize {
168
+ // For non-pointer T, a reference can never be nullptr.
169
+ static inline bool IsValueNull(const T& /*t*/) { return false; }
170
+ };
171
+
172
+ template<typename T>
173
+ struct StatusOrHelper::Specialize<T*> {
174
+ static inline bool IsValueNull(const T* t) { return t == nullptr; }
175
+ };
176
+
177
+ template <typename T>
178
+ inline StatusOr<T>::StatusOr() : status_(util::UnknownError("")) {}
179
+
180
+ template<typename T>
181
+ inline StatusOr<T>::StatusOr(const Status& status) {
182
+ if (status.ok()) {
183
+ status_ = util::InternalError("OkStatus() is not a valid argument.");
184
+ } else {
185
+ status_ = status;
186
+ }
187
+ }
188
+
189
+ template<typename T>
190
+ inline StatusOr<T>::StatusOr(const T& value) {
191
+ if (StatusOrHelper::Specialize<T>::IsValueNull(value)) {
192
+ status_ = util::InternalError("nullptr is not a valid argument.");
193
+ } else {
194
+ status_ = util::OkStatus();
195
+ value_ = value;
196
+ }
197
+ }
198
+
199
+ template<typename T>
200
+ inline StatusOr<T>::StatusOr(const StatusOr<T>& other)
201
+ : status_(other.status_), value_(other.value_) {
202
+ }
203
+
204
+ template<typename T>
205
+ inline StatusOr<T>& StatusOr<T>::operator=(const StatusOr<T>& other) {
206
+ status_ = other.status_;
207
+ value_ = other.value_;
208
+ return *this;
209
+ }
210
+
211
+ template<typename T>
212
+ template<typename U>
213
+ inline StatusOr<T>::StatusOr(const StatusOr<U>& other)
214
+ : status_(other.status_), value_(other.status_.ok() ? other.value_ : T()) {
215
+ }
216
+
217
+ template<typename T>
218
+ template<typename U>
219
+ inline StatusOr<T>& StatusOr<T>::operator=(const StatusOr<U>& other) {
220
+ status_ = other.status_;
221
+ if (status_.ok()) value_ = other.value_;
222
+ return *this;
223
+ }
224
+
225
+ template<typename T>
226
+ inline const Status& StatusOr<T>::status() const {
227
+ return status_;
228
+ }
229
+
230
+ template<typename T>
231
+ inline bool StatusOr<T>::ok() const {
232
+ return status().ok();
233
+ }
234
+
235
+ template<typename T>
236
+ inline const T& StatusOr<T>::value() const {
237
+ if (!status_.ok()) {
238
+ StatusOrHelper::Crash(status_);
239
+ }
240
+ return value_;
241
+ }
242
+
243
+ } // namespace statusor_internal
244
+
245
+ using ::google::protobuf::util::statusor_internal::StatusOr;
246
+
247
+ } // namespace util
248
+ } // namespace protobuf
249
+ } // namespace google
250
+
251
+ #include <google/protobuf/port_undef.inc>
252
+
253
+ #endif // GOOGLE_PROTOBUF_STUBS_STATUSOR_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stl_util.h ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // from google3/util/gtl/stl_util.h
32
+
33
+ #ifndef GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__
34
+ #define GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__
35
+
36
+ #include <google/protobuf/stubs/common.h>
37
+
38
+ #include <algorithm>
39
+
40
+ // Must be last.
41
+ #include <google/protobuf/port_def.inc> // NOLINT
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+
46
+ // Inside Google, this function implements a horrible, disgusting hack in which
47
+ // we reach into the string's private implementation and resize it without
48
+ // initializing the new bytes. In some cases doing this can significantly
49
+ // improve performance. However, since it's totally non-portable it has no
50
+ // place in open source code. Feel free to fill this function in with your
51
+ // own disgusting hack if you want the perf boost.
52
+ inline void STLStringResizeUninitialized(std::string* s, size_t new_size) {
53
+ s->resize(new_size);
54
+ }
55
+
56
+ // As above, but we make sure to follow amortized growth in which we always
57
+ // increase the capacity by at least a constant factor >1.
58
+ inline void STLStringResizeUninitializedAmortized(std::string* s,
59
+ size_t new_size) {
60
+ const size_t cap = s->capacity();
61
+ if (new_size > cap) {
62
+ // Make sure to always grow by at least a factor of 2x.
63
+ s->reserve(std::max<size_t>(new_size, 2 * cap));
64
+ }
65
+ STLStringResizeUninitialized(s, new_size);
66
+ }
67
+
68
+ // Return a mutable char* pointing to a string's internal buffer,
69
+ // which may not be null-terminated. Writing through this pointer will
70
+ // modify the string.
71
+ //
72
+ // string_as_array(&str)[i] is valid for 0 <= i < str.size() until the
73
+ // next call to a string method that invalidates iterators.
74
+ //
75
+ // As of 2006-04, there is no standard-blessed way of getting a
76
+ // mutable reference to a string's internal buffer. However, issue 530
77
+ // (http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#530)
78
+ // proposes this as the method. According to Matt Austern, this should
79
+ // already work on all current implementations.
80
+ inline char* string_as_array(std::string* str) {
81
+ // DO NOT USE const_cast<char*>(str->data())! See the unittest for why.
82
+ return str->empty() ? nullptr : &*str->begin();
83
+ }
84
+
85
+ } // namespace protobuf
86
+ } // namespace google
87
+
88
+ #include <google/protobuf/port_undef.inc> // NOLINT
89
+
90
+ #endif // GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stringpiece.h ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // A StringPiece points to part or all of a string, Cord, double-quoted string
32
+ // literal, or other string-like object. A StringPiece does *not* own the
33
+ // string to which it points. A StringPiece is not null-terminated.
34
+ //
35
+ // You can use StringPiece as a function or method parameter. A StringPiece
36
+ // parameter can receive a double-quoted string literal argument, a "const
37
+ // char*" argument, a string argument, or a StringPiece argument with no data
38
+ // copying. Systematic use of StringPiece for arguments reduces data
39
+ // copies and strlen() calls.
40
+ //
41
+ // Prefer passing StringPieces by value:
42
+ // void MyFunction(StringPiece arg);
43
+ // If circumstances require, you may also pass by const reference:
44
+ // void MyFunction(const StringPiece& arg); // not preferred
45
+ // Both of these have the same lifetime semantics. Passing by value
46
+ // generates slightly smaller code. For more discussion, see the thread
47
+ // go/stringpiecebyvalue on c-users.
48
+ //
49
+ // StringPiece is also suitable for local variables if you know that
50
+ // the lifetime of the underlying object is longer than the lifetime
51
+ // of your StringPiece variable.
52
+ //
53
+ // Beware of binding a StringPiece to a temporary:
54
+ // StringPiece sp = obj.MethodReturningString(); // BAD: lifetime problem
55
+ //
56
+ // This code is okay:
57
+ // string str = obj.MethodReturningString(); // str owns its contents
58
+ // StringPiece sp(str); // GOOD, because str outlives sp
59
+ //
60
+ // StringPiece is sometimes a poor choice for a return value and usually a poor
61
+ // choice for a data member. If you do use a StringPiece this way, it is your
62
+ // responsibility to ensure that the object pointed to by the StringPiece
63
+ // outlives the StringPiece.
64
+ //
65
+ // A StringPiece may represent just part of a string; thus the name "Piece".
66
+ // For example, when splitting a string, vector<StringPiece> is a natural data
67
+ // type for the output. For another example, a Cord is a non-contiguous,
68
+ // potentially very long string-like object. The Cord class has an interface
69
+ // that iteratively provides StringPiece objects that point to the
70
+ // successive pieces of a Cord object.
71
+ //
72
+ // A StringPiece is not null-terminated. If you write code that scans a
73
+ // StringPiece, you must check its length before reading any characters.
74
+ // Common idioms that work on null-terminated strings do not work on
75
+ // StringPiece objects.
76
+ //
77
+ // There are several ways to create a null StringPiece:
78
+ // StringPiece()
79
+ // StringPiece(nullptr)
80
+ // StringPiece(nullptr, 0)
81
+ // For all of the above, sp.data() == nullptr, sp.length() == 0,
82
+ // and sp.empty() == true. Also, if you create a StringPiece with
83
+ // a non-null pointer then sp.data() != nullptr. Once created,
84
+ // sp.data() will stay either nullptr or not-nullptr, except if you call
85
+ // sp.clear() or sp.set().
86
+ //
87
+ // Thus, you can use StringPiece(nullptr) to signal an out-of-band value
88
+ // that is different from other StringPiece values. This is similar
89
+ // to the way that const char* p1 = nullptr; is different from
90
+ // const char* p2 = "";.
91
+ //
92
+ // There are many ways to create an empty StringPiece:
93
+ // StringPiece()
94
+ // StringPiece(nullptr)
95
+ // StringPiece(nullptr, 0)
96
+ // StringPiece("")
97
+ // StringPiece("", 0)
98
+ // StringPiece("abcdef", 0)
99
+ // StringPiece("abcdef"+6, 0)
100
+ // For all of the above, sp.length() will be 0 and sp.empty() will be true.
101
+ // For some empty StringPiece values, sp.data() will be nullptr.
102
+ // For some empty StringPiece values, sp.data() will not be nullptr.
103
+ //
104
+ // Be careful not to confuse: null StringPiece and empty StringPiece.
105
+ // The set of empty StringPieces properly includes the set of null StringPieces.
106
+ // That is, every null StringPiece is an empty StringPiece,
107
+ // but some non-null StringPieces are empty Stringpieces too.
108
+ //
109
+ // All empty StringPiece values compare equal to each other.
110
+ // Even a null StringPieces compares equal to a non-null empty StringPiece:
111
+ // StringPiece() == StringPiece("", 0)
112
+ // StringPiece(nullptr) == StringPiece("abc", 0)
113
+ // StringPiece(nullptr, 0) == StringPiece("abcdef"+6, 0)
114
+ //
115
+ // Look carefully at this example:
116
+ // StringPiece("") == nullptr
117
+ // True or false? TRUE, because StringPiece::operator== converts
118
+ // the right-hand side from nullptr to StringPiece(nullptr),
119
+ // and then compares two zero-length spans of characters.
120
+ // However, we are working to make this example produce a compile error.
121
+ //
122
+ // Suppose you want to write:
123
+ // bool TestWhat?(StringPiece sp) { return sp == nullptr; } // BAD
124
+ // Do not do that. Write one of these instead:
125
+ // bool TestNull(StringPiece sp) { return sp.data() == nullptr; }
126
+ // bool TestEmpty(StringPiece sp) { return sp.empty(); }
127
+ // The intent of TestWhat? is unclear. Did you mean TestNull or TestEmpty?
128
+ // Right now, TestWhat? behaves likes TestEmpty.
129
+ // We are working to make TestWhat? produce a compile error.
130
+ // TestNull is good to test for an out-of-band signal.
131
+ // TestEmpty is good to test for an empty StringPiece.
132
+ //
133
+ // Caveats (again):
134
+ // (1) The lifetime of the pointed-to string (or piece of a string)
135
+ // must be longer than the lifetime of the StringPiece.
136
+ // (2) There may or may not be a '\0' character after the end of
137
+ // StringPiece data.
138
+ // (3) A null StringPiece is empty.
139
+ // An empty StringPiece may or may not be a null StringPiece.
140
+
141
+ #ifndef GOOGLE_PROTOBUF_STUBS_STRINGPIECE_H_
142
+ #define GOOGLE_PROTOBUF_STUBS_STRINGPIECE_H_
143
+
144
+ #include <assert.h>
145
+ #include <stddef.h>
146
+ #include <string.h>
147
+ #include <iosfwd>
148
+ #include <limits>
149
+ #include <string>
150
+
151
+ #if defined(__cpp_lib_string_view)
152
+ #include <string_view>
153
+ #endif
154
+
155
+ #include <google/protobuf/stubs/hash.h>
156
+
157
+ #include <google/protobuf/port_def.inc>
158
+
159
+ namespace google {
160
+ namespace protobuf {
161
+ namespace stringpiece_internal {
162
+
163
+ class PROTOBUF_EXPORT StringPiece {
164
+ public:
165
+ using traits_type = std::char_traits<char>;
166
+ using value_type = char;
167
+ using pointer = char*;
168
+ using const_pointer = const char*;
169
+ using reference = char&;
170
+ using const_reference = const char&;
171
+ using const_iterator = const char*;
172
+ using iterator = const_iterator;
173
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
174
+ using reverse_iterator = const_reverse_iterator;
175
+ using size_type = size_t;
176
+ using difference_type = std::ptrdiff_t;
177
+
178
+ private:
179
+ const char* ptr_;
180
+ size_type length_;
181
+
182
+ static constexpr size_type kMaxSize =
183
+ (std::numeric_limits<difference_type>::max)();
184
+
185
+ static size_type CheckSize(size_type size) {
186
+ #if !defined(NDEBUG) || defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
187
+ if (PROTOBUF_PREDICT_FALSE(size > kMaxSize)) {
188
+ // Some people grep for this message in logs
189
+ // so take care if you ever change it.
190
+ LogFatalSizeTooBig(size, "string length exceeds max size");
191
+ }
192
+ #endif
193
+ return size;
194
+ }
195
+
196
+ // Out-of-line error path.
197
+ static void LogFatalSizeTooBig(size_type size, const char* details);
198
+
199
+ public:
200
+ // We provide non-explicit singleton constructors so users can pass
201
+ // in a "const char*" or a "string" wherever a "StringPiece" is
202
+ // expected.
203
+ //
204
+ // Style guide exception granted:
205
+ // http://goto/style-guide-exception-20978288
206
+ StringPiece() : ptr_(nullptr), length_(0) {}
207
+
208
+ StringPiece(const char* str) // NOLINT(runtime/explicit)
209
+ : ptr_(str), length_(0) {
210
+ if (str != nullptr) {
211
+ length_ = CheckSize(strlen(str));
212
+ }
213
+ }
214
+
215
+ template <class Allocator>
216
+ StringPiece( // NOLINT(runtime/explicit)
217
+ const std::basic_string<char, std::char_traits<char>, Allocator>& str)
218
+ : ptr_(str.data()), length_(0) {
219
+ length_ = CheckSize(str.size());
220
+ }
221
+
222
+ #if defined(__cpp_lib_string_view)
223
+ StringPiece( // NOLINT(runtime/explicit)
224
+ std::string_view str)
225
+ : ptr_(str.data()), length_(0) {
226
+ length_ = CheckSize(str.size());
227
+ }
228
+ #endif
229
+
230
+ StringPiece(const char* offset, size_type len)
231
+ : ptr_(offset), length_(CheckSize(len)) {}
232
+
233
+ // data() may return a pointer to a buffer with embedded NULs, and the
234
+ // returned buffer may or may not be null terminated. Therefore it is
235
+ // typically a mistake to pass data() to a routine that expects a NUL
236
+ // terminated string.
237
+ const_pointer data() const { return ptr_; }
238
+ size_type size() const { return length_; }
239
+ size_type length() const { return length_; }
240
+ bool empty() const { return length_ == 0; }
241
+
242
+ char operator[](size_type i) const {
243
+ assert(i < length_);
244
+ return ptr_[i];
245
+ }
246
+
247
+ void remove_prefix(size_type n) {
248
+ assert(length_ >= n);
249
+ ptr_ += n;
250
+ length_ -= n;
251
+ }
252
+
253
+ void remove_suffix(size_type n) {
254
+ assert(length_ >= n);
255
+ length_ -= n;
256
+ }
257
+
258
+ // returns {-1, 0, 1}
259
+ int compare(StringPiece x) const {
260
+ size_type min_size = length_ < x.length_ ? length_ : x.length_;
261
+ int r = memcmp(ptr_, x.ptr_, static_cast<size_t>(min_size));
262
+ if (r < 0) return -1;
263
+ if (r > 0) return 1;
264
+ if (length_ < x.length_) return -1;
265
+ if (length_ > x.length_) return 1;
266
+ return 0;
267
+ }
268
+
269
+ std::string as_string() const { return ToString(); }
270
+ // We also define ToString() here, since many other string-like
271
+ // interfaces name the routine that converts to a C++ string
272
+ // "ToString", and it's confusing to have the method that does that
273
+ // for a StringPiece be called "as_string()". We also leave the
274
+ // "as_string()" method defined here for existing code.
275
+ std::string ToString() const {
276
+ if (ptr_ == nullptr) return "";
277
+ return std::string(data(), static_cast<size_type>(size()));
278
+ }
279
+
280
+ explicit operator std::string() const { return ToString(); }
281
+
282
+ void CopyToString(std::string* target) const;
283
+ void AppendToString(std::string* target) const;
284
+
285
+ bool starts_with(StringPiece x) const {
286
+ return (length_ >= x.length_) &&
287
+ (memcmp(ptr_, x.ptr_, static_cast<size_t>(x.length_)) == 0);
288
+ }
289
+
290
+ bool ends_with(StringPiece x) const {
291
+ return ((length_ >= x.length_) &&
292
+ (memcmp(ptr_ + (length_-x.length_), x.ptr_,
293
+ static_cast<size_t>(x.length_)) == 0));
294
+ }
295
+
296
+ // Checks whether StringPiece starts with x and if so advances the beginning
297
+ // of it to past the match. It's basically a shortcut for starts_with
298
+ // followed by remove_prefix.
299
+ bool Consume(StringPiece x);
300
+ // Like above but for the end of the string.
301
+ bool ConsumeFromEnd(StringPiece x);
302
+
303
+ // standard STL container boilerplate
304
+ static const size_type npos;
305
+ const_iterator begin() const { return ptr_; }
306
+ const_iterator end() const { return ptr_ + length_; }
307
+ const_reverse_iterator rbegin() const {
308
+ return const_reverse_iterator(ptr_ + length_);
309
+ }
310
+ const_reverse_iterator rend() const {
311
+ return const_reverse_iterator(ptr_);
312
+ }
313
+ size_type max_size() const { return length_; }
314
+ size_type capacity() const { return length_; }
315
+
316
+ // cpplint.py emits a false positive [build/include_what_you_use]
317
+ size_type copy(char* buf, size_type n, size_type pos = 0) const; // NOLINT
318
+
319
+ bool contains(StringPiece s) const;
320
+
321
+ size_type find(StringPiece s, size_type pos = 0) const;
322
+ size_type find(char c, size_type pos = 0) const;
323
+ size_type rfind(StringPiece s, size_type pos = npos) const;
324
+ size_type rfind(char c, size_type pos = npos) const;
325
+
326
+ size_type find_first_of(StringPiece s, size_type pos = 0) const;
327
+ size_type find_first_of(char c, size_type pos = 0) const {
328
+ return find(c, pos);
329
+ }
330
+ size_type find_first_not_of(StringPiece s, size_type pos = 0) const;
331
+ size_type find_first_not_of(char c, size_type pos = 0) const;
332
+ size_type find_last_of(StringPiece s, size_type pos = npos) const;
333
+ size_type find_last_of(char c, size_type pos = npos) const {
334
+ return rfind(c, pos);
335
+ }
336
+ size_type find_last_not_of(StringPiece s, size_type pos = npos) const;
337
+ size_type find_last_not_of(char c, size_type pos = npos) const;
338
+
339
+ StringPiece substr(size_type pos, size_type n = npos) const;
340
+ };
341
+
342
+ // This large function is defined inline so that in a fairly common case where
343
+ // one of the arguments is a literal, the compiler can elide a lot of the
344
+ // following comparisons.
345
+ inline bool operator==(StringPiece x, StringPiece y) {
346
+ StringPiece::size_type len = x.size();
347
+ if (len != y.size()) {
348
+ return false;
349
+ }
350
+
351
+ return x.data() == y.data() || len <= 0 ||
352
+ memcmp(x.data(), y.data(), static_cast<size_t>(len)) == 0;
353
+ }
354
+
355
+ inline bool operator!=(StringPiece x, StringPiece y) {
356
+ return !(x == y);
357
+ }
358
+
359
+ inline bool operator<(StringPiece x, StringPiece y) {
360
+ const StringPiece::size_type min_size =
361
+ x.size() < y.size() ? x.size() : y.size();
362
+ const int r = memcmp(x.data(), y.data(), static_cast<size_t>(min_size));
363
+ return (r < 0) || (r == 0 && x.size() < y.size());
364
+ }
365
+
366
+ inline bool operator>(StringPiece x, StringPiece y) {
367
+ return y < x;
368
+ }
369
+
370
+ inline bool operator<=(StringPiece x, StringPiece y) {
371
+ return !(x > y);
372
+ }
373
+
374
+ inline bool operator>=(StringPiece x, StringPiece y) {
375
+ return !(x < y);
376
+ }
377
+
378
+ // allow StringPiece to be logged
379
+ extern std::ostream& operator<<(std::ostream& o, StringPiece piece);
380
+
381
+ } // namespace stringpiece_internal
382
+
383
+ using ::google::protobuf::stringpiece_internal::StringPiece;
384
+
385
+ } // namespace protobuf
386
+ } // namespace google
387
+
388
+ GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START
389
+ template<> struct hash<StringPiece> {
390
+ size_t operator()(const StringPiece& s) const {
391
+ size_t result = 0;
392
+ for (const char *str = s.data(), *end = str + s.size(); str < end; str++) {
393
+ result = 5 * result + static_cast<size_t>(*str);
394
+ }
395
+ return result;
396
+ }
397
+ };
398
+ GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
399
+
400
+ #include <google/protobuf/port_undef.inc>
401
+
402
+ #endif // STRINGS_STRINGPIECE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/stringprintf.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2012 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // from google3/base/stringprintf.h
32
+ //
33
+ // Printf variants that place their output in a C++ string.
34
+ //
35
+ // Usage:
36
+ // string result = StringPrintf("%d %s\n", 10, "hello");
37
+ // SStringPrintf(&result, "%d %s\n", 10, "hello");
38
+ // StringAppendF(&result, "%d %s\n", 20, "there");
39
+
40
+ #ifndef GOOGLE_PROTOBUF_STUBS_STRINGPRINTF_H
41
+ #define GOOGLE_PROTOBUF_STUBS_STRINGPRINTF_H
42
+
43
+ #include <stdarg.h>
44
+ #include <string>
45
+ #include <vector>
46
+
47
+ #include <google/protobuf/stubs/common.h>
48
+
49
+ #include <google/protobuf/port_def.inc>
50
+
51
+ namespace google {
52
+ namespace protobuf {
53
+
54
+ // Return a C++ string
55
+ PROTOBUF_EXPORT extern std::string StringPrintf(const char* format, ...);
56
+
57
+ // Store result into a supplied string and return it
58
+ PROTOBUF_EXPORT extern const std::string& SStringPrintf(std::string* dst,
59
+ const char* format,
60
+ ...);
61
+
62
+ // Append result to a supplied string
63
+ PROTOBUF_EXPORT extern void StringAppendF(std::string* dst, const char* format,
64
+ ...);
65
+
66
+ // Lower-level routine that takes a va_list and appends to a specified
67
+ // string. All other routines are just convenience wrappers around it.
68
+ PROTOBUF_EXPORT extern void StringAppendV(std::string* dst, const char* format,
69
+ va_list ap);
70
+
71
+ // The max arguments supported by StringPrintfVector
72
+ PROTOBUF_EXPORT extern const int kStringPrintfVectorMaxArgs;
73
+
74
+ // You can use this version when all your arguments are strings, but
75
+ // you don't know how many arguments you'll have at compile time.
76
+ // StringPrintfVector will LOG(FATAL) if v.size() > kStringPrintfVectorMaxArgs
77
+ PROTOBUF_EXPORT extern std::string StringPrintfVector(
78
+ const char* format, const std::vector<std::string>& v);
79
+
80
+ } // namespace protobuf
81
+ } // namespace google
82
+
83
+ #include <google/protobuf/port_undef.inc>
84
+
85
+ #endif // GOOGLE_PROTOBUF_STUBS_STRINGPRINTF_H
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/strutil.h ADDED
@@ -0,0 +1,950 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // from google3/strings/strutil.h
32
+
33
+ #ifndef GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
34
+ #define GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
35
+
36
+ #include <google/protobuf/stubs/common.h>
37
+ #include <google/protobuf/stubs/stringpiece.h>
38
+ #include <stdlib.h>
39
+
40
+ #include <cstring>
41
+ #include <google/protobuf/port_def.inc>
42
+ #include <vector>
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+
47
+ #if defined(_MSC_VER) && _MSC_VER < 1800
48
+ #define strtoll _strtoi64
49
+ #define strtoull _strtoui64
50
+ #elif defined(__DECCXX) && defined(__osf__)
51
+ // HP C++ on Tru64 does not have strtoll, but strtol is already 64-bit.
52
+ #define strtoll strtol
53
+ #define strtoull strtoul
54
+ #endif
55
+
56
+ // ----------------------------------------------------------------------
57
+ // ascii_isalnum()
58
+ // Check if an ASCII character is alphanumeric. We can't use ctype's
59
+ // isalnum() because it is affected by locale. This function is applied
60
+ // to identifiers in the protocol buffer language, not to natural-language
61
+ // strings, so locale should not be taken into account.
62
+ // ascii_isdigit()
63
+ // Like above, but only accepts digits.
64
+ // ascii_isspace()
65
+ // Check if the character is a space character.
66
+ // ----------------------------------------------------------------------
67
+
68
+ inline bool ascii_isalnum(char c) {
69
+ return ('a' <= c && c <= 'z') ||
70
+ ('A' <= c && c <= 'Z') ||
71
+ ('0' <= c && c <= '9');
72
+ }
73
+
74
+ inline bool ascii_isdigit(char c) {
75
+ return ('0' <= c && c <= '9');
76
+ }
77
+
78
+ inline bool ascii_isspace(char c) {
79
+ return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' ||
80
+ c == '\r';
81
+ }
82
+
83
+ inline bool ascii_isupper(char c) {
84
+ return c >= 'A' && c <= 'Z';
85
+ }
86
+
87
+ inline bool ascii_islower(char c) {
88
+ return c >= 'a' && c <= 'z';
89
+ }
90
+
91
+ inline char ascii_toupper(char c) {
92
+ return ascii_islower(c) ? c - ('a' - 'A') : c;
93
+ }
94
+
95
+ inline char ascii_tolower(char c) {
96
+ return ascii_isupper(c) ? c + ('a' - 'A') : c;
97
+ }
98
+
99
+ inline int hex_digit_to_int(char c) {
100
+ /* Assume ASCII. */
101
+ int x = static_cast<unsigned char>(c);
102
+ if (x > '9') {
103
+ x += 9;
104
+ }
105
+ return x & 0xf;
106
+ }
107
+
108
+ // ----------------------------------------------------------------------
109
+ // HasPrefixString()
110
+ // Check if a string begins with a given prefix.
111
+ // StripPrefixString()
112
+ // Given a string and a putative prefix, returns the string minus the
113
+ // prefix string if the prefix matches, otherwise the original
114
+ // string.
115
+ // ----------------------------------------------------------------------
116
+ inline bool HasPrefixString(StringPiece str, StringPiece prefix) {
117
+ return str.size() >= prefix.size() &&
118
+ memcmp(str.data(), prefix.data(), prefix.size()) == 0;
119
+ }
120
+
121
+ inline std::string StripPrefixString(const std::string& str,
122
+ const std::string& prefix) {
123
+ if (HasPrefixString(str, prefix)) {
124
+ return str.substr(prefix.size());
125
+ } else {
126
+ return str;
127
+ }
128
+ }
129
+
130
+ // ----------------------------------------------------------------------
131
+ // HasSuffixString()
132
+ // Return true if str ends in suffix.
133
+ // StripSuffixString()
134
+ // Given a string and a putative suffix, returns the string minus the
135
+ // suffix string if the suffix matches, otherwise the original
136
+ // string.
137
+ // ----------------------------------------------------------------------
138
+ inline bool HasSuffixString(StringPiece str, StringPiece suffix) {
139
+ return str.size() >= suffix.size() &&
140
+ memcmp(str.data() + str.size() - suffix.size(), suffix.data(),
141
+ suffix.size()) == 0;
142
+ }
143
+
144
+ inline std::string StripSuffixString(const std::string& str,
145
+ const std::string& suffix) {
146
+ if (HasSuffixString(str, suffix)) {
147
+ return str.substr(0, str.size() - suffix.size());
148
+ } else {
149
+ return str;
150
+ }
151
+ }
152
+
153
+ // ----------------------------------------------------------------------
154
+ // ReplaceCharacters
155
+ // Replaces any occurrence of the character 'remove' (or the characters
156
+ // in 'remove') with the character 'replacewith'.
157
+ // Good for keeping html characters or protocol characters (\t) out
158
+ // of places where they might cause a problem.
159
+ // StripWhitespace
160
+ // Removes whitespaces from both ends of the given string.
161
+ // ----------------------------------------------------------------------
162
+ PROTOBUF_EXPORT void ReplaceCharacters(std::string* s, const char* remove,
163
+ char replacewith);
164
+
165
+ PROTOBUF_EXPORT void StripWhitespace(std::string* s);
166
+
167
+ // ----------------------------------------------------------------------
168
+ // LowerString()
169
+ // UpperString()
170
+ // ToUpper()
171
+ // Convert the characters in "s" to lowercase or uppercase. ASCII-only:
172
+ // these functions intentionally ignore locale because they are applied to
173
+ // identifiers used in the Protocol Buffer language, not to natural-language
174
+ // strings.
175
+ // ----------------------------------------------------------------------
176
+
177
+ inline void LowerString(std::string* s) {
178
+ std::string::iterator end = s->end();
179
+ for (std::string::iterator i = s->begin(); i != end; ++i) {
180
+ // tolower() changes based on locale. We don't want this!
181
+ if ('A' <= *i && *i <= 'Z') *i += 'a' - 'A';
182
+ }
183
+ }
184
+
185
+ inline void UpperString(std::string* s) {
186
+ std::string::iterator end = s->end();
187
+ for (std::string::iterator i = s->begin(); i != end; ++i) {
188
+ // toupper() changes based on locale. We don't want this!
189
+ if ('a' <= *i && *i <= 'z') *i += 'A' - 'a';
190
+ }
191
+ }
192
+
193
+ inline void ToUpper(std::string* s) { UpperString(s); }
194
+
195
+ inline std::string ToUpper(const std::string& s) {
196
+ std::string out = s;
197
+ UpperString(&out);
198
+ return out;
199
+ }
200
+
201
+ // ----------------------------------------------------------------------
202
+ // StringReplace()
203
+ // Give me a string and two patterns "old" and "new", and I replace
204
+ // the first instance of "old" in the string with "new", if it
205
+ // exists. RETURN a new string, regardless of whether the replacement
206
+ // happened or not.
207
+ // ----------------------------------------------------------------------
208
+
209
+ PROTOBUF_EXPORT std::string StringReplace(const std::string& s,
210
+ const std::string& oldsub,
211
+ const std::string& newsub,
212
+ bool replace_all);
213
+
214
+ // ----------------------------------------------------------------------
215
+ // SplitStringUsing()
216
+ // Split a string using a character delimiter. Append the components
217
+ // to 'result'. If there are consecutive delimiters, this function skips
218
+ // over all of them.
219
+ // ----------------------------------------------------------------------
220
+ PROTOBUF_EXPORT void SplitStringUsing(StringPiece full, const char* delim,
221
+ std::vector<std::string>* res);
222
+
223
+ // Split a string using one or more byte delimiters, presented
224
+ // as a nul-terminated c string. Append the components to 'result'.
225
+ // If there are consecutive delimiters, this function will return
226
+ // corresponding empty strings. If you want to drop the empty
227
+ // strings, try SplitStringUsing().
228
+ //
229
+ // If "full" is the empty string, yields an empty string as the only value.
230
+ // ----------------------------------------------------------------------
231
+ PROTOBUF_EXPORT void SplitStringAllowEmpty(StringPiece full, const char* delim,
232
+ std::vector<std::string>* result);
233
+
234
+ // ----------------------------------------------------------------------
235
+ // Split()
236
+ // Split a string using a character delimiter.
237
+ // ----------------------------------------------------------------------
238
+ inline std::vector<std::string> Split(StringPiece full, const char* delim,
239
+ bool skip_empty = true) {
240
+ std::vector<std::string> result;
241
+ if (skip_empty) {
242
+ SplitStringUsing(full, delim, &result);
243
+ } else {
244
+ SplitStringAllowEmpty(full, delim, &result);
245
+ }
246
+ return result;
247
+ }
248
+
249
+ // ----------------------------------------------------------------------
250
+ // JoinStrings()
251
+ // These methods concatenate a vector of strings into a C++ string, using
252
+ // the C-string "delim" as a separator between components. There are two
253
+ // flavors of the function, one flavor returns the concatenated string,
254
+ // another takes a pointer to the target string. In the latter case the
255
+ // target string is cleared and overwritten.
256
+ // ----------------------------------------------------------------------
257
+ PROTOBUF_EXPORT void JoinStrings(const std::vector<std::string>& components,
258
+ const char* delim, std::string* result);
259
+
260
+ inline std::string JoinStrings(const std::vector<std::string>& components,
261
+ const char* delim) {
262
+ std::string result;
263
+ JoinStrings(components, delim, &result);
264
+ return result;
265
+ }
266
+
267
+ // ----------------------------------------------------------------------
268
+ // UnescapeCEscapeSequences()
269
+ // Copies "source" to "dest", rewriting C-style escape sequences
270
+ // -- '\n', '\r', '\\', '\ooo', etc -- to their ASCII
271
+ // equivalents. "dest" must be sufficiently large to hold all
272
+ // the characters in the rewritten string (i.e. at least as large
273
+ // as strlen(source) + 1 should be safe, since the replacements
274
+ // are always shorter than the original escaped sequences). It's
275
+ // safe for source and dest to be the same. RETURNS the length
276
+ // of dest.
277
+ //
278
+ // It allows hex sequences \xhh, or generally \xhhhhh with an
279
+ // arbitrary number of hex digits, but all of them together must
280
+ // specify a value of a single byte (e.g. \x0045 is equivalent
281
+ // to \x45, and \x1234 is erroneous).
282
+ //
283
+ // It also allows escape sequences of the form \uhhhh (exactly four
284
+ // hex digits, upper or lower case) or \Uhhhhhhhh (exactly eight
285
+ // hex digits, upper or lower case) to specify a Unicode code
286
+ // point. The dest array will contain the UTF8-encoded version of
287
+ // that code-point (e.g., if source contains \u2019, then dest will
288
+ // contain the three bytes 0xE2, 0x80, and 0x99).
289
+ //
290
+ // Errors: In the first form of the call, errors are reported with
291
+ // LOG(ERROR). The same is true for the second form of the call if
292
+ // the pointer to the string std::vector is nullptr; otherwise, error
293
+ // messages are stored in the std::vector. In either case, the effect on
294
+ // the dest array is not defined, but rest of the source will be
295
+ // processed.
296
+ // ----------------------------------------------------------------------
297
+
298
+ PROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest);
299
+ PROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest,
300
+ std::vector<std::string>* errors);
301
+
302
+ // ----------------------------------------------------------------------
303
+ // UnescapeCEscapeString()
304
+ // This does the same thing as UnescapeCEscapeSequences, but creates
305
+ // a new string. The caller does not need to worry about allocating
306
+ // a dest buffer. This should be used for non performance critical
307
+ // tasks such as printing debug messages. It is safe for src and dest
308
+ // to be the same.
309
+ //
310
+ // The second call stores its errors in a supplied string vector.
311
+ // If the string vector pointer is nullptr, it reports the errors with LOG().
312
+ //
313
+ // In the first and second calls, the length of dest is returned. In the
314
+ // the third call, the new string is returned.
315
+ // ----------------------------------------------------------------------
316
+
317
+ PROTOBUF_EXPORT int UnescapeCEscapeString(const std::string& src,
318
+ std::string* dest);
319
+ PROTOBUF_EXPORT int UnescapeCEscapeString(const std::string& src,
320
+ std::string* dest,
321
+ std::vector<std::string>* errors);
322
+ PROTOBUF_EXPORT std::string UnescapeCEscapeString(const std::string& src);
323
+
324
+ // ----------------------------------------------------------------------
325
+ // CEscape()
326
+ // Escapes 'src' using C-style escape sequences and returns the resulting
327
+ // string.
328
+ //
329
+ // Escaped chars: \n, \r, \t, ", ', \, and !isprint().
330
+ // ----------------------------------------------------------------------
331
+ PROTOBUF_EXPORT std::string CEscape(const std::string& src);
332
+
333
+ // ----------------------------------------------------------------------
334
+ // CEscapeAndAppend()
335
+ // Escapes 'src' using C-style escape sequences, and appends the escaped
336
+ // string to 'dest'.
337
+ // ----------------------------------------------------------------------
338
+ PROTOBUF_EXPORT void CEscapeAndAppend(StringPiece src, std::string* dest);
339
+
340
+ namespace strings {
341
+ // Like CEscape() but does not escape bytes with the upper bit set.
342
+ PROTOBUF_EXPORT std::string Utf8SafeCEscape(const std::string& src);
343
+
344
+ // Like CEscape() but uses hex (\x) escapes instead of octals.
345
+ PROTOBUF_EXPORT std::string CHexEscape(const std::string& src);
346
+ } // namespace strings
347
+
348
+ // ----------------------------------------------------------------------
349
+ // strto32()
350
+ // strtou32()
351
+ // strto64()
352
+ // strtou64()
353
+ // Architecture-neutral plug compatible replacements for strtol() and
354
+ // strtoul(). Long's have different lengths on ILP-32 and LP-64
355
+ // platforms, so using these is safer, from the point of view of
356
+ // overflow behavior, than using the standard libc functions.
357
+ // ----------------------------------------------------------------------
358
+ PROTOBUF_EXPORT int32_t strto32_adaptor(const char* nptr, char** endptr,
359
+ int base);
360
+ PROTOBUF_EXPORT uint32_t strtou32_adaptor(const char* nptr, char** endptr,
361
+ int base);
362
+
363
+ inline int32_t strto32(const char *nptr, char **endptr, int base) {
364
+ if (sizeof(int32_t) == sizeof(long))
365
+ return strtol(nptr, endptr, base);
366
+ else
367
+ return strto32_adaptor(nptr, endptr, base);
368
+ }
369
+
370
+ inline uint32_t strtou32(const char *nptr, char **endptr, int base) {
371
+ if (sizeof(uint32_t) == sizeof(unsigned long))
372
+ return strtoul(nptr, endptr, base);
373
+ else
374
+ return strtou32_adaptor(nptr, endptr, base);
375
+ }
376
+
377
+ // For now, long long is 64-bit on all the platforms we care about, so these
378
+ // functions can simply pass the call to strto[u]ll.
379
+ inline int64_t strto64(const char *nptr, char **endptr, int base) {
380
+ static_assert(sizeof(int64_t) == sizeof(long long),
381
+ "sizeof int64_t is not sizeof long long");
382
+ return strtoll(nptr, endptr, base);
383
+ }
384
+
385
+ inline uint64_t strtou64(const char *nptr, char **endptr, int base) {
386
+ static_assert(sizeof(uint64_t) == sizeof(unsigned long long),
387
+ "sizeof uint64_t is not sizeof unsigned long long");
388
+ return strtoull(nptr, endptr, base);
389
+ }
390
+
391
+ // ----------------------------------------------------------------------
392
+ // safe_strtob()
393
+ // safe_strto32()
394
+ // safe_strtou32()
395
+ // safe_strto64()
396
+ // safe_strtou64()
397
+ // safe_strtof()
398
+ // safe_strtod()
399
+ // ----------------------------------------------------------------------
400
+ PROTOBUF_EXPORT bool safe_strtob(StringPiece str, bool* value);
401
+
402
+ PROTOBUF_EXPORT bool safe_strto32(const std::string& str, int32_t* value);
403
+ PROTOBUF_EXPORT bool safe_strtou32(const std::string& str, uint32_t* value);
404
+ inline bool safe_strto32(const char* str, int32_t* value) {
405
+ return safe_strto32(std::string(str), value);
406
+ }
407
+ inline bool safe_strto32(StringPiece str, int32_t* value) {
408
+ return safe_strto32(str.ToString(), value);
409
+ }
410
+ inline bool safe_strtou32(const char* str, uint32_t* value) {
411
+ return safe_strtou32(std::string(str), value);
412
+ }
413
+ inline bool safe_strtou32(StringPiece str, uint32_t* value) {
414
+ return safe_strtou32(str.ToString(), value);
415
+ }
416
+
417
+ PROTOBUF_EXPORT bool safe_strto64(const std::string& str, int64_t* value);
418
+ PROTOBUF_EXPORT bool safe_strtou64(const std::string& str, uint64_t* value);
419
+ inline bool safe_strto64(const char* str, int64_t* value) {
420
+ return safe_strto64(std::string(str), value);
421
+ }
422
+ inline bool safe_strto64(StringPiece str, int64_t* value) {
423
+ return safe_strto64(str.ToString(), value);
424
+ }
425
+ inline bool safe_strtou64(const char* str, uint64_t* value) {
426
+ return safe_strtou64(std::string(str), value);
427
+ }
428
+ inline bool safe_strtou64(StringPiece str, uint64_t* value) {
429
+ return safe_strtou64(str.ToString(), value);
430
+ }
431
+
432
+ PROTOBUF_EXPORT bool safe_strtof(const char* str, float* value);
433
+ PROTOBUF_EXPORT bool safe_strtod(const char* str, double* value);
434
+ inline bool safe_strtof(const std::string& str, float* value) {
435
+ return safe_strtof(str.c_str(), value);
436
+ }
437
+ inline bool safe_strtod(const std::string& str, double* value) {
438
+ return safe_strtod(str.c_str(), value);
439
+ }
440
+ inline bool safe_strtof(StringPiece str, float* value) {
441
+ return safe_strtof(str.ToString(), value);
442
+ }
443
+ inline bool safe_strtod(StringPiece str, double* value) {
444
+ return safe_strtod(str.ToString(), value);
445
+ }
446
+
447
+ // ----------------------------------------------------------------------
448
+ // FastIntToBuffer()
449
+ // FastHexToBuffer()
450
+ // FastHex64ToBuffer()
451
+ // FastHex32ToBuffer()
452
+ // FastTimeToBuffer()
453
+ // These are intended for speed. FastIntToBuffer() assumes the
454
+ // integer is non-negative. FastHexToBuffer() puts output in
455
+ // hex rather than decimal. FastTimeToBuffer() puts the output
456
+ // into RFC822 format.
457
+ //
458
+ // FastHex64ToBuffer() puts a 64-bit unsigned value in hex-format,
459
+ // padded to exactly 16 bytes (plus one byte for '\0')
460
+ //
461
+ // FastHex32ToBuffer() puts a 32-bit unsigned value in hex-format,
462
+ // padded to exactly 8 bytes (plus one byte for '\0')
463
+ //
464
+ // All functions take the output buffer as an arg.
465
+ // They all return a pointer to the beginning of the output,
466
+ // which may not be the beginning of the input buffer.
467
+ // ----------------------------------------------------------------------
468
+
469
+ // Suggested buffer size for FastToBuffer functions. Also works with
470
+ // DoubleToBuffer() and FloatToBuffer().
471
+ static const int kFastToBufferSize = 32;
472
+
473
+ PROTOBUF_EXPORT char* FastInt32ToBuffer(int32_t i, char* buffer);
474
+ PROTOBUF_EXPORT char* FastInt64ToBuffer(int64_t i, char* buffer);
475
+ char* FastUInt32ToBuffer(uint32_t i, char* buffer); // inline below
476
+ char* FastUInt64ToBuffer(uint64_t i, char* buffer); // inline below
477
+ PROTOBUF_EXPORT char* FastHexToBuffer(int i, char* buffer);
478
+ PROTOBUF_EXPORT char* FastHex64ToBuffer(uint64_t i, char* buffer);
479
+ PROTOBUF_EXPORT char* FastHex32ToBuffer(uint32_t i, char* buffer);
480
+
481
+ // at least 22 bytes long
482
+ inline char* FastIntToBuffer(int i, char* buffer) {
483
+ return (sizeof(i) == 4 ?
484
+ FastInt32ToBuffer(i, buffer) : FastInt64ToBuffer(i, buffer));
485
+ }
486
+ inline char* FastUIntToBuffer(unsigned int i, char* buffer) {
487
+ return (sizeof(i) == 4 ?
488
+ FastUInt32ToBuffer(i, buffer) : FastUInt64ToBuffer(i, buffer));
489
+ }
490
+ inline char* FastLongToBuffer(long i, char* buffer) {
491
+ return (sizeof(i) == 4 ?
492
+ FastInt32ToBuffer(i, buffer) : FastInt64ToBuffer(i, buffer));
493
+ }
494
+ inline char* FastULongToBuffer(unsigned long i, char* buffer) {
495
+ return (sizeof(i) == 4 ?
496
+ FastUInt32ToBuffer(i, buffer) : FastUInt64ToBuffer(i, buffer));
497
+ }
498
+
499
+ // ----------------------------------------------------------------------
500
+ // FastInt32ToBufferLeft()
501
+ // FastUInt32ToBufferLeft()
502
+ // FastInt64ToBufferLeft()
503
+ // FastUInt64ToBufferLeft()
504
+ //
505
+ // Like the Fast*ToBuffer() functions above, these are intended for speed.
506
+ // Unlike the Fast*ToBuffer() functions, however, these functions write
507
+ // their output to the beginning of the buffer (hence the name, as the
508
+ // output is left-aligned). The caller is responsible for ensuring that
509
+ // the buffer has enough space to hold the output.
510
+ //
511
+ // Returns a pointer to the end of the string (i.e. the null character
512
+ // terminating the string).
513
+ // ----------------------------------------------------------------------
514
+
515
+ PROTOBUF_EXPORT char* FastInt32ToBufferLeft(int32_t i, char* buffer);
516
+ PROTOBUF_EXPORT char* FastUInt32ToBufferLeft(uint32_t i, char* buffer);
517
+ PROTOBUF_EXPORT char* FastInt64ToBufferLeft(int64_t i, char* buffer);
518
+ PROTOBUF_EXPORT char* FastUInt64ToBufferLeft(uint64_t i, char* buffer);
519
+
520
+ // Just define these in terms of the above.
521
+ inline char* FastUInt32ToBuffer(uint32_t i, char* buffer) {
522
+ FastUInt32ToBufferLeft(i, buffer);
523
+ return buffer;
524
+ }
525
+ inline char* FastUInt64ToBuffer(uint64_t i, char* buffer) {
526
+ FastUInt64ToBufferLeft(i, buffer);
527
+ return buffer;
528
+ }
529
+
530
+ inline std::string SimpleBtoa(bool value) { return value ? "true" : "false"; }
531
+
532
+ // ----------------------------------------------------------------------
533
+ // SimpleItoa()
534
+ // Description: converts an integer to a string.
535
+ //
536
+ // Return value: string
537
+ // ----------------------------------------------------------------------
538
+ PROTOBUF_EXPORT std::string SimpleItoa(int i);
539
+ PROTOBUF_EXPORT std::string SimpleItoa(unsigned int i);
540
+ PROTOBUF_EXPORT std::string SimpleItoa(long i);
541
+ PROTOBUF_EXPORT std::string SimpleItoa(unsigned long i);
542
+ PROTOBUF_EXPORT std::string SimpleItoa(long long i);
543
+ PROTOBUF_EXPORT std::string SimpleItoa(unsigned long long i);
544
+
545
+ // ----------------------------------------------------------------------
546
+ // SimpleDtoa()
547
+ // SimpleFtoa()
548
+ // DoubleToBuffer()
549
+ // FloatToBuffer()
550
+ // Description: converts a double or float to a string which, if
551
+ // passed to NoLocaleStrtod(), will produce the exact same original double
552
+ // (except in case of NaN; all NaNs are considered the same value).
553
+ // We try to keep the string short but it's not guaranteed to be as
554
+ // short as possible.
555
+ //
556
+ // DoubleToBuffer() and FloatToBuffer() write the text to the given
557
+ // buffer and return it. The buffer must be at least
558
+ // kDoubleToBufferSize bytes for doubles and kFloatToBufferSize
559
+ // bytes for floats. kFastToBufferSize is also guaranteed to be large
560
+ // enough to hold either.
561
+ //
562
+ // Return value: string
563
+ // ----------------------------------------------------------------------
564
+ PROTOBUF_EXPORT std::string SimpleDtoa(double value);
565
+ PROTOBUF_EXPORT std::string SimpleFtoa(float value);
566
+
567
+ PROTOBUF_EXPORT char* DoubleToBuffer(double i, char* buffer);
568
+ PROTOBUF_EXPORT char* FloatToBuffer(float i, char* buffer);
569
+
570
+ // In practice, doubles should never need more than 24 bytes and floats
571
+ // should never need more than 14 (including null terminators), but we
572
+ // overestimate to be safe.
573
+ static const int kDoubleToBufferSize = 32;
574
+ static const int kFloatToBufferSize = 24;
575
+
576
+ namespace strings {
577
+
578
+ enum PadSpec {
579
+ NO_PAD = 1,
580
+ ZERO_PAD_2,
581
+ ZERO_PAD_3,
582
+ ZERO_PAD_4,
583
+ ZERO_PAD_5,
584
+ ZERO_PAD_6,
585
+ ZERO_PAD_7,
586
+ ZERO_PAD_8,
587
+ ZERO_PAD_9,
588
+ ZERO_PAD_10,
589
+ ZERO_PAD_11,
590
+ ZERO_PAD_12,
591
+ ZERO_PAD_13,
592
+ ZERO_PAD_14,
593
+ ZERO_PAD_15,
594
+ ZERO_PAD_16,
595
+ };
596
+
597
+ struct Hex {
598
+ uint64_t value;
599
+ enum PadSpec spec;
600
+ template <class Int>
601
+ explicit Hex(Int v, PadSpec s = NO_PAD)
602
+ : spec(s) {
603
+ // Prevent sign-extension by casting integers to
604
+ // their unsigned counterparts.
605
+ #ifdef LANG_CXX11
606
+ static_assert(
607
+ sizeof(v) == 1 || sizeof(v) == 2 || sizeof(v) == 4 || sizeof(v) == 8,
608
+ "Unknown integer type");
609
+ #endif
610
+ value = sizeof(v) == 1 ? static_cast<uint8_t>(v)
611
+ : sizeof(v) == 2 ? static_cast<uint16_t>(v)
612
+ : sizeof(v) == 4 ? static_cast<uint32_t>(v)
613
+ : static_cast<uint64_t>(v);
614
+ }
615
+ };
616
+
617
+ struct PROTOBUF_EXPORT AlphaNum {
618
+ const char *piece_data_; // move these to string_ref eventually
619
+ size_t piece_size_; // move these to string_ref eventually
620
+
621
+ char digits[kFastToBufferSize];
622
+
623
+ // No bool ctor -- bools convert to an integral type.
624
+ // A bool ctor would also convert incoming pointers (bletch).
625
+
626
+ AlphaNum(int i32)
627
+ : piece_data_(digits),
628
+ piece_size_(FastInt32ToBufferLeft(i32, digits) - &digits[0]) {}
629
+ AlphaNum(unsigned int u32)
630
+ : piece_data_(digits),
631
+ piece_size_(FastUInt32ToBufferLeft(u32, digits) - &digits[0]) {}
632
+ AlphaNum(long long i64)
633
+ : piece_data_(digits),
634
+ piece_size_(FastInt64ToBufferLeft(i64, digits) - &digits[0]) {}
635
+ AlphaNum(unsigned long long u64)
636
+ : piece_data_(digits),
637
+ piece_size_(FastUInt64ToBufferLeft(u64, digits) - &digits[0]) {}
638
+
639
+ // Note: on some architectures, "long" is only 32 bits, not 64, but the
640
+ // performance hit of using FastInt64ToBufferLeft to handle 32-bit values
641
+ // is quite minor.
642
+ AlphaNum(long i64)
643
+ : piece_data_(digits),
644
+ piece_size_(FastInt64ToBufferLeft(i64, digits) - &digits[0]) {}
645
+ AlphaNum(unsigned long u64)
646
+ : piece_data_(digits),
647
+ piece_size_(FastUInt64ToBufferLeft(u64, digits) - &digits[0]) {}
648
+
649
+ AlphaNum(float f)
650
+ : piece_data_(digits), piece_size_(strlen(FloatToBuffer(f, digits))) {}
651
+ AlphaNum(double f)
652
+ : piece_data_(digits), piece_size_(strlen(DoubleToBuffer(f, digits))) {}
653
+
654
+ AlphaNum(Hex hex);
655
+
656
+ AlphaNum(const char* c_str)
657
+ : piece_data_(c_str), piece_size_(strlen(c_str)) {}
658
+ // TODO: Add a string_ref constructor, eventually
659
+ // AlphaNum(const StringPiece &pc) : piece(pc) {}
660
+
661
+ AlphaNum(const std::string& str)
662
+ : piece_data_(str.data()), piece_size_(str.size()) {}
663
+
664
+ AlphaNum(StringPiece str)
665
+ : piece_data_(str.data()), piece_size_(str.size()) {}
666
+
667
+ size_t size() const { return piece_size_; }
668
+ const char *data() const { return piece_data_; }
669
+
670
+ private:
671
+ // Use ":" not ':'
672
+ AlphaNum(char c); // NOLINT(runtime/explicit)
673
+
674
+ // Disallow copy and assign.
675
+ AlphaNum(const AlphaNum&);
676
+ void operator=(const AlphaNum&);
677
+ };
678
+
679
+ } // namespace strings
680
+
681
+ using strings::AlphaNum;
682
+
683
+ // ----------------------------------------------------------------------
684
+ // StrCat()
685
+ // This merges the given strings or numbers, with no delimiter. This
686
+ // is designed to be the fastest possible way to construct a string out
687
+ // of a mix of raw C strings, strings, bool values,
688
+ // and numeric values.
689
+ //
690
+ // Don't use this for user-visible strings. The localization process
691
+ // works poorly on strings built up out of fragments.
692
+ //
693
+ // For clarity and performance, don't use StrCat when appending to a
694
+ // string. In particular, avoid using any of these (anti-)patterns:
695
+ // str.append(StrCat(...)
696
+ // str += StrCat(...)
697
+ // str = StrCat(str, ...)
698
+ // where the last is the worse, with the potential to change a loop
699
+ // from a linear time operation with O(1) dynamic allocations into a
700
+ // quadratic time operation with O(n) dynamic allocations. StrAppend
701
+ // is a better choice than any of the above, subject to the restriction
702
+ // of StrAppend(&str, a, b, c, ...) that none of the a, b, c, ... may
703
+ // be a reference into str.
704
+ // ----------------------------------------------------------------------
705
+
706
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b);
707
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
708
+ const AlphaNum& c);
709
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
710
+ const AlphaNum& c, const AlphaNum& d);
711
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
712
+ const AlphaNum& c, const AlphaNum& d,
713
+ const AlphaNum& e);
714
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
715
+ const AlphaNum& c, const AlphaNum& d,
716
+ const AlphaNum& e, const AlphaNum& f);
717
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
718
+ const AlphaNum& c, const AlphaNum& d,
719
+ const AlphaNum& e, const AlphaNum& f,
720
+ const AlphaNum& g);
721
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
722
+ const AlphaNum& c, const AlphaNum& d,
723
+ const AlphaNum& e, const AlphaNum& f,
724
+ const AlphaNum& g, const AlphaNum& h);
725
+ PROTOBUF_EXPORT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
726
+ const AlphaNum& c, const AlphaNum& d,
727
+ const AlphaNum& e, const AlphaNum& f,
728
+ const AlphaNum& g, const AlphaNum& h,
729
+ const AlphaNum& i);
730
+
731
+ inline std::string StrCat(const AlphaNum& a) {
732
+ return std::string(a.data(), a.size());
733
+ }
734
+
735
+ // ----------------------------------------------------------------------
736
+ // StrAppend()
737
+ // Same as above, but adds the output to the given string.
738
+ // WARNING: For speed, StrAppend does not try to check each of its input
739
+ // arguments to be sure that they are not a subset of the string being
740
+ // appended to. That is, while this will work:
741
+ //
742
+ // string s = "foo";
743
+ // s += s;
744
+ //
745
+ // This will not (necessarily) work:
746
+ //
747
+ // string s = "foo";
748
+ // StrAppend(&s, s);
749
+ //
750
+ // Note: while StrCat supports appending up to 9 arguments, StrAppend
751
+ // is currently limited to 4. That's rarely an issue except when
752
+ // automatically transforming StrCat to StrAppend, and can easily be
753
+ // worked around as consecutive calls to StrAppend are quite efficient.
754
+ // ----------------------------------------------------------------------
755
+
756
+ PROTOBUF_EXPORT void StrAppend(std::string* dest, const AlphaNum& a);
757
+ PROTOBUF_EXPORT void StrAppend(std::string* dest, const AlphaNum& a,
758
+ const AlphaNum& b);
759
+ PROTOBUF_EXPORT void StrAppend(std::string* dest, const AlphaNum& a,
760
+ const AlphaNum& b, const AlphaNum& c);
761
+ PROTOBUF_EXPORT void StrAppend(std::string* dest, const AlphaNum& a,
762
+ const AlphaNum& b, const AlphaNum& c,
763
+ const AlphaNum& d);
764
+
765
+ // ----------------------------------------------------------------------
766
+ // Join()
767
+ // These methods concatenate a range of components into a C++ string, using
768
+ // the C-string "delim" as a separator between components.
769
+ // ----------------------------------------------------------------------
770
+ template <typename Iterator>
771
+ void Join(Iterator start, Iterator end, const char* delim,
772
+ std::string* result) {
773
+ for (Iterator it = start; it != end; ++it) {
774
+ if (it != start) {
775
+ result->append(delim);
776
+ }
777
+ StrAppend(result, *it);
778
+ }
779
+ }
780
+
781
+ template <typename Range>
782
+ std::string Join(const Range& components, const char* delim) {
783
+ std::string result;
784
+ Join(components.begin(), components.end(), delim, &result);
785
+ return result;
786
+ }
787
+
788
+ // ----------------------------------------------------------------------
789
+ // ToHex()
790
+ // Return a lower-case hex string representation of the given integer.
791
+ // ----------------------------------------------------------------------
792
+ PROTOBUF_EXPORT std::string ToHex(uint64_t num);
793
+
794
+ // ----------------------------------------------------------------------
795
+ // GlobalReplaceSubstring()
796
+ // Replaces all instances of a substring in a string. Does nothing
797
+ // if 'substring' is empty. Returns the number of replacements.
798
+ //
799
+ // NOTE: The string pieces must not overlap s.
800
+ // ----------------------------------------------------------------------
801
+ PROTOBUF_EXPORT int GlobalReplaceSubstring(const std::string& substring,
802
+ const std::string& replacement,
803
+ std::string* s);
804
+
805
+ // ----------------------------------------------------------------------
806
+ // Base64Unescape()
807
+ // Converts "src" which is encoded in Base64 to its binary equivalent and
808
+ // writes it to "dest". If src contains invalid characters, dest is cleared
809
+ // and the function returns false. Returns true on success.
810
+ // ----------------------------------------------------------------------
811
+ PROTOBUF_EXPORT bool Base64Unescape(StringPiece src, std::string* dest);
812
+
813
+ // ----------------------------------------------------------------------
814
+ // WebSafeBase64Unescape()
815
+ // This is a variation of Base64Unescape which uses '-' instead of '+', and
816
+ // '_' instead of '/'. src is not null terminated, instead specify len. I
817
+ // recommend that slen<szdest, but we honor szdest anyway.
818
+ // RETURNS the length of dest, or -1 if src contains invalid chars.
819
+
820
+ // The variation that stores into a string clears the string first, and
821
+ // returns false (with dest empty) if src contains invalid chars; for
822
+ // this version src and dest must be different strings.
823
+ // ----------------------------------------------------------------------
824
+ PROTOBUF_EXPORT int WebSafeBase64Unescape(const char* src, int slen, char* dest,
825
+ int szdest);
826
+ PROTOBUF_EXPORT bool WebSafeBase64Unescape(StringPiece src, std::string* dest);
827
+
828
+ // Return the length to use for the output buffer given to the base64 escape
829
+ // routines. Make sure to use the same value for do_padding in both.
830
+ // This function may return incorrect results if given input_len values that
831
+ // are extremely high, which should happen rarely.
832
+ PROTOBUF_EXPORT int CalculateBase64EscapedLen(int input_len, bool do_padding);
833
+ // Use this version when calling Base64Escape without a do_padding arg.
834
+ PROTOBUF_EXPORT int CalculateBase64EscapedLen(int input_len);
835
+
836
+ // ----------------------------------------------------------------------
837
+ // Base64Escape()
838
+ // WebSafeBase64Escape()
839
+ // Encode "src" to "dest" using base64 encoding.
840
+ // src is not null terminated, instead specify len.
841
+ // 'dest' should have at least CalculateBase64EscapedLen() length.
842
+ // RETURNS the length of dest.
843
+ // The WebSafe variation use '-' instead of '+' and '_' instead of '/'
844
+ // so that we can place the out in the URL or cookies without having
845
+ // to escape them. It also has an extra parameter "do_padding",
846
+ // which when set to false will prevent padding with "=".
847
+ // ----------------------------------------------------------------------
848
+ PROTOBUF_EXPORT int Base64Escape(const unsigned char* src, int slen, char* dest,
849
+ int szdest);
850
+ PROTOBUF_EXPORT int WebSafeBase64Escape(const unsigned char* src, int slen,
851
+ char* dest, int szdest,
852
+ bool do_padding);
853
+ // Encode src into dest with padding.
854
+ PROTOBUF_EXPORT void Base64Escape(StringPiece src, std::string* dest);
855
+ // Encode src into dest web-safely without padding.
856
+ PROTOBUF_EXPORT void WebSafeBase64Escape(StringPiece src, std::string* dest);
857
+ // Encode src into dest web-safely with padding.
858
+ PROTOBUF_EXPORT void WebSafeBase64EscapeWithPadding(StringPiece src,
859
+ std::string* dest);
860
+
861
+ PROTOBUF_EXPORT void Base64Escape(const unsigned char* src, int szsrc,
862
+ std::string* dest, bool do_padding);
863
+ PROTOBUF_EXPORT void WebSafeBase64Escape(const unsigned char* src, int szsrc,
864
+ std::string* dest, bool do_padding);
865
+
866
+ inline bool IsValidCodePoint(uint32_t code_point) {
867
+ return code_point < 0xD800 ||
868
+ (code_point >= 0xE000 && code_point <= 0x10FFFF);
869
+ }
870
+
871
+ static const int UTFmax = 4;
872
+ // ----------------------------------------------------------------------
873
+ // EncodeAsUTF8Char()
874
+ // Helper to append a Unicode code point to a string as UTF8, without bringing
875
+ // in any external dependencies. The output buffer must be as least 4 bytes
876
+ // large.
877
+ // ----------------------------------------------------------------------
878
+ PROTOBUF_EXPORT int EncodeAsUTF8Char(uint32_t code_point, char* output);
879
+
880
+ // ----------------------------------------------------------------------
881
+ // UTF8FirstLetterNumBytes()
882
+ // Length of the first UTF-8 character.
883
+ // ----------------------------------------------------------------------
884
+ PROTOBUF_EXPORT int UTF8FirstLetterNumBytes(const char* src, int len);
885
+
886
+ // From google3/third_party/absl/strings/escaping.h
887
+
888
+ // ----------------------------------------------------------------------
889
+ // CleanStringLineEndings()
890
+ // Clean up a multi-line string to conform to Unix line endings.
891
+ // Reads from src and appends to dst, so usually dst should be empty.
892
+ //
893
+ // If there is no line ending at the end of a non-empty string, it can
894
+ // be added automatically.
895
+ //
896
+ // Four different types of input are correctly handled:
897
+ //
898
+ // - Unix/Linux files: line ending is LF: pass through unchanged
899
+ //
900
+ // - DOS/Windows files: line ending is CRLF: convert to LF
901
+ //
902
+ // - Legacy Mac files: line ending is CR: convert to LF
903
+ //
904
+ // - Garbled files: random line endings: convert gracefully
905
+ // lonely CR, lonely LF, CRLF: convert to LF
906
+ //
907
+ // @param src The multi-line string to convert
908
+ // @param dst The converted string is appended to this string
909
+ // @param auto_end_last_line Automatically terminate the last line
910
+ //
911
+ // Limitations:
912
+ //
913
+ // This does not do the right thing for CRCRLF files created by
914
+ // broken programs that do another Unix->DOS conversion on files
915
+ // that are already in CRLF format. For this, a two-pass approach
916
+ // brute-force would be needed that
917
+ //
918
+ // (1) determines the presence of LF (first one is ok)
919
+ // (2) if yes, removes any CR, else convert every CR to LF
920
+ PROTOBUF_EXPORT void CleanStringLineEndings(const std::string& src,
921
+ std::string* dst,
922
+ bool auto_end_last_line);
923
+
924
+ // Same as above, but transforms the argument in place.
925
+ PROTOBUF_EXPORT void CleanStringLineEndings(std::string* str,
926
+ bool auto_end_last_line);
927
+
928
+ namespace strings {
929
+ inline bool EndsWith(StringPiece text, StringPiece suffix) {
930
+ return suffix.empty() ||
931
+ (text.size() >= suffix.size() &&
932
+ memcmp(text.data() + (text.size() - suffix.size()), suffix.data(),
933
+ suffix.size()) == 0);
934
+ }
935
+ } // namespace strings
936
+
937
+ namespace internal {
938
+
939
+ // A locale-independent version of the standard strtod(), which always
940
+ // uses a dot as the decimal separator.
941
+ double NoLocaleStrtod(const char* str, char** endptr);
942
+
943
+ } // namespace internal
944
+
945
+ } // namespace protobuf
946
+ } // namespace google
947
+
948
+ #include <google/protobuf/port_undef.inc>
949
+
950
+ #endif // GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
videochat2/lib/python3.10/site-packages/tensorflow/include/google/protobuf/stubs/substitute.h ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // from google3/strings/substitute.h
33
+
34
+ #include <google/protobuf/stubs/common.h>
35
+ #include <google/protobuf/stubs/stringpiece.h>
36
+ #include <google/protobuf/stubs/strutil.h>
37
+
38
+ #include <string>
39
+
40
+ #ifndef GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_
41
+ #define GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_
42
+
43
+ #include <google/protobuf/port_def.inc>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ namespace strings {
48
+
49
+ // ----------------------------------------------------------------------
50
+ // strings::Substitute()
51
+ // strings::SubstituteAndAppend()
52
+ // Kind of like StringPrintf, but different.
53
+ //
54
+ // Example:
55
+ // string GetMessage(string first_name, string last_name, int age) {
56
+ // return strings::Substitute("My name is $0 $1 and I am $2 years old.",
57
+ // first_name, last_name, age);
58
+ // }
59
+ //
60
+ // Differences from StringPrintf:
61
+ // * The format string does not identify the types of arguments.
62
+ // Instead, the magic of C++ deals with this for us. See below
63
+ // for a list of accepted types.
64
+ // * Substitutions in the format string are identified by a '$'
65
+ // followed by a digit. So, you can use arguments out-of-order and
66
+ // use the same argument multiple times.
67
+ // * It's much faster than StringPrintf.
68
+ //
69
+ // Supported types:
70
+ // * Strings (const char*, const string&)
71
+ // * Note that this means you do not have to add .c_str() to all of
72
+ // your strings. In fact, you shouldn't; it will be slower.
73
+ // * int32, int64, uint32, uint64: Formatted using SimpleItoa().
74
+ // * float, double: Formatted using SimpleFtoa() and SimpleDtoa().
75
+ // * bool: Printed as "true" or "false".
76
+ //
77
+ // SubstituteAndAppend() is like Substitute() but appends the result to
78
+ // *output. Example:
79
+ //
80
+ // string str;
81
+ // strings::SubstituteAndAppend(&str,
82
+ // "My name is $0 $1 and I am $2 years old.",
83
+ // first_name, last_name, age);
84
+ //
85
+ // Substitute() is significantly faster than StringPrintf(). For very
86
+ // large strings, it may be orders of magnitude faster.
87
+ // ----------------------------------------------------------------------
88
+
89
+ namespace internal { // Implementation details.
90
+
91
+ class SubstituteArg {
92
+ public:
93
+ inline SubstituteArg(const char* value)
94
+ : text_(value), size_(strlen(text_)) {}
95
+ inline SubstituteArg(const std::string& value)
96
+ : text_(value.data()), size_(value.size()) {}
97
+ inline SubstituteArg(const StringPiece value)
98
+ : text_(value.data()), size_(value.size()) {}
99
+
100
+ // Indicates that no argument was given.
101
+ inline explicit SubstituteArg()
102
+ : text_(nullptr), size_(-1) {}
103
+
104
+ // Primitives
105
+ // We don't overload for signed and unsigned char because if people are
106
+ // explicitly declaring their chars as signed or unsigned then they are
107
+ // probably actually using them as 8-bit integers and would probably
108
+ // prefer an integer representation. But, we don't really know. So, we
109
+ // make the caller decide what to do.
110
+ inline SubstituteArg(char value)
111
+ : text_(scratch_), size_(1) { scratch_[0] = value; }
112
+ inline SubstituteArg(short value)
113
+ : text_(FastInt32ToBuffer(value, scratch_)), size_(strlen(text_)) {}
114
+ inline SubstituteArg(unsigned short value)
115
+ : text_(FastUInt32ToBuffer(value, scratch_)), size_(strlen(text_)) {}
116
+ inline SubstituteArg(int value)
117
+ : text_(FastInt32ToBuffer(value, scratch_)), size_(strlen(text_)) {}
118
+ inline SubstituteArg(unsigned int value)
119
+ : text_(FastUInt32ToBuffer(value, scratch_)), size_(strlen(text_)) {}
120
+ inline SubstituteArg(long value)
121
+ : text_(FastLongToBuffer(value, scratch_)), size_(strlen(text_)) {}
122
+ inline SubstituteArg(unsigned long value)
123
+ : text_(FastULongToBuffer(value, scratch_)), size_(strlen(text_)) {}
124
+ inline SubstituteArg(long long value)
125
+ : text_(FastInt64ToBuffer(value, scratch_)), size_(strlen(text_)) {}
126
+ inline SubstituteArg(unsigned long long value)
127
+ : text_(FastUInt64ToBuffer(value, scratch_)), size_(strlen(text_)) {}
128
+ inline SubstituteArg(float value)
129
+ : text_(FloatToBuffer(value, scratch_)), size_(strlen(text_)) {}
130
+ inline SubstituteArg(double value)
131
+ : text_(DoubleToBuffer(value, scratch_)), size_(strlen(text_)) {}
132
+ inline SubstituteArg(bool value)
133
+ : text_(value ? "true" : "false"), size_(strlen(text_)) {}
134
+
135
+ inline const char* data() const { return text_; }
136
+ inline int size() const { return size_; }
137
+
138
+ private:
139
+ const char* text_;
140
+ int size_;
141
+ char scratch_[kFastToBufferSize];
142
+ };
143
+
144
+ } // namespace internal
145
+
146
+ PROTOBUF_EXPORT std::string Substitute(
147
+ const std::string& format,
148
+ const internal::SubstituteArg& arg0 = internal::SubstituteArg(),
149
+ const internal::SubstituteArg& arg1 = internal::SubstituteArg(),
150
+ const internal::SubstituteArg& arg2 = internal::SubstituteArg(),
151
+ const internal::SubstituteArg& arg3 = internal::SubstituteArg(),
152
+ const internal::SubstituteArg& arg4 = internal::SubstituteArg(),
153
+ const internal::SubstituteArg& arg5 = internal::SubstituteArg(),
154
+ const internal::SubstituteArg& arg6 = internal::SubstituteArg(),
155
+ const internal::SubstituteArg& arg7 = internal::SubstituteArg(),
156
+ const internal::SubstituteArg& arg8 = internal::SubstituteArg(),
157
+ const internal::SubstituteArg& arg9 = internal::SubstituteArg());
158
+
159
+ PROTOBUF_EXPORT void SubstituteAndAppend(
160
+ std::string* output, const char* format,
161
+ const internal::SubstituteArg& arg0 = internal::SubstituteArg(),
162
+ const internal::SubstituteArg& arg1 = internal::SubstituteArg(),
163
+ const internal::SubstituteArg& arg2 = internal::SubstituteArg(),
164
+ const internal::SubstituteArg& arg3 = internal::SubstituteArg(),
165
+ const internal::SubstituteArg& arg4 = internal::SubstituteArg(),
166
+ const internal::SubstituteArg& arg5 = internal::SubstituteArg(),
167
+ const internal::SubstituteArg& arg6 = internal::SubstituteArg(),
168
+ const internal::SubstituteArg& arg7 = internal::SubstituteArg(),
169
+ const internal::SubstituteArg& arg8 = internal::SubstituteArg(),
170
+ const internal::SubstituteArg& arg9 = internal::SubstituteArg());
171
+
172
+ } // namespace strings
173
+ } // namespace protobuf
174
+ } // namespace google
175
+
176
+ #include <google/protobuf/port_undef.inc>
177
+
178
+ #endif // GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_