~ubuntu-branches/ubuntu/trusty/protobuf/trusty-proposed

« back to all changes in this revision

Viewing changes to src/google/protobuf/unittest_custom_options.proto

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-31 14:41:47 UTC
  • mfrom: (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110531144147-s41g5fozgvyo462l
Tags: 2.4.0a-2ubuntu1
* Merge with Debian; remaining changes:
  - Fix linking with -lpthread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
// A proto file used to test the "custom options" feature of proto2.
36
36
 
37
37
 
 
38
// Some generic_services option(s) added automatically.
 
39
// See:  http://go/proto2-generic-services-default
 
40
option cc_generic_services = true;     // auto-added
 
41
option java_generic_services = true;   // auto-added
 
42
option py_generic_services = true;
 
43
 
38
44
// A custom file option (defined below).
39
45
option (file_opt1) = 9876543210;
40
46
 
273
279
  option (complex_opt3).complexoptiontype5.plugh = 22;
274
280
  option (complexopt6).xyzzy = 24;
275
281
}
 
282
 
 
283
// ------------------------------------------------------
 
284
// Definitions for testing aggregate option parsing.
 
285
// See descriptor_unittest.cc.
 
286
 
 
287
message AggregateMessageSet {
 
288
  option message_set_wire_format = true;
 
289
  extensions 4 to max;
 
290
}
 
291
 
 
292
message AggregateMessageSetElement {
 
293
  extend AggregateMessageSet {
 
294
    optional AggregateMessageSetElement message_set_extension = 15447542;
 
295
  }
 
296
  optional string s = 1;
 
297
}
 
298
 
 
299
// A helper type used to test aggregate option parsing
 
300
message Aggregate {
 
301
  optional int32 i = 1;
 
302
  optional string s = 2;
 
303
 
 
304
  // A nested object
 
305
  optional Aggregate sub = 3;
 
306
 
 
307
  // To test the parsing of extensions inside aggregate values
 
308
  optional google.protobuf.FileOptions file = 4;
 
309
  extend google.protobuf.FileOptions {
 
310
    optional Aggregate nested = 15476903;
 
311
  }
 
312
 
 
313
  // An embedded message set
 
314
  optional AggregateMessageSet mset = 5;
 
315
}
 
316
 
 
317
// Allow Aggregate to be used as an option at all possible locations
 
318
// in the .proto grammer.
 
319
extend google.protobuf.FileOptions      { optional Aggregate fileopt    = 15478479; }
 
320
extend google.protobuf.MessageOptions   { optional Aggregate msgopt     = 15480088; }
 
321
extend google.protobuf.FieldOptions     { optional Aggregate fieldopt   = 15481374; }
 
322
extend google.protobuf.EnumOptions      { optional Aggregate enumopt    = 15483218; }
 
323
extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
 
324
extend google.protobuf.ServiceOptions   { optional Aggregate serviceopt = 15497145; }
 
325
extend google.protobuf.MethodOptions    { optional Aggregate methodopt  = 15512713; }
 
326
 
 
327
// Try using AggregateOption at different points in the proto grammar
 
328
option (fileopt) = {
 
329
  s: 'FileAnnotation'
 
330
  // Also test the handling of comments
 
331
  /* of both types */ i: 100
 
332
 
 
333
  sub { s: 'NestedFileAnnotation' }
 
334
 
 
335
  // Include a google.protobuf.FileOptions and recursively extend it with
 
336
  // another fileopt.
 
337
  file {
 
338
    [protobuf_unittest.fileopt] {
 
339
      s:'FileExtensionAnnotation'
 
340
    }
 
341
  }
 
342
 
 
343
  // A message set inside an option value
 
344
  mset {
 
345
    [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
 
346
      s: 'EmbeddedMessageSetElement'
 
347
    }
 
348
  }
 
349
};
 
350
 
 
351
message AggregateMessage {
 
352
  option (msgopt) = { i:101 s:'MessageAnnotation' };
 
353
  optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }];
 
354
}
 
355
 
 
356
service AggregateService {
 
357
  option (serviceopt) = { s:'ServiceAnnotation' };
 
358
  rpc Method (AggregateMessage) returns (AggregateMessage) {
 
359
    option (methodopt) = { s:'MethodAnnotation' };
 
360
  }
 
361
}
 
362
 
 
363
enum AggregateEnum {
 
364
  option (enumopt) = { s:'EnumAnnotation' };
 
365
  VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
 
366
}