Add 'CAN-binder/libs/nanopb/' from commit '278ffb890e3d8722e4c7d824baaf221a1e375fc4'
[apps/agl-service-can-low-level.git] / CAN-binder / libs / nanopb / tests / options / options.proto
1 /* Test nanopb option parsing.
2  * options.expected lists the patterns that are searched for in the output.
3  */
4
5 syntax = "proto2";
6
7 import "nanopb.proto";
8
9 // File level options
10 option (nanopb_fileopt).max_size = 20;
11
12 message Message1
13 {
14     required string filesize = 1;
15 }
16
17 // Message level options
18 message Message2
19 {
20     option (nanopb_msgopt).max_size = 30;
21     required string msgsize = 1;
22 }
23
24 // Field level options
25 message Message3
26 {
27     option (nanopb_msgopt).msgid = 103;
28     required string fieldsize = 1 [(nanopb).max_size = 40];
29     required string fieldlen = 2 [(nanopb).max_length = 40];
30 }
31
32 // Forced callback field
33 message Message4
34 {
35     option (nanopb_msgopt).msgid = 104;
36     required int32 int32_callback = 1 [(nanopb).type = FT_CALLBACK];
37 }
38
39 // Short enum names
40 enum Enum1
41 {
42     option (nanopb_enumopt).long_names = false;
43     EnumValue1 = 1;
44     EnumValue2 = 2;
45 }
46
47 message EnumTest
48 {
49     required Enum1 field = 1 [default = EnumValue2];
50 }
51
52 // Short enum names inside message
53 message Message5
54 {
55     option (nanopb_msgopt).msgid = 105;
56     enum Enum2
57     {
58        option (nanopb_enumopt).long_names = false;
59        EnumValue1 = 1;
60     }
61     required Enum2 field = 1 [default = EnumValue1];
62 }
63
64 // Packed structure
65 message my_packed_struct
66 {
67     option (nanopb_msgopt).packed_struct = true;
68     optional int32 myfield = 1;
69 }
70
71 // Message with ignored field
72 message Message6
73 {
74     required int32 field1 = 1;
75     optional int32 skipped_field = 2 [(nanopb).type = FT_IGNORE];
76 }
77
78 // Message that is skipped
79 message SkippedMessage
80 {
81     option (nanopb_msgopt).skip_message = true;
82     required int32 foo = 1;
83 }
84
85 // Message with oneof field
86 message OneofMessage
87 {
88     oneof foo {
89         int32 bar = 1;
90     }
91 }
92
93 // Proto3-style optional field in proto2 file
94 message Proto3Field
95 {
96     optional int32 proto3field = 1 [(nanopb).proto3 = true];
97 }
98