X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=generator%2Fnanopb.proto;h=7b73c7b377623f84e84e351f3d110075d3423f0c;hb=6f8dbc73eb3e595934751f5b33c7f61a902e946a;hp=e7bea139577acc10cf28b0b31008215c30b79368;hpb=0ee4bb96b1e53d16a29869864eff87c8934894ae;p=apps%2Fagl-service-can-low-level.git diff --git a/generator/nanopb.proto b/generator/nanopb.proto index e7bea139..7b73c7b3 100644 --- a/generator/nanopb.proto +++ b/generator/nanopb.proto @@ -7,25 +7,45 @@ import "google/protobuf/descriptor.proto"; +option java_package = "fi.kapsi.koti.jpa.nanopb"; + enum FieldType { FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible. FT_CALLBACK = 1; // Always generate a callback field. FT_STATIC = 2; // Generate a static field or raise an exception if not possible. + FT_IGNORE = 3; // Ignore the field completely. } +// This is the inner options message, which basically defines options for +// a field. When it is used in message or file scope, it applies to all +// fields. message NanoPBOptions { + // Allocated size for 'bytes' and 'string' fields. optional int32 max_size = 1; + + // Allocated number of entries in arrays ('repeated' fields) optional int32 max_count = 2; + + // Force type of field (callback or static allocation) optional FieldType type = 3 [default = FT_DEFAULT]; + + // Use long names for enums, i.e. EnumName_EnumValue. + optional bool long_names = 4 [default = true]; + + // Add 'packed' attribute to generated structs. + optional bool packed_struct = 5 [default = false]; } +// Extensions to protoc 'Descriptor' type in order to define options +// inside a .proto file. +// // Protocol Buffers extension number registry -// -------------------------------- -// Project: Nanopb -// Contact: Petteri Aimonen -// Web site: http://kapsi.fi/~jpa/nanopb -// Extensions: 1010 (all types) -// -------------------------------- +// -------------------------------- +// Project: Nanopb +// Contact: Petteri Aimonen +// Web site: http://kapsi.fi/~jpa/nanopb +// Extensions: 1010 (all types) +// -------------------------------- extend google.protobuf.FileOptions { optional NanoPBOptions nanopb_fileopt = 1010; @@ -35,7 +55,12 @@ extend google.protobuf.MessageOptions { optional NanoPBOptions nanopb_msgopt = 1010; } +extend google.protobuf.EnumOptions { + optional NanoPBOptions nanopb_enumopt = 1010; +} + extend google.protobuf.FieldOptions { optional NanoPBOptions nanopb = 1010; } +