google-protobuf 3.17.3 → 3.22.1-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/convert.c +128 -116
- data/ext/google/protobuf_c/convert.h +12 -9
- data/ext/google/protobuf_c/defs.c +217 -1521
- data/ext/google/protobuf_c/defs.h +19 -19
- data/ext/google/protobuf_c/extconf.rb +12 -6
- data/ext/google/protobuf_c/map.c +105 -109
- data/ext/google/protobuf_c/map.h +7 -8
- data/ext/google/protobuf_c/message.c +438 -341
- data/ext/google/protobuf_c/message.h +22 -19
- data/ext/google/protobuf_c/protobuf.c +68 -58
- data/ext/google/protobuf_c/protobuf.h +13 -10
- data/ext/google/protobuf_c/repeated_field.c +83 -85
- data/ext/google/protobuf_c/repeated_field.h +6 -6
- data/ext/google/protobuf_c/ruby-upb.c +11782 -6714
- data/ext/google/protobuf_c/ruby-upb.h +9668 -3406
- data/ext/google/protobuf_c/third_party/utf8_range/LICENSE +22 -0
- data/ext/google/protobuf_c/third_party/utf8_range/naive.c +92 -0
- data/ext/google/protobuf_c/third_party/utf8_range/range2-neon.c +157 -0
- data/ext/google/protobuf_c/third_party/utf8_range/range2-sse.c +170 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.h +21 -0
- data/ext/google/protobuf_c/wrap_memcpy.c +4 -3
- data/lib/google/2.6/protobuf_c.bundle +0 -0
- data/lib/google/2.7/protobuf_c.bundle +0 -0
- data/lib/google/3.0/protobuf_c.bundle +0 -0
- data/lib/google/3.1/protobuf_c.bundle +0 -0
- data/lib/google/3.2/protobuf_c.bundle +0 -0
- data/lib/google/protobuf/any_pb.rb +0 -0
- data/lib/google/protobuf/api_pb.rb +1 -0
- data/lib/google/protobuf/descriptor_dsl.rb +465 -0
- data/lib/google/protobuf/descriptor_pb.rb +298 -0
- data/lib/google/protobuf/duration_pb.rb +0 -0
- data/lib/google/protobuf/empty_pb.rb +0 -0
- data/lib/google/protobuf/field_mask_pb.rb +0 -0
- data/lib/google/protobuf/message_exts.rb +7 -2
- data/lib/google/protobuf/plugin_pb.rb +50 -0
- data/lib/google/protobuf/repeated_field.rb +15 -2
- data/lib/google/protobuf/source_context_pb.rb +0 -0
- data/lib/google/protobuf/struct_pb.rb +0 -0
- data/lib/google/protobuf/timestamp_pb.rb +0 -0
- data/lib/google/protobuf/type_pb.rb +1 -0
- data/lib/google/protobuf/well_known_types.rb +12 -2
- data/lib/google/protobuf/wrappers_pb.rb +0 -0
- data/lib/google/protobuf.rb +5 -73
- metadata +28 -40
- data/ext/google/protobuf_c/third_party/wyhash/wyhash.h +0 -145
- data/tests/basic.rb +0 -611
- data/tests/generated_code_test.rb +0 -23
- data/tests/stress.rb +0 -38
@@ -0,0 +1,298 @@
|
|
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
|
+
FieldOptions::OptionRetention = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldOptions.OptionRetention").enummodule
|
33
|
+
FieldOptions::OptionTargetType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldOptions.OptionTargetType").enummodule
|
34
|
+
OneofOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.OneofOptions").msgclass
|
35
|
+
EnumOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumOptions").msgclass
|
36
|
+
EnumValueOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValueOptions").msgclass
|
37
|
+
ServiceOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ServiceOptions").msgclass
|
38
|
+
MethodOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MethodOptions").msgclass
|
39
|
+
MethodOptions::IdempotencyLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.MethodOptions.IdempotencyLevel").enummodule
|
40
|
+
UninterpretedOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UninterpretedOption").msgclass
|
41
|
+
UninterpretedOption::NamePart = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UninterpretedOption.NamePart").msgclass
|
42
|
+
SourceCodeInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceCodeInfo").msgclass
|
43
|
+
SourceCodeInfo::Location = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceCodeInfo.Location").msgclass
|
44
|
+
GeneratedCodeInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo").msgclass
|
45
|
+
GeneratedCodeInfo::Annotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo.Annotation").msgclass
|
46
|
+
GeneratedCodeInfo::Annotation::Semantic = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GeneratedCodeInfo.Annotation.Semantic").enummodule
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
__END__
|
51
|
+
|
52
|
+
google/protobuf/descriptor.protogoogle.protobuf"G
|
53
|
+
FileDescriptorSet2
|
54
|
+
file (2$.google.protobuf.FileDescriptorProto"�
|
55
|
+
FileDescriptorProto
|
56
|
+
name (
|
57
|
+
package (
|
58
|
+
|
59
|
+
dependency (
|
60
|
+
public_dependency
|
61
|
+
(
|
62
|
+
weak_dependency (6
|
63
|
+
message_type (2 .google.protobuf.DescriptorProto7
|
64
|
+
enum_type (2$.google.protobuf.EnumDescriptorProto8
|
65
|
+
service (2'.google.protobuf.ServiceDescriptorProto8
|
66
|
+
extension (2%.google.protobuf.FieldDescriptorProto-
|
67
|
+
options (2.google.protobuf.FileOptions9
|
68
|
+
source_code_info (2.google.protobuf.SourceCodeInfo
|
69
|
+
syntax (
|
70
|
+
edition
|
71
|
( "�
|
72
|
+
DescriptorProto
|
73
|
+
name ( 4
|
74
|
+
field (2%.google.protobuf.FieldDescriptorProto8
|
75
|
+
extension (2%.google.protobuf.FieldDescriptorProto5
|
76
|
+
nested_type (2 .google.protobuf.DescriptorProto7
|
77
|
+
enum_type (2$.google.protobuf.EnumDescriptorProtoH
|
78
|
+
extension_range (2/.google.protobuf.DescriptorProto.ExtensionRange9
|
79
|
+
|
80
|
+
oneof_decl (2%.google.protobuf.OneofDescriptorProto0
|
81
|
+
options (2.google.protobuf.MessageOptionsF
|
82
|
+
reserved_range (2..google.protobuf.DescriptorProto.ReservedRange
|
83
|
+
|
84
|
+
( e
|
85
|
+
ExtensionRange
|
86
|
+
start (
|
87
|
+
end (7
|
88
|
+
options (2&.google.protobuf.ExtensionRangeOptions+
|
89
|
+
|
90
|
+
start (
|
91
|
+
end ("g
|
92
|
+
ExtensionRangeOptionsC
|
93
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
94
|
+
FieldDescriptorProto
|
95
|
+
name (
|
96
|
+
number (:
|
97
|
+
label (2+.google.protobuf.FieldDescriptorProto.Label8
|
98
|
+
type (2*.google.protobuf.FieldDescriptorProto.Type
|
99
|
+
type_name (
|
100
|
+
extendee (
|
101
|
+
|
102
|
+
oneof_index (
|
103
|
+
json_name
|
104
|
+
( .
|
105
|
+
options (2.google.protobuf.FieldOptions
|
106
|
+
proto3_optional ("�
|
107
|
+
Type
|
108
|
+
TYPE_DOUBLE
|
109
|
+
|
110
|
+
TYPE_FLOAT
|
111
|
+
|
112
|
+
TYPE_INT64
|
113
|
+
TYPE_UINT64
|
114
|
+
|
115
|
+
TYPE_INT32
|
116
|
+
TYPE_FIXED64
|
117
|
+
TYPE_FIXED32
|
118
|
+
TYPE_BOOL
|
119
|
+
TYPE_STRING
|
120
|
+
|
121
|
+
TYPE_GROUP
|
122
|
+
|
123
|
+
TYPE_MESSAGE
|
124
|
+
|
125
|
+
TYPE_BYTES
|
126
|
+
TYPE_UINT32
|
127
|
+
TYPE_ENUM
|
128
|
+
|
129
|
+
|
130
|
+
TYPE_SINT32
|
131
|
+
TYPE_SINT64"C
|
132
|
+
Label
|
133
|
+
LABEL_OPTIONAL
|
134
|
+
LABEL_REQUIRED
|
135
|
+
LABEL_REPEATED"T
|
136
|
+
OneofDescriptorProto
|
137
|
+
name ( .
|
138
|
+
options (2.google.protobuf.OneofOptions"�
|
139
|
+
EnumDescriptorProto
|
140
|
+
name ( 8
|
141
|
+
value (2).google.protobuf.EnumValueDescriptorProto-
|
142
|
+
options (2.google.protobuf.EnumOptionsN
|
143
|
+
reserved_range (26.google.protobuf.EnumDescriptorProto.EnumReservedRange
|
144
|
+
|
145
|
+
EnumReservedRange
|
146
|
+
start (
|
147
|
+
end ("l
|
148
|
+
EnumValueDescriptorProto
|
149
|
+
name (
|
150
|
+
number (2
|
151
|
+
options (2!.google.protobuf.EnumValueOptions"�
|
152
|
+
ServiceDescriptorProto
|
153
|
+
name ( 6
|
154
|
+
method (2&.google.protobuf.MethodDescriptorProto0
|
155
|
+
options (2.google.protobuf.ServiceOptions"�
|
156
|
+
MethodDescriptorProto
|
157
|
+
name (
|
158
|
+
|
159
|
+
input_type (
|
160
|
+
output_type ( /
|
161
|
+
options (2.google.protobuf.MethodOptions
|
162
|
+
client_streaming (:false
|
163
|
+
server_streaming (:false"�
|
164
|
+
FileOptions
|
165
|
+
java_package (
|
166
|
+
java_outer_classname ( "
|
167
|
+
java_multiple_files
|
168
|
+
(:false)
|
169
|
+
java_generate_equals_and_hash (B%
|
170
|
+
java_string_check_utf8 (:falseF
|
171
|
+
optimize_for (2).google.protobuf.FileOptions.OptimizeMode:SPEED
|
172
|
+
|
173
|
+
go_package ( "
|
174
|
+
cc_generic_services (:false$
|
175
|
+
java_generic_services (:false"
|
176
|
+
py_generic_services (:false#
|
177
|
+
php_generic_services* (:false
|
178
|
+
|
179
|
+
deprecated (:false
|
180
|
+
cc_enable_arenas (:true
|
181
|
+
objc_class_prefix$ (
|
182
|
+
csharp_namespace% (
|
183
|
+
swift_prefix' (
|
184
|
+
php_class_prefix( (
|
185
|
+
|
186
|
+
php_metadata_namespace, (
|
187
|
+
ruby_package- ( C
|
188
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption":
|
189
|
+
OptimizeMode
|
190
|
+
SPEED
|
191
|
+
CODE_SIZE
|
192
|
+
LITE_RUNTIME* �����J&'"�
|
193
|
+
MessageOptions&
|
194
|
+
message_set_wire_format (:false.
|
195
|
+
no_standard_descriptor_accessor (:false
|
196
|
+
|
197
|
+
deprecated (:false
|
198
|
+
map_entry (2
|
199
|
+
&deprecated_legacy_json_field_conflicts (BC
|
200
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����JJJJ J
|
201
|
+
"�
|
202
|
+
FieldOptions:
|
203
|
+
ctype (2#.google.protobuf.FieldOptions.CType:STRING
|
204
|
+
packed (?
|
205
|
+
jstype (2$.google.protobuf.FieldOptions.JSType: JS_NORMAL
|
206
|
+
lazy (:false
|
207
|
+
unverified_lazy (:false
|
208
|
+
|
209
|
+
deprecated (:false
|
210
|
+
weak
|
211
|
+
(:false
|
212
|
+
debug_redact (:false@
|
213
|
+
retention (2-.google.protobuf.FieldOptions.OptionRetention>
|
214
|
+
target (2..google.protobuf.FieldOptions.OptionTargetTypeC
|
215
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption"/
|
216
|
+
CType
|
217
|
+
|
218
|
+
STRING
|
219
|
+
CORD
|
220
|
+
STRING_PIECE"5
|
221
|
+
JSType
|
222
|
+
JS_NORMAL
|
223
|
+
JS_STRING
|
224
|
+
JS_NUMBER"U
|
225
|
+
OptionRetention
|
226
|
+
RETENTION_UNKNOWN
|
227
|
+
RETENTION_RUNTIME
|
228
|
+
RETENTION_SOURCE"�
|
229
|
+
OptionTargetType
|
230
|
+
TARGET_TYPE_UNKNOWN
|
231
|
+
TARGET_TYPE_FILE
|
232
|
+
TARGET_TYPE_EXTENSION_RANGE
|
233
|
+
TARGET_TYPE_MESSAGE
|
234
|
+
TARGET_TYPE_FIELD
|
235
|
+
TARGET_TYPE_ONEOF
|
236
|
+
TARGET_TYPE_ENUM
|
237
|
+
TARGET_TYPE_ENUM_ENTRY
|
238
|
+
TARGET_TYPE_SERVICE
|
239
|
+
TARGET_TYPE_METHOD * �����J"^
|
240
|
+
OneofOptionsC
|
241
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
242
|
+
EnumOptions
|
243
|
+
allow_alias (
|
244
|
+
|
245
|
+
deprecated (:false2
|
246
|
+
&deprecated_legacy_json_field_conflicts (BC
|
247
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����J"}
|
248
|
+
EnumValueOptions
|
249
|
+
|
250
|
+
deprecated (:falseC
|
251
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"{
|
252
|
+
ServiceOptions
|
253
|
+
|
254
|
+
deprecated! (:falseC
|
255
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption* �����"�
|
256
|
+
|
257
|
+
|
258
|
+
deprecated! (:false_
|
259
|
+
idempotency_level" (2/.google.protobuf.MethodOptions.IdempotencyLevel:IDEMPOTENCY_UNKNOWNC
|
260
|
+
uninterpreted_option� (2$.google.protobuf.UninterpretedOption"P
|
261
|
+
IdempotencyLevel
|
262
|
+
IDEMPOTENCY_UNKNOWN
|
263
|
+
NO_SIDE_EFFECTS
|
264
|
+
|
265
|
+
IDEMPOTENT* �����"�
|
266
|
+
UninterpretedOption;
|
267
|
+
name (2-.google.protobuf.UninterpretedOption.NamePart
|
268
|
+
identifier_value (
|
269
|
+
positive_int_value (
|
270
|
+
negative_int_value (
|
271
|
+
double_value (
|
272
|
+
string_value (
|
273
|
+
aggregate_value ( 3
|
274
|
+
NamePart
|
275
|
+
name_part (
|
276
|
+
is_extension ("�
|
277
|
+
SourceCodeInfo:
|
278
|
+
location (2(.google.protobuf.SourceCodeInfo.Location�
|
279
|
+
Location
|
280
|
+
path (B
|
281
|
+
span (B
|
282
|
+
leading_comments (
|
283
|
+
trailing_comments ( !
|
284
|
+
leading_detached_comments ( "�
|
285
|
+
GeneratedCodeInfoA
|
286
|
+
|
287
|
+
annotation (2-.google.protobuf.GeneratedCodeInfo.Annotation�
|
288
|
+
|
289
|
+
Annotation
|
290
|
+
path (B
|
291
|
+
source_file (
|
292
|
+
begin (
|
293
|
+
end (H
|
294
|
+
semantic (26.google.protobuf.GeneratedCodeInfo.Annotation.Semantic"(
|
295
|
+
Semantic
|
296
|
+
NONE
|
297
|
+
SET
|
298
|
+
ALIASB~
|
299
|
+
com.google.protobufBDescriptorProtosHZ-google.golang.org/protobuf/types/descriptorpb��GPB�Google.Protobuf.Reflection
|
File without changes
|
File without changes
|
File without changes
|
@@ -44,10 +44,15 @@ module Google
|
|
44
44
|
self.class.encode_json(self, options)
|
45
45
|
end
|
46
46
|
|
47
|
-
def to_proto
|
48
|
-
self.class.encode(self)
|
47
|
+
def to_proto(options = {})
|
48
|
+
self.class.encode(self, options)
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
52
|
+
class AbstractMessage
|
53
|
+
include MessageExts
|
54
|
+
extend MessageExts::ClassMethods
|
55
|
+
end
|
56
|
+
private_constant :AbstractMessage
|
52
57
|
end
|
53
58
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/protobuf/compiler/plugin.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/descriptor_pb'
|
7
|
+
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/protobuf/compiler/plugin.proto", :syntax => :proto2) do
|
10
|
+
add_message "google.protobuf.compiler.Version" do
|
11
|
+
optional :major, :int32, 1
|
12
|
+
optional :minor, :int32, 2
|
13
|
+
optional :patch, :int32, 3
|
14
|
+
optional :suffix, :string, 4
|
15
|
+
end
|
16
|
+
add_message "google.protobuf.compiler.CodeGeneratorRequest" do
|
17
|
+
repeated :file_to_generate, :string, 1
|
18
|
+
optional :parameter, :string, 2
|
19
|
+
repeated :proto_file, :message, 15, "google.protobuf.FileDescriptorProto"
|
20
|
+
optional :compiler_version, :message, 3, "google.protobuf.compiler.Version"
|
21
|
+
end
|
22
|
+
add_message "google.protobuf.compiler.CodeGeneratorResponse" do
|
23
|
+
optional :error, :string, 1
|
24
|
+
optional :supported_features, :uint64, 2
|
25
|
+
repeated :file, :message, 15, "google.protobuf.compiler.CodeGeneratorResponse.File"
|
26
|
+
end
|
27
|
+
add_message "google.protobuf.compiler.CodeGeneratorResponse.File" do
|
28
|
+
optional :name, :string, 1
|
29
|
+
optional :insertion_point, :string, 2
|
30
|
+
optional :content, :string, 15
|
31
|
+
optional :generated_code_info, :message, 16, "google.protobuf.GeneratedCodeInfo"
|
32
|
+
end
|
33
|
+
add_enum "google.protobuf.compiler.CodeGeneratorResponse.Feature" do
|
34
|
+
value :FEATURE_NONE, 0
|
35
|
+
value :FEATURE_PROTO3_OPTIONAL, 1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Google
|
41
|
+
module Protobuf
|
42
|
+
module Compiler
|
43
|
+
Version = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.compiler.Version").msgclass
|
44
|
+
CodeGeneratorRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.compiler.CodeGeneratorRequest").msgclass
|
45
|
+
CodeGeneratorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.compiler.CodeGeneratorResponse").msgclass
|
46
|
+
CodeGeneratorResponse::File = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.compiler.CodeGeneratorResponse.File").msgclass
|
47
|
+
CodeGeneratorResponse::Feature = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.compiler.CodeGeneratorResponse.Feature").enummodule
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -79,12 +79,25 @@ module Google
|
|
79
79
|
|
80
80
|
|
81
81
|
def first(n=nil)
|
82
|
-
n
|
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
|
83
89
|
end
|
84
90
|
|
85
91
|
|
86
92
|
def last(n=nil)
|
87
|
-
n
|
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
|
88
101
|
end
|
89
102
|
|
90
103
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,6 +5,7 @@ require 'google/protobuf'
|
|
5
5
|
|
6
6
|
require 'google/protobuf/any_pb'
|
7
7
|
require 'google/protobuf/source_context_pb'
|
8
|
+
|
8
9
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
10
|
add_file("google/protobuf/type.proto", :syntax => :proto3) do
|
10
11
|
add_message "google.protobuf.Type" do
|
@@ -82,9 +82,14 @@ module Google
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
def self.from_time(time)
|
86
|
+
new.from_time(time)
|
87
|
+
end
|
88
|
+
|
85
89
|
def from_time(time)
|
86
90
|
self.seconds = time.to_i
|
87
91
|
self.nanos = time.nsec
|
92
|
+
self
|
88
93
|
end
|
89
94
|
|
90
95
|
def to_i
|
@@ -132,10 +137,14 @@ module Google
|
|
132
137
|
end
|
133
138
|
end
|
134
139
|
|
140
|
+
def self.from_ruby(value)
|
141
|
+
self.new.from_ruby(value)
|
142
|
+
end
|
143
|
+
|
135
144
|
def from_ruby(value)
|
136
145
|
case value
|
137
146
|
when NilClass
|
138
|
-
self.null_value =
|
147
|
+
self.null_value = :NULL_VALUE
|
139
148
|
when Numeric
|
140
149
|
self.number_value = value
|
141
150
|
when String
|
@@ -155,6 +164,8 @@ module Google
|
|
155
164
|
else
|
156
165
|
raise UnexpectedStructType
|
157
166
|
end
|
167
|
+
|
168
|
+
self
|
158
169
|
end
|
159
170
|
end
|
160
171
|
|
@@ -225,6 +236,5 @@ module Google
|
|
225
236
|
ret
|
226
237
|
end
|
227
238
|
end
|
228
|
-
|
229
239
|
end
|
230
240
|
end
|
File without changes
|
data/lib/google/protobuf.rb
CHANGED
@@ -51,92 +51,24 @@ else
|
|
51
51
|
require 'google/protobuf_c'
|
52
52
|
end
|
53
53
|
|
54
|
-
module Google
|
55
|
-
module Protobuf
|
56
|
-
module Internal
|
57
|
-
def self.infer_package(names)
|
58
|
-
# Package is longest common prefix ending in '.', if any.
|
59
|
-
if not names.empty?
|
60
|
-
min, max = names.minmax
|
61
|
-
last_common_dot = nil
|
62
|
-
min.size.times { |i|
|
63
|
-
if min[i] != max[i] then break end
|
64
|
-
if min[i] == ?. then last_common_dot = i end
|
65
|
-
}
|
66
|
-
if last_common_dot
|
67
|
-
return min.slice(0, last_common_dot)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
nil
|
72
|
-
end
|
73
|
-
|
74
|
-
class NestingBuilder
|
75
|
-
def initialize(msg_names, enum_names)
|
76
|
-
@to_pos = {nil=>nil}
|
77
|
-
@msg_children = Hash.new { |hash, key| hash[key] = [] }
|
78
|
-
@enum_children = Hash.new { |hash, key| hash[key] = [] }
|
79
|
-
|
80
|
-
msg_names.each_with_index { |name, idx| @to_pos[name] = idx }
|
81
|
-
enum_names.each_with_index { |name, idx| @to_pos[name] = idx }
|
82
|
-
|
83
|
-
msg_names.each { |name| @msg_children[parent(name)] << name }
|
84
|
-
enum_names.each { |name| @enum_children[parent(name)] << name }
|
85
|
-
end
|
86
|
-
|
87
|
-
def build(package)
|
88
|
-
return build_msg(package)
|
89
|
-
end
|
90
|
-
|
91
|
-
private
|
92
|
-
def build_msg(msg)
|
93
|
-
return {
|
94
|
-
:pos => @to_pos[msg],
|
95
|
-
:msgs => @msg_children[msg].map { |child| build_msg(child) },
|
96
|
-
:enums => @enum_children[msg].map { |child| @to_pos[child] },
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
def parent(name)
|
102
|
-
idx = name.rindex(?.)
|
103
|
-
if idx
|
104
|
-
return name.slice(0, idx)
|
105
|
-
else
|
106
|
-
return nil
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.fixup_descriptor(package, msg_names, enum_names)
|
112
|
-
if package.nil?
|
113
|
-
package = self.infer_package(msg_names + enum_names)
|
114
|
-
end
|
115
|
-
|
116
|
-
nesting = NestingBuilder.new(msg_names, enum_names).build(package)
|
117
|
-
|
118
|
-
return package, nesting
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
54
|
end
|
124
55
|
|
56
|
+
require 'google/protobuf/descriptor_dsl'
|
125
57
|
require 'google/protobuf/repeated_field'
|
126
58
|
|
127
59
|
module Google
|
128
60
|
module Protobuf
|
129
61
|
|
130
|
-
def self.encode(msg)
|
131
|
-
msg.to_proto
|
62
|
+
def self.encode(msg, options = {})
|
63
|
+
msg.to_proto(options)
|
132
64
|
end
|
133
65
|
|
134
66
|
def self.encode_json(msg, options = {})
|
135
67
|
msg.to_json(options)
|
136
68
|
end
|
137
69
|
|
138
|
-
def self.decode(klass, proto)
|
139
|
-
klass.decode(proto)
|
70
|
+
def self.decode(klass, proto, options = {})
|
71
|
+
klass.decode(proto, options)
|
140
72
|
end
|
141
73
|
|
142
74
|
def self.decode_json(klass, json, options = {})
|