aboutsummaryrefslogtreecommitdiff
path: root/protos
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-10-01 11:54:31 -0500
committerrogerk <devnull@localhost>2011-10-01 11:54:31 -0500
commit041233adc6737d514159046a3c730e39a4b10215 (patch)
tree04e9961b66b38b364c286c09e1c402519b614640 /protos
parenta14aa642ab71b7a540575fde7803cc755f03bf1f (diff)
downloadprotobuf-041233adc6737d514159046a3c730e39a4b10215.tar.gz
protobuf-041233adc6737d514159046a3c730e39a4b10215.tar.bz2
protobuf-041233adc6737d514159046a3c730e39a4b10215.zip
Import of protoc 2.4.1 and associated proto changes
Diffstat (limited to 'protos')
-rw-r--r--protos/google/protobuf/descriptor.proto114
-rw-r--r--protos/google/protobuf/unittest.proto39
-rw-r--r--protos/google/protobuf/unittest_custom_options.proto91
-rw-r--r--protos/google/protobuf/unittest_lite.proto38
-rw-r--r--protos/google/protobuf/unittest_no_generic_services.proto4
5 files changed, 217 insertions, 69 deletions
diff --git a/protos/google/protobuf/descriptor.proto b/protos/google/protobuf/descriptor.proto
index cc04aa8e..233f8794 100644
--- a/protos/google/protobuf/descriptor.proto
+++ b/protos/google/protobuf/descriptor.proto
@@ -67,6 +67,12 @@ message FileDescriptorProto {
repeated FieldDescriptorProto extension = 7;
optional FileOptions options = 8;
+
+ // This field contains optional information about the original source code.
+ // You may safely remove this entire field whithout harming runtime
+ // functionality of the descriptors -- the information is needed only by
+ // development tools.
+ optional SourceCodeInfo source_code_info = 9;
}
// Describes a message type.
@@ -245,6 +251,12 @@ message FileOptions {
// top-level extensions defined in the file.
optional bool java_multiple_files = 10 [default=false];
+ // If set true, then the Java code generator will generate equals() and
+ // hashCode() methods for all messages defined in the .proto file. This is
+ // purely a speed optimization, as the AbstractMessage base class includes
+ // reflection-based implementations of these methods.
+ optional bool java_generate_equals_and_hash = 20 [default=false];
+
// Generated classes can be optimized for speed or code size.
enum OptimizeMode {
SPEED = 1; // Generate complete code for parsing, serialization,
@@ -264,13 +276,12 @@ message FileOptions {
// early versions of proto2.
//
// Generic services are now considered deprecated in favor of using plugins
- // that generate code specific to your particular RPC system. If you are
- // using such a plugin, set these to false. In the future, we may change
- // the default to false, so if you explicitly want generic services, you
- // should explicitly set these to true.
- optional bool cc_generic_services = 16 [default=true];
- optional bool java_generic_services = 17 [default=true];
- optional bool py_generic_services = 18 [default=true];
+ // that generate code specific to your particular RPC system. Therefore,
+ // these default to false. Old code which depends on generic services should
+ // explicitly set them to true.
+ optional bool cc_generic_services = 16 [default=false];
+ optional bool java_generic_services = 17 [default=false];
+ optional bool py_generic_services = 18 [default=false];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
@@ -430,4 +441,93 @@ message UninterpretedOption {
optional int64 negative_int_value = 5;
optional double double_value = 6;
optional bytes string_value = 7;
+ optional string aggregate_value = 8;
+}
+
+// ===================================================================
+// Optional source code info
+
+// Encapsulates information about the original source file from which a
+// FileDescriptorProto was generated.
+message SourceCodeInfo {
+ // A Location identifies a piece of source code in a .proto file which
+ // corresponds to a particular definition. This information is intended
+ // to be useful to IDEs, code indexers, documentation generators, and similar
+ // tools.
+ //
+ // For example, say we have a file like:
+ // message Foo {
+ // optional string foo = 1;
+ // }
+ // Let's look at just the field definition:
+ // optional string foo = 1;
+ // ^ ^^ ^^ ^ ^^^
+ // a bc de f ghi
+ // We have the following locations:
+ // span path represents
+ // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
+ // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
+ // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
+ // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
+ // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
+ //
+ // Notes:
+ // - A location may refer to a repeated field itself (i.e. not to any
+ // particular index within it). This is used whenever a set of elements are
+ // logically enclosed in a single code segment. For example, an entire
+ // extend block (possibly containing multiple extension definitions) will
+ // have an outer location whose path refers to the "extensions" repeated
+ // field without an index.
+ // - Multiple locations may have the same path. This happens when a single
+ // logical declaration is spread out across multiple places. The most
+ // obvious example is the "extend" block again -- there may be multiple
+ // extend blocks in the same scope, each of which will have the same path.
+ // - A location's span is not always a subset of its parent's span. For
+ // example, the "extendee" of an extension declaration appears at the
+ // beginning of the "extend" block and is shared by all extensions within
+ // the block.
+ // - Just because a location's span is a subset of some other location's span
+ // does not mean that it is a descendent. For example, a "group" defines
+ // both a type and a field in a single declaration. Thus, the locations
+ // corresponding to the type and field and their components will overlap.
+ // - Code which tries to interpret locations should probably be designed to
+ // ignore those that it doesn't understand, as more types of locations could
+ // be recorded in the future.
+ repeated Location location = 1;
+ message Location {
+ // Identifies which part of the FileDescriptorProto was defined at this
+ // location.
+ //
+ // Each element is a field number or an index. They form a path from
+ // the root FileDescriptorProto to the place where the definition. For
+ // example, this path:
+ // [ 4, 3, 2, 7, 1 ]
+ // refers to:
+ // file.message_type(3) // 4, 3
+ // .field(7) // 2, 7
+ // .name() // 1
+ // This is because FileDescriptorProto.message_type has field number 4:
+ // repeated DescriptorProto message_type = 4;
+ // and DescriptorProto.field has field number 2:
+ // repeated FieldDescriptorProto field = 2;
+ // and FieldDescriptorProto.name has field number 1:
+ // optional string name = 1;
+ //
+ // Thus, the above path gives the location of a field name. If we removed
+ // the last element:
+ // [ 4, 3, 2, 7 ]
+ // this path refers to the whole field declaration (from the beginning
+ // of the label to the terminating semicolon).
+ repeated int32 path = 1 [packed=true];
+
+ // Always has exactly three or four elements: start line, start column,
+ // end line (optional, otherwise assumed same as start line), end column.
+ // These are packed into a single field for efficiency. Note that line
+ // and column numbers are zero-based -- typically you will want to add
+ // 1 to each before displaying to a user.
+ repeated int32 span = 2 [packed=true];
+
+ // TODO(kenton): Record comments appearing before and after the
+ // declaration.
+ }
}
diff --git a/protos/google/protobuf/unittest.proto b/protos/google/protobuf/unittest.proto
index a134e128..7f05cf80 100644
--- a/protos/google/protobuf/unittest.proto
+++ b/protos/google/protobuf/unittest.proto
@@ -41,6 +41,12 @@ option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestProto
// A proto file we will use for unit testing.
+// Some generic_services option(s) added automatically.
+// See: http://go/proto2-generic-services-default
+option cc_generic_services = true; // auto-added
+option java_generic_services = true; // auto-added
+option py_generic_services = true; // auto-added
+
import "google/protobuf/unittest_import.proto";
// We don't put this in a package within proto2 because we need to make sure
@@ -493,6 +499,17 @@ message TestExtremeDefaultValues {
optional float inf_float = 17 [default = inf];
optional float neg_inf_float = 18 [default = -inf];
optional float nan_float = 19 [default = nan];
+
+ // Tests for C++ trigraphs.
+ // Trigraphs should be escaped in C++ generated files, but they should not be
+ // escaped for other languages.
+ // Note that in .proto file, "\?" is a valid way to escape ? in string
+ // literals.
+ optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
+}
+
+message SparseEnumMessage {
+ optional TestSparseEnum sparse_enum = 1;
}
// Test String and Bytes: string is for valid UTF-8 strings
@@ -563,27 +580,6 @@ extend TestPackedExtensions {
repeated ForeignEnum packed_enum_extension = 103 [packed = true];
}
-message TestUnpackedExtensions {
- extensions 1 to max;
-}
-
-extend TestUnpackedExtensions {
- repeated int32 unpacked_int32_extension = 90;
- repeated int64 unpacked_int64_extension = 91;
- repeated uint32 unpacked_uint32_extension = 92;
- repeated uint64 unpacked_uint64_extension = 93;
- repeated sint32 unpacked_sint32_extension = 94;
- repeated sint64 unpacked_sint64_extension = 95;
- repeated fixed32 unpacked_fixed32_extension = 96;
- repeated fixed64 unpacked_fixed64_extension = 97;
- repeated sfixed32 unpacked_sfixed32_extension = 98;
- repeated sfixed64 unpacked_sfixed64_extension = 99;
- repeated float unpacked_float_extension = 100;
- repeated double unpacked_double_extension = 101;
- repeated bool unpacked_bool_extension = 102;
- repeated ForeignEnum unpacked_enum_extension = 103;
-}
-
// Used by ExtensionSetTest/DynamicExtensions. The test actually builds
// a set of extensions to TestAllExtensions dynamically, based on the fields
// of this message type.
@@ -625,6 +621,7 @@ message TestRepeatedScalarDifferentTagSizes {
repeated uint64 repeated_uint64 = 262143;
}
+
// Test that RPC services work.
message FooRequest {}
message FooResponse {}
diff --git a/protos/google/protobuf/unittest_custom_options.proto b/protos/google/protobuf/unittest_custom_options.proto
index 27ff47c2..1ff6946a 100644
--- a/protos/google/protobuf/unittest_custom_options.proto
+++ b/protos/google/protobuf/unittest_custom_options.proto
@@ -41,6 +41,12 @@ option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestCusto
// A proto file used to test the "custom options" feature of proto2.
+// Some generic_services option(s) added automatically.
+// See: http://go/proto2-generic-services-default
+option cc_generic_services = true; // auto-added
+option java_generic_services = true; // auto-added
+option py_generic_services = true;
+
// A custom file option (defined below).
option (file_opt1) = 9876543210;
@@ -279,3 +285,88 @@ message VariousComplexOptions {
option (complex_opt3).complexoptiontype5.plugh = 22;
option (complexopt6).xyzzy = 24;
}
+
+// ------------------------------------------------------
+// Definitions for testing aggregate option parsing.
+// See descriptor_unittest.cc.
+
+message AggregateMessageSet {
+ option message_set_wire_format = true;
+ extensions 4 to max;
+}
+
+message AggregateMessageSetElement {
+ extend AggregateMessageSet {
+ optional AggregateMessageSetElement message_set_extension = 15447542;
+ }
+ optional string s = 1;
+}
+
+// A helper type used to test aggregate option parsing
+message Aggregate {
+ optional int32 i = 1;
+ optional string s = 2;
+
+ // A nested object
+ optional Aggregate sub = 3;
+
+ // To test the parsing of extensions inside aggregate values
+ optional google.protobuf.FileOptions file = 4;
+ extend google.protobuf.FileOptions {
+ optional Aggregate nested = 15476903;
+ }
+
+ // An embedded message set
+ optional AggregateMessageSet mset = 5;
+}
+
+// Allow Aggregate to be used as an option at all possible locations
+// in the .proto grammer.
+extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; }
+extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; }
+extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; }
+extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; }
+extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
+extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; }
+extend google.protobuf.MethodOptions { optional Aggregate methodopt = 15512713; }
+
+// Try using AggregateOption at different points in the proto grammar
+option (fileopt) = {
+ s: 'FileAnnotation'
+ // Also test the handling of comments
+ /* of both types */ i: 100
+
+ sub { s: 'NestedFileAnnotation' }
+
+ // Include a google.protobuf.FileOptions and recursively extend it with
+ // another fileopt.
+ file {
+ [protobuf_unittest.fileopt] {
+ s:'FileExtensionAnnotation'
+ }
+ }
+
+ // A message set inside an option value
+ mset {
+ [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
+ s: 'EmbeddedMessageSetElement'
+ }
+ }
+};
+
+message AggregateMessage {
+ option (msgopt) = { i:101 s:'MessageAnnotation' };
+ optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }];
+}
+
+service AggregateService {
+ option (serviceopt) = { s:'ServiceAnnotation' };
+ rpc Method (AggregateMessage) returns (AggregateMessage) {
+ option (methodopt) = { s:'MethodAnnotation' };
+ }
+}
+
+enum AggregateEnum {
+ option (enumopt) = { s:'EnumAnnotation' };
+ VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
+}
diff --git a/protos/google/protobuf/unittest_lite.proto b/protos/google/protobuf/unittest_lite.proto
index 63e0311c..823fa1dd 100644
--- a/protos/google/protobuf/unittest_lite.proto
+++ b/protos/google/protobuf/unittest_lite.proto
@@ -178,23 +178,6 @@ message TestPackedTypesLite {
repeated ForeignEnumLite packed_enum = 103 [packed = true];
}
-message TestUnpackedTypesLite {
- repeated int32 unpacked_int32 = 90;
- repeated int64 unpacked_int64 = 91;
- repeated uint32 unpacked_uint32 = 92;
- repeated uint64 unpacked_uint64 = 93;
- repeated sint32 unpacked_sint32 = 94;
- repeated sint64 unpacked_sint64 = 95;
- repeated fixed32 unpacked_fixed32 = 96;
- repeated fixed64 unpacked_fixed64 = 97;
- repeated sfixed32 unpacked_sfixed32 = 98;
- repeated sfixed64 unpacked_sfixed64 = 99;
- repeated float unpacked_float = 100;
- repeated double unpacked_double = 101;
- repeated bool unpacked_bool = 102;
- repeated ForeignEnumLite unpacked_enum = 103;
-}
-
message TestAllExtensionsLite {
extensions 1 to max;
}
@@ -322,27 +305,6 @@ extend TestPackedExtensionsLite {
repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
}
-message TestUnpackedExtensionsLite {
- extensions 1 to max;
-}
-
-extend TestUnpackedExtensionsLite {
- repeated int32 unpacked_int32_extension_lite = 90;
- repeated int64 unpacked_int64_extension_lite = 91;
- repeated uint32 unpacked_uint32_extension_lite = 92;
- repeated uint64 unpacked_uint64_extension_lite = 93;
- repeated sint32 unpacked_sint32_extension_lite = 94;
- repeated sint64 unpacked_sint64_extension_lite = 95;
- repeated fixed32 unpacked_fixed32_extension_lite = 96;
- repeated fixed64 unpacked_fixed64_extension_lite = 97;
- repeated sfixed32 unpacked_sfixed32_extension_lite = 98;
- repeated sfixed64 unpacked_sfixed64_extension_lite = 99;
- repeated float unpacked_float_extension_lite = 100;
- repeated double unpacked_double_extension_lite = 101;
- repeated bool unpacked_bool_extension_lite = 102;
- repeated ForeignEnumLite unpacked_enum_extension_lite = 103;
-}
-
message TestNestedExtensionLite {
extend TestAllExtensionsLite {
optional int32 nested_extension = 12345;
diff --git a/protos/google/protobuf/unittest_no_generic_services.proto b/protos/google/protobuf/unittest_no_generic_services.proto
index 3f7af0b8..5ab533bf 100644
--- a/protos/google/protobuf/unittest_no_generic_services.proto
+++ b/protos/google/protobuf/unittest_no_generic_services.proto
@@ -38,9 +38,7 @@ option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestNoGen
package google.protobuf.no_generic_services_test;
-option cc_generic_services = false;
-option java_generic_services = false;
-option py_generic_services = false;
+// *_generic_services are false by default.
message TestMessage {
optional int32 a = 1;