Home | History | Annotate | Download | only in example_proto
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 syntax = "proto2";
     18 option optimize_for = LITE_RUNTIME;
     19 
     20 package foo.bar;
     21 
     22 import "src/protozero/test/example_proto/library.proto";
     23 
     24 // This file contains comprehensive set of supported message structures and
     25 // data types. Unit tests depends on the plugin-processed version of this file.
     26 
     27 // Tests importing message definition from another proto file.
     28 message TransgalacticParcel {
     29   optional TransgalacticMessage message = 1;
     30   optional string tracking_code = 2;
     31 }
     32 
     33 enum SmallEnum {
     34   TO_BE = 1;
     35   NOT_TO_BE = 0;
     36 }
     37 
     38 enum SignedEnum {
     39   POSITIVE = 1;
     40   NEUTRAL = 0;
     41   NEGATIVE = -1;
     42 }
     43 
     44 enum BigEnum {
     45   BEGIN = 10;
     46   END = 100500;
     47 }
     48 
     49 message EveryField {
     50   optional int32 field_int32 = 1;
     51   optional int64 field_int64 = 2;
     52   optional uint32 field_uint32 = 3;
     53   optional uint64 field_uint64 = 4;
     54   optional sint32 field_sint32 = 5;
     55   optional sint64 field_sint64 = 6;
     56   optional fixed32 field_fixed32 = 7;
     57   optional fixed64 field_fixed64 = 8;
     58   optional sfixed32 field_sfixed32 = 9;
     59   optional sfixed64 field_sfixed64 = 10;
     60   optional float field_float = 11;
     61   optional double field_double = 12;
     62   optional bool field_bool = 13;
     63 
     64   optional SmallEnum small_enum = 51;
     65   optional SignedEnum signed_enum = 52;
     66   optional BigEnum big_enum = 53;
     67 
     68   optional string field_string = 500;
     69   optional bytes field_bytes = 505;
     70 
     71   enum NestedEnum {
     72     PING = 1;
     73     PONG = 2;
     74   }
     75   optional NestedEnum nested_enum = 600;
     76 
     77   repeated int32 repeated_int32 = 999;
     78 }
     79 
     80 message NestedA {
     81   message NestedB {
     82     message NestedC { optional int32 value_c = 1; }
     83     optional NestedC value_b = 1;
     84   }
     85   repeated NestedB repeated_a = 2;
     86   optional NestedB.NestedC super_nested = 3;
     87 }
     88 
     89 message CamelCaseFields {
     90   // To check that any reasonable name converts to camel case correctly.
     91   optional bool foo_bar_baz = 1;
     92   optional bool barBaz = 2;
     93   optional bool MooMoo = 3;
     94   optional bool URLEncoder = 4;
     95   optional bool XMap = 5;
     96   optional bool UrLE_nco__der = 6;
     97   optional bool __bigBang = 7;
     98   optional bool U2 = 8;
     99   optional bool bangBig__ = 9;
    100 }
    101