jitera-google-protobuf 3.21.12.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/google/protobuf_c/BUILD.bazel +72 -0
- data/ext/google/protobuf_c/convert.c +361 -0
- data/ext/google/protobuf_c/convert.h +75 -0
- data/ext/google/protobuf_c/defs.c +1280 -0
- data/ext/google/protobuf_c/defs.h +107 -0
- data/ext/google/protobuf_c/extconf.rb +28 -0
- data/ext/google/protobuf_c/map.c +687 -0
- data/ext/google/protobuf_c/map.h +66 -0
- data/ext/google/protobuf_c/message.c +1435 -0
- data/ext/google/protobuf_c/message.h +104 -0
- data/ext/google/protobuf_c/naive.c +92 -0
- data/ext/google/protobuf_c/protobuf.c +480 -0
- data/ext/google/protobuf_c/protobuf.h +120 -0
- data/ext/google/protobuf_c/range2-neon.c +157 -0
- data/ext/google/protobuf_c/range2-sse.c +170 -0
- data/ext/google/protobuf_c/repeated_field.c +657 -0
- data/ext/google/protobuf_c/repeated_field.h +63 -0
- data/ext/google/protobuf_c/ruby-upb.c +13707 -0
- data/ext/google/protobuf_c/ruby-upb.h +10582 -0
- data/ext/google/protobuf_c/utf8_range.h +21 -0
- data/ext/google/protobuf_c/wrap_memcpy.c +52 -0
- data/lib/google/protobuf/any_pb.rb +19 -0
- data/lib/google/protobuf/api_pb.rb +42 -0
- data/lib/google/protobuf/descriptor_dsl.rb +465 -0
- data/lib/google/protobuf/descriptor_pb.rb +279 -0
- data/lib/google/protobuf/duration_pb.rb +19 -0
- data/lib/google/protobuf/empty_pb.rb +17 -0
- data/lib/google/protobuf/field_mask_pb.rb +18 -0
- data/lib/google/protobuf/message_exts.rb +58 -0
- data/lib/google/protobuf/repeated_field.rb +201 -0
- data/lib/google/protobuf/source_context_pb.rb +18 -0
- data/lib/google/protobuf/struct_pb.rb +37 -0
- data/lib/google/protobuf/timestamp_pb.rb +19 -0
- data/lib/google/protobuf/type_pb.rb +92 -0
- data/lib/google/protobuf/well_known_types.rb +240 -0
- data/lib/google/protobuf/wrappers_pb.rb +50 -0
- data/lib/google/protobuf.rb +79 -0
- metadata +129 -0
@@ -0,0 +1,279 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/descriptor.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
descriptor_data = File.binread(__FILE__).split("\n__END__\n", 2)[1]
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.add_serialized_file(descriptor_data)
|
8
|
+
|
9
|
+
module Google
|
10
|
+
module Protobuf
|
11
|
+
FileDescriptorSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FileDescriptorSet").msgclass
|
12
|
+
FileDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FileDescriptorProto").msgclass
|
13
|
+
DescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DescriptorProto").msgclass
|
14
|
+
DescriptorProto::ExtensionRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DescriptorProto.ExtensionRange").msgclass
|
15
|
+
DescriptorProto::ReservedRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DescriptorProto.ReservedRange").msgclass
|
16
|
+
ExtensionRangeOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ExtensionRangeOptions").msgclass
|
17
|
+
FieldDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldDescriptorProto").msgclass
|
18
|
+
FieldDescriptorProto::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldDescriptorProto.Type").enummodule
|
19
|
+
FieldDescriptorProto::Label = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldDescriptorProto.Label").enummodule
|
20
|
+
OneofDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.OneofDescriptorProto").msgclass
|
21
|
+
EnumDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumDescriptorProto").msgclass
|
22
|
+
EnumDescriptorProto::EnumReservedRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumDescriptorProto.EnumReservedRange").msgclass
|
23
|
+
EnumValueDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValueDescriptorProto").msgclass
|
24
|
+
ServiceDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ServiceDescriptorProto").msgclass
|
25
|
+
MethodDescriptorProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MethodDescriptorProto").msgclass
|
26
|
+
FileOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FileOptions").msgclass
|
27
|
+
FileOptions::OptimizeMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FileOptions.OptimizeMode").enummodule
|
28
|
+
MessageOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MessageOptions").msgclass
|
29
|
+
FieldOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldOptions").msgclass
|
30
|
+
FieldOptions::CType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldOptions.CType").enummodule
|
31
|
+
FieldOptions::JSType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldOptions.JSType").enummodule
|
32
|
+
OneofOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.OneofOptions").msgclass
|
33
|
+
EnumOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumOptions").msgclass
|
34
|
+
EnumValueOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValueOptions").msgclass
|
35
|
+
ServiceOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ServiceOptions").msgclass
|
36
|
+
MethodOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MethodOptions").msgclass
|
37
|
+
MethodOptions::IdempotencyLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MethodOptions.IdempotencyLevel").enummodule
|
38
|
+
UninterpretedOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UninterpretedOption").msgclass
|
39
|
+
UninterpretedOption::NamePart = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UninterpretedOption.NamePart").msgclass
|
40
|
+
SourceCodeInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceCodeInfo").msgclass
|
41
|
+
SourceCodeInfo::Location = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceCodeInfo.Location").msgclass
|
42
|
+
GeneratedCodeInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo").msgclass
|
43
|
+
GeneratedCodeInfo::Annotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo.Annotation").msgclass
|
44
|
+
GeneratedCodeInfo::Annotation::Semantic = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo.Annotation.Semantic").enummodule
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
__END__
|
49
|
+
|
50
|
+
google/protobuf/descriptor.protogoogle.protobuf"G
|
51
|
+
FileDescriptorSet2
|
52
|
+
file (2$.google.protobuf.FileDescriptorProto"�
|
53
|
+
FileDescriptorProto
|
54
|
+
name (
|
55
|
+
package (
|
56
|
+
|
57
|
+
dependency (
|
58
|
+
public_dependency
|
59
|
+
(
|
60
|
+
weak_dependency (6
|
61
|
+
message_type (2 .google.protobuf.DescriptorProto7
|
62
|
+
enum_type (2$.google.protobuf.EnumDescriptorProto8
|
63
|
+
service (2'.google.protobuf.ServiceDescriptorProto8
|
64
|
+
extension (2%.google.protobuf.FieldDescriptorProto-
|
65
|
+
options (2.google.protobuf.FileOptions9
|
66
|
+
source_code_info (2.google.protobuf.SourceCodeInfo
|
67
|
+
syntax (
|
68
|
+
edition
|
69
|
( "�
|
70
|
+
DescriptorProto
|
71
|
+
name ( 4
|
72
|
+
field (2%.google.protobuf.FieldDescriptorProto8
|
73
|
+
extension (2%.google.protobuf.FieldDescriptorProto5
|
74
|
+
nested_type (2 .google.protobuf.DescriptorProto7
|
75
|
+
enum_type (2$.google.protobuf.EnumDescriptorProtoH
|
76
|
+
extension_range (2/.google.protobuf.DescriptorProto.ExtensionRange9
|
77
|
+
|
78
|
+
oneof_decl (2%.google.protobuf.OneofDescriptorProto0
|
79
|
+
options (2.google.protobuf.MessageOptionsF
|
80
|
+
reserved_range (2..google.protobuf.DescriptorProto.ReservedRange
|
81
|
+
|
82
|
+
( e
|
83
|
+
ExtensionRange
|
84
|
+
start (
|
85
|
+
end (7
|
86
|
+
options (2&.google.protobuf.ExtensionRangeOptions+
|
87
|
+
|
88
|
+
start (
|
89
|
+
end ("g
|
90
|
+
ExtensionRangeOptionsC
|
91
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
92
|
+
FieldDescriptorProto
|
93
|
+
name (
|
94
|
+
number (:
|
95
|
+
label (2+.google.protobuf.FieldDescriptorProto.Label8
|
96
|
+
type (2*.google.protobuf.FieldDescriptorProto.Type
|
97
|
+
type_name (
|
98
|
+
extendee (
|
99
|
+
|
100
|
+
oneof_index (
|
101
|
+
json_name
|
102
|
+
( .
|
103
|
+
options (2.google.protobuf.FieldOptions
|
104
|
+
proto3_optional ("�
|
105
|
+
Type
|
106
|
+
TYPE_DOUBLE
|
107
|
+
|
108
|
+
TYPE_FLOAT
|
109
|
+
|
110
|
+
TYPE_INT64
|
111
|
+
TYPE_UINT64
|
112
|
+
|
113
|
+
TYPE_INT32
|
114
|
+
TYPE_FIXED64
|
115
|
+
TYPE_FIXED32
|
116
|
+
TYPE_BOOL
|
117
|
+
TYPE_STRING
|
118
|
+
|
119
|
+
TYPE_GROUP
|
120
|
+
|
121
|
+
TYPE_MESSAGE
|
122
|
+
|
123
|
+
TYPE_BYTES
|
124
|
+
TYPE_UINT32
|
125
|
+
TYPE_ENUM
|
126
|
+
|
127
|
+
|
128
|
+
TYPE_SINT32
|
129
|
+
TYPE_SINT64"C
|
130
|
+
Label
|
131
|
+
LABEL_OPTIONAL
|
132
|
+
LABEL_REQUIRED
|
133
|
+
LABEL_REPEATED"T
|
134
|
+
OneofDescriptorProto
|
135
|
+
name ( .
|
136
|
+
options (2.google.protobuf.OneofOptions"�
|
137
|
+
EnumDescriptorProto
|
138
|
+
name ( 8
|
139
|
+
value (2).google.protobuf.EnumValueDescriptorProto-
|
140
|
+
options (2.google.protobuf.EnumOptionsN
|
141
|
+
reserved_range (26.google.protobuf.EnumDescriptorProto.EnumReservedRange
|
142
|
+
|
143
|
+
EnumReservedRange
|
144
|
+
start (
|
145
|
+
end ("l
|
146
|
+
EnumValueDescriptorProto
|
147
|
+
name (
|
148
|
+
number (2
|
149
|
+
options (2!.google.protobuf.EnumValueOptions"�
|
150
|
+
ServiceDescriptorProto
|
151
|
+
name ( 6
|
152
|
+
method (2&.google.protobuf.MethodDescriptorProto0
|
153
|
+
options (2.google.protobuf.ServiceOptions"�
|
154
|
+
MethodDescriptorProto
|
155
|
+
name (
|
156
|
+
|
157
|
+
input_type (
|
158
|
+
output_type ( /
|
159
|
+
options (2.google.protobuf.MethodOptions
|
160
|
+
client_streaming (:false
|
161
|
+
server_streaming (:false"�
|
162
|
+
FileOptions
|
163
|
+
java_package (
|
164
|
+
java_outer_classname ( "
|
165
|
+
java_multiple_files
|
166
|
+
(:false)
|
167
|
+
java_generate_equals_and_hash (B%
|
168
|
+
java_string_check_utf8 (:falseF
|
169
|
+
optimize_for (2).google.protobuf.FileOptions.OptimizeMode:SPEED
|
170
|
+
|
171
|
+
go_package ( "
|
172
|
+
cc_generic_services (:false$
|
173
|
+
java_generic_services (:false"
|
174
|
+
py_generic_services (:false#
|
175
|
+
php_generic_services* (:false
|
176
|
+
|
177
|
+
deprecated (:false
|
178
|
+
cc_enable_arenas (:true
|
179
|
+
objc_class_prefix$ (
|
180
|
+
csharp_namespace% (
|
181
|
+
swift_prefix' (
|
182
|
+
php_class_prefix( (
|
183
|
+
|
184
|
+
php_metadata_namespace, (
|
185
|
+
ruby_package- ( C
|
186
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption":
|
187
|
+
OptimizeMode
|
188
|
+
SPEED
|
189
|
+
CODE_SIZE
|
190
|
+
LITE_RUNTIME* �����J&'"�
|
191
|
+
MessageOptions&
|
192
|
+
message_set_wire_format (:false.
|
193
|
+
no_standard_descriptor_accessor (:false
|
194
|
+
|
195
|
+
deprecated (:false
|
196
|
+
map_entry (2
|
197
|
+
&deprecated_legacy_json_field_conflicts (BC
|
198
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����JJJJ J
|
199
|
+
"�
|
200
|
+
FieldOptions:
|
201
|
+
ctype (2#.google.protobuf.FieldOptions.CType:STRING
|
202
|
+
packed (?
|
203
|
+
jstype (2$.google.protobuf.FieldOptions.JSType: JS_NORMAL
|
204
|
+
lazy (:false
|
205
|
+
unverified_lazy (:false
|
206
|
+
|
207
|
+
deprecated (:false
|
208
|
+
weak
|
209
|
+
(:false
|
210
|
+
debug_redact (:falseC
|
211
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption"/
|
212
|
+
CType
|
213
|
+
|
214
|
+
STRING
|
215
|
+
CORD
|
216
|
+
STRING_PIECE"5
|
217
|
+
JSType
|
218
|
+
JS_NORMAL
|
219
|
+
JS_STRING
|
220
|
+
JS_NUMBER* �����J"^
|
221
|
+
OneofOptionsC
|
222
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
223
|
+
EnumOptions
|
224
|
+
allow_alias (
|
225
|
+
|
226
|
+
deprecated (:false2
|
227
|
+
&deprecated_legacy_json_field_conflicts (BC
|
228
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����J"}
|
229
|
+
EnumValueOptions
|
230
|
+
|
231
|
+
deprecated (:falseC
|
232
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"{
|
233
|
+
ServiceOptions
|
234
|
+
|
235
|
+
deprecated! (:falseC
|
236
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
237
|
+
|
238
|
+
|
239
|
+
deprecated! (:false_
|
240
|
+
idempotency_level" (2/.google.protobuf.MethodOptions.IdempotencyLevel:IDEMPOTENCY_UNKNOWNC
|
241
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption"P
|
242
|
+
IdempotencyLevel
|
243
|
+
IDEMPOTENCY_UNKNOWN
|
244
|
+
NO_SIDE_EFFECTS
|
245
|
+
|
246
|
+
IDEMPOTENT* �����"�
|
247
|
+
UninterpretedOption;
|
248
|
+
name (2-.google.protobuf.UninterpretedOption.NamePart
|
249
|
+
identifier_value (
|
250
|
+
positive_int_value (
|
251
|
+
negative_int_value (
|
252
|
+
double_value (
|
253
|
+
string_value (
|
254
|
+
aggregate_value ( 3
|
255
|
+
NamePart
|
256
|
+
name_part (
|
257
|
+
is_extension ("�
|
258
|
+
SourceCodeInfo:
|
259
|
+
location (2(.google.protobuf.SourceCodeInfo.Location�
|
260
|
+
Location
|
261
|
+
path (B
|
262
|
+
span (B
|
263
|
+
leading_comments (
|
264
|
+
trailing_comments ( !
|
265
|
+
leading_detached_comments ( "�
|
266
|
+
GeneratedCodeInfoA
|
267
|
+
|
268
|
+
annotation (2-.google.protobuf.GeneratedCodeInfo.Annotation�
|
269
|
+
|
270
|
+
Annotation
|
271
|
+
path (B
|
272
|
+
source_file (
|
273
|
+
begin (
|
274
|
+
end (H
|
275
|
+
semantic (26.google.protobuf.GeneratedCodeInfo.Annotation.Semantic"(
|
276
|
+
Semantic
|
277
|
+
NONE
|
278
|
+
SET
|
279
|
+
ALIASB~
|
280
|
+
com.google.protobufBDescriptorProtosHZ-google.golang.org/protobuf/types/descriptorpb��GPB�Google.Protobuf.Reflection
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/duration.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/duration.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.Duration" do
|
9
|
+
optional :seconds, :int64, 1
|
10
|
+
optional :nanos, :int32, 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
Duration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Duration").msgclass
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/empty.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/empty.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.Empty" do
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Google
|
14
|
+
module Protobuf
|
15
|
+
Empty = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/field_mask.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/field_mask.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.FieldMask" do
|
9
|
+
repeated :paths, :string, 1
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Google
|
15
|
+
module Protobuf
|
16
|
+
FieldMask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldMask").msgclass
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,58 @@
|
|
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
|
+
module Google
|
32
|
+
module Protobuf
|
33
|
+
module MessageExts
|
34
|
+
|
35
|
+
#this is only called in jruby; mri loades the ClassMethods differently
|
36
|
+
def self.included(klass)
|
37
|
+
klass.extend(ClassMethods)
|
38
|
+
end
|
39
|
+
|
40
|
+
module ClassMethods
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_json(options = {})
|
44
|
+
self.class.encode_json(self, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_proto(options = {})
|
48
|
+
self.class.encode(self, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
class AbstractMessage
|
53
|
+
include MessageExts
|
54
|
+
extend MessageExts::ClassMethods
|
55
|
+
end
|
56
|
+
private_constant :AbstractMessage
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,201 @@
|
|
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
|
+
require 'forwardable'
|
32
|
+
|
33
|
+
#
|
34
|
+
# This class makes RepeatedField act (almost-) like a Ruby Array.
|
35
|
+
# It has convenience methods that extend the core C or Java based
|
36
|
+
# methods.
|
37
|
+
#
|
38
|
+
# This is a best-effort to mirror Array behavior. Two comments:
|
39
|
+
# 1) patches always welcome :)
|
40
|
+
# 2) if performance is an issue, feel free to rewrite the method
|
41
|
+
# in jruby and C. The source code has plenty of examples
|
42
|
+
#
|
43
|
+
# KNOWN ISSUES
|
44
|
+
# - #[]= doesn't allow less used approaches such as `arr[1, 2] = 'fizz'`
|
45
|
+
# - #concat should return the orig array
|
46
|
+
# - #push should accept multiple arguments and push them all at the same time
|
47
|
+
#
|
48
|
+
module Google
|
49
|
+
module Protobuf
|
50
|
+
class RepeatedField
|
51
|
+
extend Forwardable
|
52
|
+
|
53
|
+
# methods defined in C or Java:
|
54
|
+
# +
|
55
|
+
# [], at
|
56
|
+
# []=
|
57
|
+
# concat
|
58
|
+
# clear
|
59
|
+
# dup, clone
|
60
|
+
# each
|
61
|
+
# push, <<
|
62
|
+
# replace
|
63
|
+
# length, size
|
64
|
+
# ==
|
65
|
+
# to_ary, to_a
|
66
|
+
# also all enumerable
|
67
|
+
#
|
68
|
+
# NOTE: using delegators rather than method_missing to make the
|
69
|
+
# relationship explicit instead of implicit
|
70
|
+
def_delegators :to_ary,
|
71
|
+
:&, :*, :-, :'<=>',
|
72
|
+
:assoc, :bsearch, :bsearch_index, :combination, :compact, :count,
|
73
|
+
:cycle, :dig, :drop, :drop_while, :eql?, :fetch, :find_index, :flatten,
|
74
|
+
:include?, :index, :inspect, :join,
|
75
|
+
:pack, :permutation, :product, :pretty_print, :pretty_print_cycle,
|
76
|
+
:rassoc, :repeated_combination, :repeated_permutation, :reverse,
|
77
|
+
:rindex, :rotate, :sample, :shuffle, :shelljoin,
|
78
|
+
:to_s, :transpose, :uniq, :|
|
79
|
+
|
80
|
+
|
81
|
+
def first(n=nil)
|
82
|
+
if n.nil?
|
83
|
+
return self[0]
|
84
|
+
elsif n < 0
|
85
|
+
raise ArgumentError, "negative array size"
|
86
|
+
else
|
87
|
+
return self[0...n]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
def last(n=nil)
|
93
|
+
if n.nil?
|
94
|
+
return self[-1]
|
95
|
+
elsif n < 0
|
96
|
+
raise ArgumentError, "negative array size"
|
97
|
+
else
|
98
|
+
start = [self.size-n, 0].max
|
99
|
+
return self[start...self.size]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def pop(n=nil)
|
105
|
+
if n
|
106
|
+
results = []
|
107
|
+
n.times{ results << pop_one }
|
108
|
+
return results
|
109
|
+
else
|
110
|
+
return pop_one
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def empty?
|
116
|
+
self.size == 0
|
117
|
+
end
|
118
|
+
|
119
|
+
# array aliases into enumerable
|
120
|
+
alias_method :each_index, :each_with_index
|
121
|
+
alias_method :slice, :[]
|
122
|
+
alias_method :values_at, :select
|
123
|
+
alias_method :map, :collect
|
124
|
+
|
125
|
+
|
126
|
+
class << self
|
127
|
+
def define_array_wrapper_method(method_name)
|
128
|
+
define_method(method_name) do |*args, &block|
|
129
|
+
arr = self.to_a
|
130
|
+
result = arr.send(method_name, *args)
|
131
|
+
self.replace(arr)
|
132
|
+
return result if result
|
133
|
+
return block ? block.call : result
|
134
|
+
end
|
135
|
+
end
|
136
|
+
private :define_array_wrapper_method
|
137
|
+
|
138
|
+
|
139
|
+
def define_array_wrapper_with_result_method(method_name)
|
140
|
+
define_method(method_name) do |*args, &block|
|
141
|
+
# result can be an Enumerator, Array, or nil
|
142
|
+
# Enumerator can sometimes be returned if a block is an optional argument and it is not passed in
|
143
|
+
# nil usually specifies that no change was made
|
144
|
+
result = self.to_a.send(method_name, *args, &block)
|
145
|
+
if result
|
146
|
+
new_arr = result.to_a
|
147
|
+
self.replace(new_arr)
|
148
|
+
if result.is_a?(Enumerator)
|
149
|
+
# generate a fresh enum; rewinding the exiting one, in Ruby 2.2, will
|
150
|
+
# reset the enum with the same length, but all the #next calls will
|
151
|
+
# return nil
|
152
|
+
result = new_arr.to_enum
|
153
|
+
# generate a wrapper enum so any changes which occur by a chained
|
154
|
+
# enum can be captured
|
155
|
+
ie = ProxyingEnumerator.new(self, result)
|
156
|
+
result = ie.to_enum
|
157
|
+
end
|
158
|
+
end
|
159
|
+
result
|
160
|
+
end
|
161
|
+
end
|
162
|
+
private :define_array_wrapper_with_result_method
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
%w(delete delete_at shift slice! unshift).each do |method_name|
|
167
|
+
define_array_wrapper_method(method_name)
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
%w(collect! compact! delete_if fill flatten! insert reverse!
|
172
|
+
rotate! select! shuffle! sort! sort_by! uniq!).each do |method_name|
|
173
|
+
define_array_wrapper_with_result_method(method_name)
|
174
|
+
end
|
175
|
+
alias_method :keep_if, :select!
|
176
|
+
alias_method :map!, :collect!
|
177
|
+
alias_method :reject!, :delete_if
|
178
|
+
|
179
|
+
|
180
|
+
# propagates changes made by user of enumerator back to the original repeated field.
|
181
|
+
# This only applies in cases where the calling function which created the enumerator,
|
182
|
+
# such as #sort!, modifies itself rather than a new array, such as #sort
|
183
|
+
class ProxyingEnumerator < Struct.new(:repeated_field, :external_enumerator)
|
184
|
+
def each(*args, &block)
|
185
|
+
results = []
|
186
|
+
external_enumerator.each_with_index do |val, i|
|
187
|
+
result = yield(val)
|
188
|
+
results << result
|
189
|
+
#nil means no change occurred from yield; usually occurs when #to_a is called
|
190
|
+
if result
|
191
|
+
repeated_field[i] = result if result != val
|
192
|
+
end
|
193
|
+
end
|
194
|
+
results
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/source_context.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/source_context.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.SourceContext" do
|
9
|
+
optional :file_name, :string, 1
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Google
|
15
|
+
module Protobuf
|
16
|
+
SourceContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceContext").msgclass
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/struct.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/struct.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.Struct" do
|
9
|
+
map :fields, :string, :message, 1, "google.protobuf.Value"
|
10
|
+
end
|
11
|
+
add_message "google.protobuf.Value" do
|
12
|
+
oneof :kind do
|
13
|
+
optional :null_value, :enum, 1, "google.protobuf.NullValue"
|
14
|
+
optional :number_value, :double, 2
|
15
|
+
optional :string_value, :string, 3
|
16
|
+
optional :bool_value, :bool, 4
|
17
|
+
optional :struct_value, :message, 5, "google.protobuf.Struct"
|
18
|
+
optional :list_value, :message, 6, "google.protobuf.ListValue"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
add_message "google.protobuf.ListValue" do
|
22
|
+
repeated :values, :message, 1, "google.protobuf.Value"
|
23
|
+
end
|
24
|
+
add_enum "google.protobuf.NullValue" do
|
25
|
+
value :NULL_VALUE, 0
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Protobuf
|
32
|
+
Struct = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Struct").msgclass
|
33
|
+
Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Value").msgclass
|
34
|
+
ListValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ListValue").msgclass
|
35
|
+
NullValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.NullValue").enummodule
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/timestamp.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/protobuf/timestamp.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.protobuf.Timestamp" do
|
9
|
+
optional :seconds, :int64, 1
|
10
|
+
optional :nanos, :int32, 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
Timestamp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Timestamp").msgclass
|
18
|
+
end
|
19
|
+
end
|