Add generator option to configure #include directives.
[apps/agl-service-can-low-level.git] / generator / nanopb.proto
1 // Custom options for defining:
2 // - Maximum size of string/bytes
3 // - Maximum number of elements in array
4 //
5 // These are used by nanopb to generate statically allocable structures
6 // for memory-limited environments.
7
8 import "google/protobuf/descriptor.proto";
9
10 option java_package = "fi.kapsi.koti.jpa.nanopb";
11
12 enum FieldType {
13     FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
14     FT_CALLBACK = 1; // Always generate a callback field.
15     FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
16     FT_IGNORE = 3; // Ignore the field completely.
17 }
18
19 message NanoPBOptions {
20   // Allocated size for 'bytes' and 'string' fields.
21   optional int32 max_size = 1;
22   
23   // Allocated number of entries in arrays ('repeated' fields)
24   optional int32 max_count = 2;
25   
26   // Force type of field (callback or static allocation)
27   optional FieldType type = 3 [default = FT_DEFAULT];
28   
29   // Use long names for enums, i.e. EnumName_EnumValue.
30   optional bool long_names = 4 [default = true];
31   
32   // Add 'packed' attribute to generated structs.
33   optional bool packed_struct = 5 [default = false];
34 }
35
36 // Protocol Buffers extension number registry
37 // --------------------------------
38 // Project:  Nanopb
39 // Contact:  Petteri Aimonen <jpa@kapsi.fi>
40 // Web site: http://kapsi.fi/~jpa/nanopb
41 // Extensions: 1010 (all types)
42 // --------------------------------
43
44 extend google.protobuf.FileOptions {
45     optional NanoPBOptions nanopb_fileopt = 1010;
46 }
47
48 extend google.protobuf.MessageOptions {
49     optional NanoPBOptions nanopb_msgopt = 1010;
50 }
51
52 extend google.protobuf.EnumOptions {
53     optional NanoPBOptions nanopb_enumopt = 1010;
54 }
55
56 extend google.protobuf.FieldOptions {
57     optional NanoPBOptions nanopb = 1010;
58 }
59
60