aboutsummaryrefslogtreecommitdiff
path: root/protos
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2008-11-24 16:09:39 +0000
committerJon Skeet <skeet@pobox.com>2008-11-24 16:09:39 +0000
commit3f225111007e39c5d34c76d015c23596bf934658 (patch)
tree79c63014adc56306b46db1956dadd2e382978e87 /protos
parent828510cdbda47eff58682fd62c9166c39194810c (diff)
downloadprotobuf-3f225111007e39c5d34c76d015c23596bf934658.tar.gz
protobuf-3f225111007e39c5d34c76d015c23596bf934658.tar.bz2
protobuf-3f225111007e39c5d34c76d015c23596bf934658.zip
Added address book example
Diffstat (limited to 'protos')
-rw-r--r--protos/tutorial/addressbook.proto33
1 files changed, 33 insertions, 0 deletions
diff --git a/protos/tutorial/addressbook.proto b/protos/tutorial/addressbook.proto
new file mode 100644
index 00000000..293590a6
--- /dev/null
+++ b/protos/tutorial/addressbook.proto
@@ -0,0 +1,33 @@
+import "google/protobuf/csharp_options.proto";
+import "google/protobuf/descriptor.proto";
+
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.Examples.AddressBook";
+option (google.protobuf.csharp_file_options).umbrella_classname = "AddressBookProtos";
+
+package tutorial;
+
+option optimize_for = SPEED;
+
+message Person {
+ required string name = 1;
+ required int32 id = 2; // Unique ID number for this person.
+ optional string email = 3;
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+}
+
+// Our address book file is just one of these.
+message AddressBook {
+ repeated Person person = 1;
+}