222 lines
7.0 KiB
Python
222 lines
7.0 KiB
Python
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
# sources: nanopb.proto
|
|
# plugin: python-betterproto
|
|
# This file has been @generated
|
|
|
|
from dataclasses import dataclass
|
|
from typing import List
|
|
|
|
import betterproto
|
|
import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
|
|
|
|
|
|
class FieldType(betterproto.Enum):
|
|
FT_DEFAULT = 0
|
|
FT_CALLBACK = 1
|
|
FT_POINTER = 4
|
|
FT_STATIC = 2
|
|
FT_IGNORE = 3
|
|
FT_INLINE = 5
|
|
|
|
|
|
class IntSize(betterproto.Enum):
|
|
IS_DEFAULT = 0
|
|
IS_8 = 8
|
|
IS_16 = 16
|
|
IS_32 = 32
|
|
IS_64 = 64
|
|
|
|
|
|
class TypenameMangling(betterproto.Enum):
|
|
M_NONE = 0
|
|
M_STRIP_PACKAGE = 1
|
|
M_FLATTEN = 2
|
|
M_PACKAGE_INITIALS = 3
|
|
|
|
|
|
class DescriptorSize(betterproto.Enum):
|
|
DS_AUTO = 0
|
|
DS_1 = 1
|
|
DS_2 = 2
|
|
DS_4 = 4
|
|
DS_8 = 8
|
|
|
|
|
|
@dataclass(eq=False, repr=False)
|
|
class NanoPbOptions(betterproto.Message):
|
|
"""
|
|
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.
|
|
"""
|
|
|
|
max_size: int = betterproto.int32_field(1)
|
|
"""
|
|
Allocated size for 'bytes' and 'string' fields.
|
|
For string fields, this should include the space for null terminator.
|
|
"""
|
|
|
|
max_length: int = betterproto.int32_field(14)
|
|
"""
|
|
Maximum length for 'string' fields. Setting this is equivalent
|
|
to setting max_size to a value of length+1.
|
|
"""
|
|
|
|
max_count: int = betterproto.int32_field(2)
|
|
"""Allocated number of entries in arrays ('repeated' fields)"""
|
|
|
|
int_size: "IntSize" = betterproto.enum_field(7)
|
|
"""
|
|
Size of integer fields. Can save some memory if you don't need
|
|
full 32 bits for the value.
|
|
"""
|
|
|
|
enum_intsize: "IntSize" = betterproto.enum_field(34)
|
|
"""Size for enum fields. Supported by C++11 and C23 standards."""
|
|
|
|
type: "FieldType" = betterproto.enum_field(3)
|
|
"""Force type of field (callback or static allocation)"""
|
|
|
|
long_names: bool = betterproto.bool_field(4)
|
|
"""Use long names for enums, i.e. EnumName_EnumValue."""
|
|
|
|
packed_struct: bool = betterproto.bool_field(5)
|
|
"""
|
|
Add 'packed' attribute to generated structs.
|
|
Note: this cannot be used on CPUs that break on unaligned
|
|
accesses to variables.
|
|
"""
|
|
|
|
packed_enum: bool = betterproto.bool_field(10)
|
|
"""Add 'packed' attribute to generated enums."""
|
|
|
|
skip_message: bool = betterproto.bool_field(6)
|
|
"""Skip this message"""
|
|
|
|
no_unions: bool = betterproto.bool_field(8)
|
|
"""Generate oneof fields as normal optional fields instead of union."""
|
|
|
|
msgid: int = betterproto.uint32_field(9)
|
|
"""integer type tag for a message"""
|
|
|
|
anonymous_oneof: bool = betterproto.bool_field(11)
|
|
"""decode oneof as anonymous union"""
|
|
|
|
proto3: bool = betterproto.bool_field(12)
|
|
"""Proto3 singular field does not generate a "has_" flag"""
|
|
|
|
proto3_singular_msgs: bool = betterproto.bool_field(21)
|
|
"""
|
|
Force proto3 messages to have no "has_" flag.
|
|
This was default behavior until nanopb-0.4.0.
|
|
"""
|
|
|
|
enum_to_string: bool = betterproto.bool_field(13)
|
|
"""
|
|
Generate an enum->string mapping function (can take up lots of space).
|
|
"""
|
|
|
|
enum_validate: bool = betterproto.bool_field(32)
|
|
"""Generate validation methods for enums"""
|
|
|
|
fixed_length: bool = betterproto.bool_field(15)
|
|
"""Generate bytes arrays with fixed length"""
|
|
|
|
fixed_count: bool = betterproto.bool_field(16)
|
|
"""Generate repeated field with fixed count"""
|
|
|
|
submsg_callback: bool = betterproto.bool_field(22)
|
|
"""
|
|
Generate message-level callback that is called before decoding submessages.
|
|
This can be used to set callback fields for submsgs inside oneofs.
|
|
"""
|
|
|
|
mangle_names: "TypenameMangling" = betterproto.enum_field(17)
|
|
"""
|
|
Shorten or remove package names from type names.
|
|
This option applies only on the file level.
|
|
"""
|
|
|
|
callback_datatype: str = betterproto.string_field(18)
|
|
"""Data type for storage associated with callback fields."""
|
|
|
|
callback_function: str = betterproto.string_field(19)
|
|
"""
|
|
Callback function used for encoding and decoding.
|
|
Prior to nanopb-0.4.0, the callback was specified in per-field pb_callback_t
|
|
structure. This is still supported, but does not work inside e.g. oneof or pointer
|
|
fields. Instead, a new method allows specifying a per-message callback that
|
|
will be called for all callback fields in a message type.
|
|
"""
|
|
|
|
descriptorsize: "DescriptorSize" = betterproto.enum_field(20)
|
|
"""
|
|
Select the size of field descriptors. This option has to be defined
|
|
for the whole message, not per-field. Usually automatic selection is
|
|
ok, but if it results in compilation errors you can increase the field
|
|
size here.
|
|
"""
|
|
|
|
default_has: bool = betterproto.bool_field(23)
|
|
"""Set default value for has_ fields."""
|
|
|
|
include: List[str] = betterproto.string_field(24)
|
|
"""Extra files to include in generated `.pb.h`"""
|
|
|
|
exclude: List[str] = betterproto.string_field(26)
|
|
"""
|
|
Automatic includes to exclude from generated `.pb.h`
|
|
Same as nanopb_generator.py command line flag -x.
|
|
"""
|
|
|
|
package: str = betterproto.string_field(25)
|
|
"""Package name that applies only for nanopb."""
|
|
|
|
type_override: "betterproto_lib_google_protobuf.FieldDescriptorProtoType" = (
|
|
betterproto.enum_field(27)
|
|
)
|
|
"""
|
|
Override type of the field in generated C code. Only to be used with related field types
|
|
"""
|
|
|
|
label_override: "betterproto_lib_google_protobuf.FieldDescriptorProtoLabel" = (
|
|
betterproto.enum_field(31)
|
|
)
|
|
"""
|
|
Override of the label of the field (see FieldDescriptorProto.Label). Can be used to create
|
|
fields which nanopb considers required in proto3, or whether nanopb treats the field as
|
|
optional/required/repeated.
|
|
"""
|
|
|
|
sort_by_tag: bool = betterproto.bool_field(28)
|
|
"""
|
|
Due to historical reasons, nanopb orders fields in structs by their tag number
|
|
instead of the order in .proto. Set this to false to keep the .proto order.
|
|
The default value will probably change to false in nanopb-0.5.0.
|
|
"""
|
|
|
|
fallback_type: "FieldType" = betterproto.enum_field(29)
|
|
"""
|
|
Set the FT_DEFAULT field conversion strategy.
|
|
A field that can become a static member of a c struct (e.g. int, bool, etc)
|
|
will be a a static field.
|
|
Fields with dynamic length are converted to either a pointer or a callback.
|
|
"""
|
|
|
|
initializer: str = betterproto.string_field(30)
|
|
"""
|
|
Override initializer used in generated MyMessage_init_zero and MyMessage_init_default macros
|
|
By default decided automatically based on field default value and datatype.
|
|
"""
|
|
|
|
discard_unused_automatic_types: bool = betterproto.bool_field(33)
|
|
"""
|
|
Discard unused types that are automatically generated by protoc if they are not actually
|
|
needed. Currently this applies to map< > types when the field is ignored by options.
|
|
"""
|
|
|
|
discard_deprecated: bool = betterproto.bool_field(35)
|
|
"""
|
|
Discard messages and fields marked with [deprecated = true] in the proto file.
|
|
"""
|