From fd813d1128611c8f3bdcfe36d63e78acce51a48a Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Tue, 24 Sep 2019 23:43:09 +0300 Subject: Fixes for Nim 1.0 --- nimpb/compiler/generator.nim | 8 +- nimpb/nimpb.nim | 20 +- nimpb/wkt/descriptor_pb.nim | 5080 ++++++++++++++++++++-------------------- nimpb/wkt/struct_pb.nim | 122 +- nimpb/wkt/wrappers_pb.nim | 470 ++-- tests/conformance/failures.txt | 44 +- 6 files changed, 2888 insertions(+), 2856 deletions(-) diff --git a/nimpb/compiler/generator.nim b/nimpb/compiler/generator.nim index e765e00..f4f70d6 100644 --- a/nimpb/compiler/generator.nim +++ b/nimpb/compiler/generator.nim @@ -691,7 +691,7 @@ iterator genNewMessageProc(msg: Message): string = if field.oneof == nil: yield indent(&"result.{field.accessor} = {defaultValue(field)}", 4) for oneof in msg.oneofs: - yield indent(&"result.{oneof.name}.kind = {msg.names}_{oneof.name}_Kind.NotSet", 4) + yield indent(&"result.{oneof.name} = {msg.names}_{oneof.name}_OneOf(kind: {msg.names}_{oneof.name}_Kind.NotSet)", 4) yield "" iterator oneofSiblings(field: Field): Field = @@ -730,9 +730,9 @@ iterator genSetFieldProc(msg: Message, field: Field): string = yield indent(&"message.{field.accessor} = value", 4) else: yield indent(&"if message.{field.oneof.name}.kind != {msg.names}_{field.oneof.name}_Kind.{field.name.capitalizeAscii}:", 4) - yield indent(&"reset(message.{field.oneof.name})", 8) - yield indent(&"message.{field.oneof.name}.kind = {msg.names}_{field.oneof.name}_Kind.{field.name.capitalizeAscii}", 8) - yield indent(&"message.{field.accessor} = value", 4) + yield indent(&"message.{field.oneof.name} = {msg.names}_{field.oneof.name}_OneOf(kind: {msg.names}_{field.oneof.name}_Kind.{field.name.capitalizeAscii}, {quoteReserved(field.name)}: value)", 8) + yield indent(&"else:", 4) + yield indent(&"message.{field.accessor} = value", 8) if shouldGenerateHasField(msg, field): yield indent(&"setField(message, {field.number})", 4) var numbers: seq[int] = @[] diff --git a/nimpb/nimpb.nim b/nimpb/nimpb.nim index 9691650..12192fe 100644 --- a/nimpb/nimpb.nim +++ b/nimpb/nimpb.nim @@ -186,9 +186,9 @@ proc writeVarint*(stream: Stream, n: uint64) = ## Write a varint to a stream. var value = n while value >= 0x80'u64: - protoWriteByte(stream, (value or 0x80).byte) + protoWriteByte(stream, cast[byte](value or 0x80)) value = value shr 7 - protoWriteByte(stream, value.byte) + protoWriteByte(stream, cast[byte](value)) proc writeTag*(stream: Stream, tag: Tag) = ## Write a Tag to a stream. @@ -217,7 +217,7 @@ proc protoWriteInt32*(stream: Stream, n: int32, fieldNumber: int) = proc protoReadInt32*(stream: Stream): int32 = ## Read a varint as 32-bit signed integer from a stream. - result = readVarint(stream).int32 + result = cast[int32](readVarint(stream)) proc protoWriteSInt32*(stream: Stream, n: int32) = ## Write a 32-bit signed integer using ZigZag encoding to a stream. @@ -231,7 +231,7 @@ proc protoWriteSInt32*(stream: Stream, n: int32, fieldNumber: int) = proc protoReadSInt32*(stream: Stream): int32 = ## Read a 32-bit signed integer, using ZigZag decoding, from a stream. - result = zigzagDecode(readVarint(stream).uint32) + result = zigzagDecode(cast[uint32](readVarint(stream))) proc protoWriteUInt32*(stream: Stream, n: uint32) = ## Write a 32-bit unsigned integer to a stream. @@ -244,7 +244,7 @@ proc protoWriteUInt32*(stream: Stream, n: uint32, fieldNumber: int) = proc protoReadUInt32*(stream: Stream): uint32 = ## Read a 32-bit unsigned integer from a stream. - result = readVarint(stream).uint32 + result = cast[uint32](readVarint(stream)) proc protoWriteInt64*(stream: Stream, n: int64) = writeVarint(stream, n.uint64) @@ -254,7 +254,7 @@ proc protoWriteInt64*(stream: Stream, n: int64, fieldNumber: int) = writeVarint(stream, n.uint64) proc protoReadInt64*(stream: Stream): int64 = - result = readVarint(stream).int64 + result = cast[int64](readVarint(stream)) proc protoWriteSInt64*(stream: Stream, n: int64) = writeVarint(stream, zigzagEncode(n)) @@ -284,7 +284,7 @@ proc protoWriteBool*(stream: Stream, n: bool, fieldNumber: int) = writeVarint(stream, n.uint32) proc protoReadBool*(stream: Stream): bool = - result = readVarint(stream).bool + result = cast[bool](readVarint(stream)) proc protoWriteFixed64*(stream: Stream, value: uint64) = var @@ -572,11 +572,7 @@ proc readLengthDelimited*(stream: Stream): string = proc readUnknownField*(stream: Stream, tag: Tag, fields: var seq[UnknownField]) = ## Read an unknown field from a stream and add it to a sequence. - var field: UnknownField - - new(field) - field.fieldNumber = fieldNumber(tag) - field.wireType = wiretype(tag) + var field = UnknownField(fieldNumber: fieldNumber(tag), wireType: wiretype(tag)) case field.wiretype of WireType.Varint: diff --git a/nimpb/wkt/descriptor_pb.nim b/nimpb/wkt/descriptor_pb.nim index f7ee2f2..beca42f 100644 --- a/nimpb/wkt/descriptor_pb.nim +++ b/nimpb/wkt/descriptor_pb.nim @@ -232,6 +232,13 @@ proc writegoogle_protobuf_UninterpretedOption_NamePart*(stream: Stream, message: proc readgoogle_protobuf_UninterpretedOption_NamePart*(stream: Stream): google_protobuf_UninterpretedOption_NamePart proc sizeOfgoogle_protobuf_UninterpretedOption_NamePart*(message: google_protobuf_UninterpretedOption_NamePart): uint64 +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(): google_protobuf_GeneratedCodeInfo_Annotation +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: string): google_protobuf_GeneratedCodeInfo_Annotation +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: seq[byte]): google_protobuf_GeneratedCodeInfo_Annotation +proc writegoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream, message: google_protobuf_GeneratedCodeInfo_Annotation) +proc readgoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream): google_protobuf_GeneratedCodeInfo_Annotation +proc sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation*(message: google_protobuf_GeneratedCodeInfo_Annotation): uint64 + proc newgoogle_protobuf_UninterpretedOption*(): google_protobuf_UninterpretedOption proc newgoogle_protobuf_UninterpretedOption*(data: string): google_protobuf_UninterpretedOption proc newgoogle_protobuf_UninterpretedOption*(data: seq[byte]): google_protobuf_UninterpretedOption @@ -253,27 +260,6 @@ proc writegoogle_protobuf_EnumValueDescriptorProto*(stream: Stream, message: goo proc readgoogle_protobuf_EnumValueDescriptorProto*(stream: Stream): google_protobuf_EnumValueDescriptorProto proc sizeOfgoogle_protobuf_EnumValueDescriptorProto*(message: google_protobuf_EnumValueDescriptorProto): uint64 -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(): google_protobuf_EnumDescriptorProto_EnumReservedRange -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: seq[byte]): google_protobuf_EnumDescriptorProto_EnumReservedRange -proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream, message: google_protobuf_EnumDescriptorProto_EnumReservedRange) -proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream): google_protobuf_EnumDescriptorProto_EnumReservedRange -proc sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): uint64 - -proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions -proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions -proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions -proc writegoogle_protobuf_EnumOptions*(stream: Stream, message: google_protobuf_EnumOptions) -proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions -proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 - -proc newgoogle_protobuf_EnumDescriptorProto*(): google_protobuf_EnumDescriptorProto -proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto -proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto -proc writegoogle_protobuf_EnumDescriptorProto*(stream: Stream, message: google_protobuf_EnumDescriptorProto) -proc readgoogle_protobuf_EnumDescriptorProto*(stream: Stream): google_protobuf_EnumDescriptorProto -proc sizeOfgoogle_protobuf_EnumDescriptorProto*(message: google_protobuf_EnumDescriptorProto): uint64 - proc newgoogle_protobuf_ExtensionRangeOptions*(): google_protobuf_ExtensionRangeOptions proc newgoogle_protobuf_ExtensionRangeOptions*(data: string): google_protobuf_ExtensionRangeOptions proc newgoogle_protobuf_ExtensionRangeOptions*(data: seq[byte]): google_protobuf_ExtensionRangeOptions @@ -281,19 +267,12 @@ proc writegoogle_protobuf_ExtensionRangeOptions*(stream: Stream, message: google proc readgoogle_protobuf_ExtensionRangeOptions*(stream: Stream): google_protobuf_ExtensionRangeOptions proc sizeOfgoogle_protobuf_ExtensionRangeOptions*(message: google_protobuf_ExtensionRangeOptions): uint64 -proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location -proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location -proc newgoogle_protobuf_SourceCodeInfo_Location*(data: seq[byte]): google_protobuf_SourceCodeInfo_Location -proc writegoogle_protobuf_SourceCodeInfo_Location*(stream: Stream, message: google_protobuf_SourceCodeInfo_Location) -proc readgoogle_protobuf_SourceCodeInfo_Location*(stream: Stream): google_protobuf_SourceCodeInfo_Location -proc sizeOfgoogle_protobuf_SourceCodeInfo_Location*(message: google_protobuf_SourceCodeInfo_Location): uint64 - -proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo -proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo -proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo -proc writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) -proc readgoogle_protobuf_SourceCodeInfo*(stream: Stream): google_protobuf_SourceCodeInfo -proc sizeOfgoogle_protobuf_SourceCodeInfo*(message: google_protobuf_SourceCodeInfo): uint64 +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange +proc writegoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream, message: google_protobuf_DescriptorProto_ExtensionRange) +proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange +proc sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange*(message: google_protobuf_DescriptorProto_ExtensionRange): uint64 proc newgoogle_protobuf_FieldOptions*(): google_protobuf_FieldOptions proc newgoogle_protobuf_FieldOptions*(data: string): google_protobuf_FieldOptions @@ -309,19 +288,19 @@ proc writegoogle_protobuf_FieldDescriptorProto*(stream: Stream, message: google_ proc readgoogle_protobuf_FieldDescriptorProto*(stream: Stream): google_protobuf_FieldDescriptorProto proc sizeOfgoogle_protobuf_FieldDescriptorProto*(message: google_protobuf_FieldDescriptorProto): uint64 -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange -proc writegoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream, message: google_protobuf_DescriptorProto_ExtensionRange) -proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange -proc sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange*(message: google_protobuf_DescriptorProto_ExtensionRange): uint64 +proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions +proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions +proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions +proc writegoogle_protobuf_MethodOptions*(stream: Stream, message: google_protobuf_MethodOptions) +proc readgoogle_protobuf_MethodOptions*(stream: Stream): google_protobuf_MethodOptions +proc sizeOfgoogle_protobuf_MethodOptions*(message: google_protobuf_MethodOptions): uint64 -proc newgoogle_protobuf_MessageOptions*(): google_protobuf_MessageOptions -proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions -proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions -proc writegoogle_protobuf_MessageOptions*(stream: Stream, message: google_protobuf_MessageOptions) -proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_MessageOptions -proc sizeOfgoogle_protobuf_MessageOptions*(message: google_protobuf_MessageOptions): uint64 +proc newgoogle_protobuf_MethodDescriptorProto*(): google_protobuf_MethodDescriptorProto +proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto +proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto +proc writegoogle_protobuf_MethodDescriptorProto*(stream: Stream, message: google_protobuf_MethodDescriptorProto) +proc readgoogle_protobuf_MethodDescriptorProto*(stream: Stream): google_protobuf_MethodDescriptorProto +proc sizeOfgoogle_protobuf_MethodDescriptorProto*(message: google_protobuf_MethodDescriptorProto): uint64 proc newgoogle_protobuf_OneofOptions*(): google_protobuf_OneofOptions proc newgoogle_protobuf_OneofOptions*(data: string): google_protobuf_OneofOptions @@ -337,6 +316,20 @@ proc writegoogle_protobuf_OneofDescriptorProto*(stream: Stream, message: google_ proc readgoogle_protobuf_OneofDescriptorProto*(stream: Stream): google_protobuf_OneofDescriptorProto proc sizeOfgoogle_protobuf_OneofDescriptorProto*(message: google_protobuf_OneofDescriptorProto): uint64 +proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions +proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions +proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions +proc writegoogle_protobuf_EnumOptions*(stream: Stream, message: google_protobuf_EnumOptions) +proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions +proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 + +proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location +proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location +proc newgoogle_protobuf_SourceCodeInfo_Location*(data: seq[byte]): google_protobuf_SourceCodeInfo_Location +proc writegoogle_protobuf_SourceCodeInfo_Location*(stream: Stream, message: google_protobuf_SourceCodeInfo_Location) +proc readgoogle_protobuf_SourceCodeInfo_Location*(stream: Stream): google_protobuf_SourceCodeInfo_Location +proc sizeOfgoogle_protobuf_SourceCodeInfo_Location*(message: google_protobuf_SourceCodeInfo_Location): uint64 + proc newgoogle_protobuf_DescriptorProto_ReservedRange*(): google_protobuf_DescriptorProto_ReservedRange proc newgoogle_protobuf_DescriptorProto_ReservedRange*(data: string): google_protobuf_DescriptorProto_ReservedRange proc newgoogle_protobuf_DescriptorProto_ReservedRange*(data: seq[byte]): google_protobuf_DescriptorProto_ReservedRange @@ -344,6 +337,41 @@ proc writegoogle_protobuf_DescriptorProto_ReservedRange*(stream: Stream, message proc readgoogle_protobuf_DescriptorProto_ReservedRange*(stream: Stream): google_protobuf_DescriptorProto_ReservedRange proc sizeOfgoogle_protobuf_DescriptorProto_ReservedRange*(message: google_protobuf_DescriptorProto_ReservedRange): uint64 +proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo +proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo +proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo +proc writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) +proc readgoogle_protobuf_SourceCodeInfo*(stream: Stream): google_protobuf_SourceCodeInfo +proc sizeOfgoogle_protobuf_SourceCodeInfo*(message: google_protobuf_SourceCodeInfo): uint64 + +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(): google_protobuf_EnumDescriptorProto_EnumReservedRange +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: seq[byte]): google_protobuf_EnumDescriptorProto_EnumReservedRange +proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream, message: google_protobuf_EnumDescriptorProto_EnumReservedRange) +proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream): google_protobuf_EnumDescriptorProto_EnumReservedRange +proc sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): uint64 + +proc newgoogle_protobuf_EnumDescriptorProto*(): google_protobuf_EnumDescriptorProto +proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto +proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto +proc writegoogle_protobuf_EnumDescriptorProto*(stream: Stream, message: google_protobuf_EnumDescriptorProto) +proc readgoogle_protobuf_EnumDescriptorProto*(stream: Stream): google_protobuf_EnumDescriptorProto +proc sizeOfgoogle_protobuf_EnumDescriptorProto*(message: google_protobuf_EnumDescriptorProto): uint64 + +proc newgoogle_protobuf_GeneratedCodeInfo*(): google_protobuf_GeneratedCodeInfo +proc newgoogle_protobuf_GeneratedCodeInfo*(data: string): google_protobuf_GeneratedCodeInfo +proc newgoogle_protobuf_GeneratedCodeInfo*(data: seq[byte]): google_protobuf_GeneratedCodeInfo +proc writegoogle_protobuf_GeneratedCodeInfo*(stream: Stream, message: google_protobuf_GeneratedCodeInfo) +proc readgoogle_protobuf_GeneratedCodeInfo*(stream: Stream): google_protobuf_GeneratedCodeInfo +proc sizeOfgoogle_protobuf_GeneratedCodeInfo*(message: google_protobuf_GeneratedCodeInfo): uint64 + +proc newgoogle_protobuf_MessageOptions*(): google_protobuf_MessageOptions +proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions +proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions +proc writegoogle_protobuf_MessageOptions*(stream: Stream, message: google_protobuf_MessageOptions) +proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_MessageOptions +proc sizeOfgoogle_protobuf_MessageOptions*(message: google_protobuf_MessageOptions): uint64 + proc newgoogle_protobuf_DescriptorProto*(): google_protobuf_DescriptorProto proc newgoogle_protobuf_DescriptorProto*(data: string): google_protobuf_DescriptorProto proc newgoogle_protobuf_DescriptorProto*(data: seq[byte]): google_protobuf_DescriptorProto @@ -351,13 +379,6 @@ proc writegoogle_protobuf_DescriptorProto*(stream: Stream, message: google_proto proc readgoogle_protobuf_DescriptorProto*(stream: Stream): google_protobuf_DescriptorProto proc sizeOfgoogle_protobuf_DescriptorProto*(message: google_protobuf_DescriptorProto): uint64 -proc newgoogle_protobuf_FileOptions*(): google_protobuf_FileOptions -proc newgoogle_protobuf_FileOptions*(data: string): google_protobuf_FileOptions -proc newgoogle_protobuf_FileOptions*(data: seq[byte]): google_protobuf_FileOptions -proc writegoogle_protobuf_FileOptions*(stream: Stream, message: google_protobuf_FileOptions) -proc readgoogle_protobuf_FileOptions*(stream: Stream): google_protobuf_FileOptions -proc sizeOfgoogle_protobuf_FileOptions*(message: google_protobuf_FileOptions): uint64 - proc newgoogle_protobuf_ServiceOptions*(): google_protobuf_ServiceOptions proc newgoogle_protobuf_ServiceOptions*(data: string): google_protobuf_ServiceOptions proc newgoogle_protobuf_ServiceOptions*(data: seq[byte]): google_protobuf_ServiceOptions @@ -365,20 +386,6 @@ proc writegoogle_protobuf_ServiceOptions*(stream: Stream, message: google_protob proc readgoogle_protobuf_ServiceOptions*(stream: Stream): google_protobuf_ServiceOptions proc sizeOfgoogle_protobuf_ServiceOptions*(message: google_protobuf_ServiceOptions): uint64 -proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions -proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions -proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions -proc writegoogle_protobuf_MethodOptions*(stream: Stream, message: google_protobuf_MethodOptions) -proc readgoogle_protobuf_MethodOptions*(stream: Stream): google_protobuf_MethodOptions -proc sizeOfgoogle_protobuf_MethodOptions*(message: google_protobuf_MethodOptions): uint64 - -proc newgoogle_protobuf_MethodDescriptorProto*(): google_protobuf_MethodDescriptorProto -proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto -proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto -proc writegoogle_protobuf_MethodDescriptorProto*(stream: Stream, message: google_protobuf_MethodDescriptorProto) -proc readgoogle_protobuf_MethodDescriptorProto*(stream: Stream): google_protobuf_MethodDescriptorProto -proc sizeOfgoogle_protobuf_MethodDescriptorProto*(message: google_protobuf_MethodDescriptorProto): uint64 - proc newgoogle_protobuf_ServiceDescriptorProto*(): google_protobuf_ServiceDescriptorProto proc newgoogle_protobuf_ServiceDescriptorProto*(data: string): google_protobuf_ServiceDescriptorProto proc newgoogle_protobuf_ServiceDescriptorProto*(data: seq[byte]): google_protobuf_ServiceDescriptorProto @@ -386,6 +393,13 @@ proc writegoogle_protobuf_ServiceDescriptorProto*(stream: Stream, message: googl proc readgoogle_protobuf_ServiceDescriptorProto*(stream: Stream): google_protobuf_ServiceDescriptorProto proc sizeOfgoogle_protobuf_ServiceDescriptorProto*(message: google_protobuf_ServiceDescriptorProto): uint64 +proc newgoogle_protobuf_FileOptions*(): google_protobuf_FileOptions +proc newgoogle_protobuf_FileOptions*(data: string): google_protobuf_FileOptions +proc newgoogle_protobuf_FileOptions*(data: seq[byte]): google_protobuf_FileOptions +proc writegoogle_protobuf_FileOptions*(stream: Stream, message: google_protobuf_FileOptions) +proc readgoogle_protobuf_FileOptions*(stream: Stream): google_protobuf_FileOptions +proc sizeOfgoogle_protobuf_FileOptions*(message: google_protobuf_FileOptions): uint64 + proc newgoogle_protobuf_FileDescriptorProto*(): google_protobuf_FileDescriptorProto proc newgoogle_protobuf_FileDescriptorProto*(data: string): google_protobuf_FileDescriptorProto proc newgoogle_protobuf_FileDescriptorProto*(data: seq[byte]): google_protobuf_FileDescriptorProto @@ -400,20 +414,6 @@ proc writegoogle_protobuf_FileDescriptorSet*(stream: Stream, message: google_pro proc readgoogle_protobuf_FileDescriptorSet*(stream: Stream): google_protobuf_FileDescriptorSet proc sizeOfgoogle_protobuf_FileDescriptorSet*(message: google_protobuf_FileDescriptorSet): uint64 -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(): google_protobuf_GeneratedCodeInfo_Annotation -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: string): google_protobuf_GeneratedCodeInfo_Annotation -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: seq[byte]): google_protobuf_GeneratedCodeInfo_Annotation -proc writegoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream, message: google_protobuf_GeneratedCodeInfo_Annotation) -proc readgoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream): google_protobuf_GeneratedCodeInfo_Annotation -proc sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation*(message: google_protobuf_GeneratedCodeInfo_Annotation): uint64 - -proc newgoogle_protobuf_GeneratedCodeInfo*(): google_protobuf_GeneratedCodeInfo -proc newgoogle_protobuf_GeneratedCodeInfo*(data: string): google_protobuf_GeneratedCodeInfo -proc newgoogle_protobuf_GeneratedCodeInfo*(data: seq[byte]): google_protobuf_GeneratedCodeInfo -proc writegoogle_protobuf_GeneratedCodeInfo*(stream: Stream, message: google_protobuf_GeneratedCodeInfo) -proc readgoogle_protobuf_GeneratedCodeInfo*(stream: Stream): google_protobuf_GeneratedCodeInfo -proc sizeOfgoogle_protobuf_GeneratedCodeInfo*(message: google_protobuf_GeneratedCodeInfo): uint64 - proc fullyQualifiedName*(T: typedesc[google_protobuf_UninterpretedOption_NamePart]): string = "google.protobuf.UninterpretedOption.NamePart" proc readgoogle_protobuf_UninterpretedOption_NamePartImpl(stream: Stream): Message = readgoogle_protobuf_UninterpretedOption_NamePart(stream) @@ -514,69 +514,238 @@ proc newgoogle_protobuf_UninterpretedOption_NamePart*(data: seq[byte]): google_p result = readgoogle_protobuf_UninterpretedOption_NamePart(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_UninterpretedOption]): string = "google.protobuf.UninterpretedOption" +proc fullyQualifiedName*(T: typedesc[google_protobuf_GeneratedCodeInfo_Annotation]): string = "google.protobuf.GeneratedCodeInfo.Annotation" -proc readgoogle_protobuf_UninterpretedOptionImpl(stream: Stream): Message = readgoogle_protobuf_UninterpretedOption(stream) -proc writegoogle_protobuf_UninterpretedOptionImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UninterpretedOption(stream, google_protobuf_UninterpretedOption(msg)) +proc readgoogle_protobuf_GeneratedCodeInfo_AnnotationImpl(stream: Stream): Message = readgoogle_protobuf_GeneratedCodeInfo_Annotation(stream) +proc writegoogle_protobuf_GeneratedCodeInfo_AnnotationImpl(stream: Stream, msg: Message) = writegoogle_protobuf_GeneratedCodeInfo_Annotation(stream, google_protobuf_GeneratedCodeInfo_Annotation(msg)) -proc google_protobuf_UninterpretedOptionProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_UninterpretedOptionImpl - result.writeImpl = writegoogle_protobuf_UninterpretedOptionImpl +proc google_protobuf_GeneratedCodeInfo_AnnotationProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_GeneratedCodeInfo_AnnotationImpl + result.writeImpl = writegoogle_protobuf_GeneratedCodeInfo_AnnotationImpl -proc newgoogle_protobuf_UninterpretedOption*(): google_protobuf_UninterpretedOption = +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(): google_protobuf_GeneratedCodeInfo_Annotation = new(result) initMessage(result[]) - result.procs = google_protobuf_UninterpretedOptionProcs() - result.name = @[] - result.identifierValue = "" - result.positiveIntValue = 0 - result.negativeIntValue = 0 - result.doubleValue = 0 - result.stringValue = @[] - result.aggregateValue = "" + result.procs = google_protobuf_GeneratedCodeInfo_AnnotationProcs() + result.path = @[] + result.sourceFile = "" + result.begin = 0 + result.fend = 0 -proc clearname*(message: google_protobuf_UninterpretedOption) = - message.name = @[] +proc clearpath*(message: google_protobuf_GeneratedCodeInfo_Annotation) = + message.path = @[] + clearFields(message, [1]) + +proc haspath*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = + result = hasField(message, 1) or (len(message.path) > 0) + +proc setpath*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: seq[int32]) = + message.path = value + setField(message, 1) + +proc addpath*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = + add(message.path, value) + +proc path*(message: google_protobuf_GeneratedCodeInfo_Annotation): seq[int32] {.inline.} = + message.path + +proc `path=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: seq[int32]) {.inline.} = + setpath(message, value) + +proc clearsourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation) = + message.sourceFile = "" clearFields(message, [2]) -proc hasname*(message: google_protobuf_UninterpretedOption): bool = - result = hasField(message, 2) or (len(message.name) > 0) +proc hassourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = + result = hasField(message, 2) -proc setname*(message: google_protobuf_UninterpretedOption, value: seq[google_protobuf_UninterpretedOption_NamePart]) = - message.name = value +proc setsourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: string) = + message.sourceFile = value setField(message, 2) -proc addname*(message: google_protobuf_UninterpretedOption, value: google_protobuf_UninterpretedOption_NamePart) = - add(message.name, value) - -proc name*(message: google_protobuf_UninterpretedOption): seq[google_protobuf_UninterpretedOption_NamePart] {.inline.} = - message.name +proc sourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation): string {.inline.} = + message.sourceFile -proc `name=`*(message: google_protobuf_UninterpretedOption, value: seq[google_protobuf_UninterpretedOption_NamePart]) {.inline.} = - setname(message, value) +proc `sourceFile=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: string) {.inline.} = + setsourceFile(message, value) -proc clearidentifierValue*(message: google_protobuf_UninterpretedOption) = - message.identifierValue = "" +proc clearbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation) = + message.begin = 0 clearFields(message, [3]) -proc hasidentifierValue*(message: google_protobuf_UninterpretedOption): bool = +proc hasbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = result = hasField(message, 3) -proc setidentifierValue*(message: google_protobuf_UninterpretedOption, value: string) = - message.identifierValue = value +proc setbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = + message.begin = value setField(message, 3) -proc identifierValue*(message: google_protobuf_UninterpretedOption): string {.inline.} = - message.identifierValue +proc begin*(message: google_protobuf_GeneratedCodeInfo_Annotation): int32 {.inline.} = + message.begin -proc `identifierValue=`*(message: google_protobuf_UninterpretedOption, value: string) {.inline.} = - setidentifierValue(message, value) +proc `begin=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) {.inline.} = + setbegin(message, value) -proc clearpositiveIntValue*(message: google_protobuf_UninterpretedOption) = - message.positiveIntValue = 0 +proc clearfend*(message: google_protobuf_GeneratedCodeInfo_Annotation) = + message.fend = 0 clearFields(message, [4]) -proc haspositiveIntValue*(message: google_protobuf_UninterpretedOption): bool = +proc hasfend*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = + result = hasField(message, 4) + +proc setfend*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = + message.fend = value + setField(message, 4) + +proc fend*(message: google_protobuf_GeneratedCodeInfo_Annotation): int32 {.inline.} = + message.fend + +proc `fend=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) {.inline.} = + setfend(message, value) + +proc sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation*(message: google_protobuf_GeneratedCodeInfo_Annotation): uint64 = + if len(message.path) > 0: + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(packedFieldSize(message.path, FieldType.Int32)) + if hassourceFile(message): + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfString(message.sourceFile) + if hasbegin(message): + result = result + sizeOfTag(3, WireType.Varint) + result = result + sizeOfInt32(message.begin) + if hasfend(message): + result = result + sizeOfTag(4, WireType.Varint) + result = result + sizeOfInt32(message.fend) + result = result + sizeOfUnknownFields(message) + +proc writegoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream, message: google_protobuf_GeneratedCodeInfo_Annotation) = + if len(message.path) > 0: + writeTag(stream, 1, WireType.LengthDelimited) + writeVarint(stream, packedFieldSize(message.path, FieldType.Int32)) + for value in message.path: + protoWriteInt32(stream, value) + if hassourceFile(message): + protoWriteString(stream, message.sourceFile, 2) + if hasbegin(message): + protoWriteInt32(stream, message.begin, 3) + if hasfend(message): + protoWriteInt32(stream, message.fend, 4) + writeUnknownFields(stream, message) + +proc readgoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream): google_protobuf_GeneratedCodeInfo_Annotation = + result = newgoogle_protobuf_GeneratedCodeInfo_Annotation() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) + if wireType == WireType.LengthDelimited: + let + size = readVarint(stream) + start = uint64(getPosition(stream)) + var consumed = 0'u64 + while consumed < size: + addpath(result, protoReadInt32(stream)) + consumed = uint64(getPosition(stream)) - start + if consumed != size: + raise newException(Exception, "packed field size mismatch") + else: + addpath(result, protoReadInt32(stream)) + of 2: + expectWireType(wireType, WireType.LengthDelimited) + setsourceFile(result, protoReadString(stream)) + of 3: + expectWireType(wireType, WireType.Varint) + setbegin(result, protoReadInt32(stream)) + of 4: + expectWireType(wireType, WireType.Varint) + setfend(result, protoReadInt32(stream)) + else: readUnknownField(stream, result, tag) + +proc serialize*(message: google_protobuf_GeneratedCodeInfo_Annotation): string = + let + ss = newStringStream() + writegoogle_protobuf_GeneratedCodeInfo_Annotation(ss, message) + result = ss.data + +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: string): google_protobuf_GeneratedCodeInfo_Annotation = + let + ss = newStringStream(data) + result = readgoogle_protobuf_GeneratedCodeInfo_Annotation(ss) + +proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: seq[byte]): google_protobuf_GeneratedCodeInfo_Annotation = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_GeneratedCodeInfo_Annotation(ss) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_UninterpretedOption]): string = "google.protobuf.UninterpretedOption" + +proc readgoogle_protobuf_UninterpretedOptionImpl(stream: Stream): Message = readgoogle_protobuf_UninterpretedOption(stream) +proc writegoogle_protobuf_UninterpretedOptionImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UninterpretedOption(stream, google_protobuf_UninterpretedOption(msg)) + +proc google_protobuf_UninterpretedOptionProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_UninterpretedOptionImpl + result.writeImpl = writegoogle_protobuf_UninterpretedOptionImpl + +proc newgoogle_protobuf_UninterpretedOption*(): google_protobuf_UninterpretedOption = + new(result) + initMessage(result[]) + result.procs = google_protobuf_UninterpretedOptionProcs() + result.name = @[] + result.identifierValue = "" + result.positiveIntValue = 0 + result.negativeIntValue = 0 + result.doubleValue = 0 + result.stringValue = @[] + result.aggregateValue = "" + +proc clearname*(message: google_protobuf_UninterpretedOption) = + message.name = @[] + clearFields(message, [2]) + +proc hasname*(message: google_protobuf_UninterpretedOption): bool = + result = hasField(message, 2) or (len(message.name) > 0) + +proc setname*(message: google_protobuf_UninterpretedOption, value: seq[google_protobuf_UninterpretedOption_NamePart]) = + message.name = value + setField(message, 2) + +proc addname*(message: google_protobuf_UninterpretedOption, value: google_protobuf_UninterpretedOption_NamePart) = + add(message.name, value) + +proc name*(message: google_protobuf_UninterpretedOption): seq[google_protobuf_UninterpretedOption_NamePart] {.inline.} = + message.name + +proc `name=`*(message: google_protobuf_UninterpretedOption, value: seq[google_protobuf_UninterpretedOption_NamePart]) {.inline.} = + setname(message, value) + +proc clearidentifierValue*(message: google_protobuf_UninterpretedOption) = + message.identifierValue = "" + clearFields(message, [3]) + +proc hasidentifierValue*(message: google_protobuf_UninterpretedOption): bool = + result = hasField(message, 3) + +proc setidentifierValue*(message: google_protobuf_UninterpretedOption, value: string) = + message.identifierValue = value + setField(message, 3) + +proc identifierValue*(message: google_protobuf_UninterpretedOption): string {.inline.} = + message.identifierValue + +proc `identifierValue=`*(message: google_protobuf_UninterpretedOption, value: string) {.inline.} = + setidentifierValue(message, value) + +proc clearpositiveIntValue*(message: google_protobuf_UninterpretedOption) = + message.positiveIntValue = 0 + clearFields(message, [4]) + +proc haspositiveIntValue*(message: google_protobuf_UninterpretedOption): bool = result = hasField(message, 4) proc setpositiveIntValue*(message: google_protobuf_UninterpretedOption, value: uint64) = @@ -979,74 +1148,54 @@ proc newgoogle_protobuf_EnumValueDescriptorProto*(data: seq[byte]): google_proto result = readgoogle_protobuf_EnumValueDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto_EnumReservedRange]): string = "google.protobuf.EnumDescriptorProto.EnumReservedRange" +proc fullyQualifiedName*(T: typedesc[google_protobuf_ExtensionRangeOptions]): string = "google.protobuf.ExtensionRangeOptions" -proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl(stream: Stream): Message = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(stream) -proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(stream, google_protobuf_EnumDescriptorProto_EnumReservedRange(msg)) +proc readgoogle_protobuf_ExtensionRangeOptionsImpl(stream: Stream): Message = readgoogle_protobuf_ExtensionRangeOptions(stream) +proc writegoogle_protobuf_ExtensionRangeOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ExtensionRangeOptions(stream, google_protobuf_ExtensionRangeOptions(msg)) -proc google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl - result.writeImpl = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl +proc google_protobuf_ExtensionRangeOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_ExtensionRangeOptionsImpl + result.writeImpl = writegoogle_protobuf_ExtensionRangeOptionsImpl -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(): google_protobuf_EnumDescriptorProto_EnumReservedRange = +proc newgoogle_protobuf_ExtensionRangeOptions*(): google_protobuf_ExtensionRangeOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs() - result.start = 0 - result.fend = 0 - -proc clearstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = - message.start = 0 - clearFields(message, [1]) - -proc hasstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = - result = hasField(message, 1) - -proc setstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = - message.start = value - setField(message, 1) - -proc start*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = - message.start + result.procs = google_protobuf_ExtensionRangeOptionsProcs() + result.uninterpretedOption = @[] -proc `start=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = - setstart(message, value) +proc clearuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc clearfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = - message.fend = 0 - clearFields(message, [2]) +proc hasuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc hasfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = - result = hasField(message, 2) +proc setuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc setfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = - message.fend = value - setField(message, 2) +proc adduninterpretedOption*(message: google_protobuf_ExtensionRangeOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc fend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = - message.fend +proc uninterpretedOption*(message: google_protobuf_ExtensionRangeOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -proc `fend=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = - setfend(message, value) +proc `uninterpretedOption=`*(message: google_protobuf_ExtensionRangeOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) -proc sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): uint64 = - if hasstart(message): - result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfInt32(message.start) - if hasfend(message): - result = result + sizeOfTag(2, WireType.Varint) - result = result + sizeOfInt32(message.fend) +proc sizeOfgoogle_protobuf_ExtensionRangeOptions*(message: google_protobuf_ExtensionRangeOptions): uint64 = + for value in message.uninterpretedOption: + result = result + sizeOfTag(999, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream, message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = - if hasstart(message): - protoWriteInt32(stream, message.start, 1) - if hasfend(message): - protoWriteInt32(stream, message.fend, 2) +proc writegoogle_protobuf_ExtensionRangeOptions*(stream: Stream, message: google_protobuf_ExtensionRangeOptions) = + for value in message.uninterpretedOption: + writeMessage(stream, value, 999) writeUnknownFields(stream, message) -proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream): google_protobuf_EnumDescriptorProto_EnumReservedRange = - result = newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange() +proc readgoogle_protobuf_ExtensionRangeOptions*(stream: Stream): google_protobuf_ExtensionRangeOptions = + result = newgoogle_protobuf_ExtensionRangeOptions() while not atEnd(stream): let tag = readTag(stream) @@ -1054,125 +1203,120 @@ proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream): case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.Varint) - setstart(result, protoReadInt32(stream)) - of 2: - expectWireType(wireType, WireType.Varint) - setfend(result, protoReadInt32(stream)) + of 999: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): string = +proc serialize*(message: google_protobuf_ExtensionRangeOptions): string = let ss = newStringStream() - writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss, message) + writegoogle_protobuf_ExtensionRangeOptions(ss, message) result = ss.data -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange = +proc newgoogle_protobuf_ExtensionRangeOptions*(data: string): google_protobuf_ExtensionRangeOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) + result = readgoogle_protobuf_ExtensionRangeOptions(ss) -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: seq[byte]): google_protobuf_EnumDescriptorProto_EnumReservedRange = +proc newgoogle_protobuf_ExtensionRangeOptions*(data: seq[byte]): google_protobuf_ExtensionRangeOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) + result = readgoogle_protobuf_ExtensionRangeOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumOptions]): string = "google.protobuf.EnumOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ExtensionRange]): string = "google.protobuf.DescriptorProto.ExtensionRange" -proc readgoogle_protobuf_EnumOptionsImpl(stream: Stream): Message = readgoogle_protobuf_EnumOptions(stream) -proc writegoogle_protobuf_EnumOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumOptions(stream, google_protobuf_EnumOptions(msg)) +proc readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto_ExtensionRange(stream) +proc writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl(stream: Stream, msg: Message) = writegoogle_protobuf_DescriptorProto_ExtensionRange(stream, google_protobuf_DescriptorProto_ExtensionRange(msg)) -proc google_protobuf_EnumOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumOptionsImpl - result.writeImpl = writegoogle_protobuf_EnumOptionsImpl +proc google_protobuf_DescriptorProto_ExtensionRangeProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl + result.writeImpl = writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl -proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange = new(result) initMessage(result[]) - result.procs = google_protobuf_EnumOptionsProcs() - result.allowAlias = false - result.deprecated = false - result.uninterpretedOption = @[] + result.procs = google_protobuf_DescriptorProto_ExtensionRangeProcs() + result.start = 0 + result.fend = 0 + result.options = nil -proc clearallowAlias*(message: google_protobuf_EnumOptions) = - message.allowAlias = false +proc clearstart*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.start = 0 + clearFields(message, [1]) + +proc hasstart*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = + result = hasField(message, 1) + +proc setstart*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = + message.start = value + setField(message, 1) + +proc start*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = + message.start + +proc `start=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = + setstart(message, value) + +proc clearfend*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.fend = 0 clearFields(message, [2]) -proc hasallowAlias*(message: google_protobuf_EnumOptions): bool = +proc hasfend*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = result = hasField(message, 2) -proc setallowAlias*(message: google_protobuf_EnumOptions, value: bool) = - message.allowAlias = value +proc setfend*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = + message.fend = value setField(message, 2) -proc allowAlias*(message: google_protobuf_EnumOptions): bool {.inline.} = - message.allowAlias +proc fend*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = + message.fend -proc `allowAlias=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = - setallowAlias(message, value) +proc `fend=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = + setfend(message, value) -proc cleardeprecated*(message: google_protobuf_EnumOptions) = - message.deprecated = false +proc clearoptions*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.options = nil clearFields(message, [3]) -proc hasdeprecated*(message: google_protobuf_EnumOptions): bool = +proc hasoptions*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = result = hasField(message, 3) -proc setdeprecated*(message: google_protobuf_EnumOptions, value: bool) = - message.deprecated = value +proc setoptions*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) = + message.options = value setField(message, 3) -proc deprecated*(message: google_protobuf_EnumOptions): bool {.inline.} = - message.deprecated - -proc `deprecated=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = - setdeprecated(message, value) - -proc clearuninterpretedOption*(message: google_protobuf_EnumOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) - -proc hasuninterpretedOption*(message: google_protobuf_EnumOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) - -proc setuninterpretedOption*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) - -proc adduninterpretedOption*(message: google_protobuf_EnumOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) - -proc uninterpretedOption*(message: google_protobuf_EnumOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption +proc options*(message: google_protobuf_DescriptorProto_ExtensionRange): google_protobuf_ExtensionRangeOptions {.inline.} = + message.options -proc `uninterpretedOption=`*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) +proc `options=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) {.inline.} = + setoptions(message, value) -proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 = - if hasallowAlias(message): +proc sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange*(message: google_protobuf_DescriptorProto_ExtensionRange): uint64 = + if hasstart(message): + result = result + sizeOfTag(1, WireType.Varint) + result = result + sizeOfInt32(message.start) + if hasfend(message): result = result + sizeOfTag(2, WireType.Varint) - result = result + sizeOfBool(message.allowAlias) - if hasdeprecated(message): - result = result + sizeOfTag(3, WireType.Varint) - result = result + sizeOfBool(message.deprecated) - for value in message.uninterpretedOption: - result = result + sizeOfTag(999, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) + result = result + sizeOfInt32(message.fend) + if hasoptions(message): + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ExtensionRangeOptions(message.options)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_EnumOptions*(stream: Stream, message: google_protobuf_EnumOptions) = - if hasallowAlias(message): - protoWriteBool(stream, message.allowAlias, 2) - if hasdeprecated(message): - protoWriteBool(stream, message.deprecated, 3) - for value in message.uninterpretedOption: - writeMessage(stream, value, 999) +proc writegoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream, message: google_protobuf_DescriptorProto_ExtensionRange) = + if hasstart(message): + protoWriteInt32(stream, message.start, 1) + if hasfend(message): + protoWriteInt32(stream, message.fend, 2) + if hasoptions(message): + writeMessage(stream, message.options, 3) writeUnknownFields(stream, message) -proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions = - result = newgoogle_protobuf_EnumOptions() +proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange = + result = newgoogle_protobuf_DescriptorProto_ExtensionRange() while not atEnd(stream): let tag = readTag(stream) @@ -1180,273 +1324,221 @@ proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptio case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.Varint) + setstart(result, protoReadInt32(stream)) of 2: expectWireType(wireType, WireType.Varint) - setallowAlias(result, protoReadBool(stream)) + setfend(result, protoReadInt32(stream)) of 3: - expectWireType(wireType, WireType.Varint) - setdeprecated(result, protoReadBool(stream)) - of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) + setoptions(result, newgoogle_protobuf_ExtensionRangeOptions(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_EnumOptions): string = +proc serialize*(message: google_protobuf_DescriptorProto_ExtensionRange): string = let ss = newStringStream() - writegoogle_protobuf_EnumOptions(ss, message) + writegoogle_protobuf_DescriptorProto_ExtensionRange(ss, message) result = ss.data -proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange = let ss = newStringStream(data) - result = readgoogle_protobuf_EnumOptions(ss) + result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) -proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_EnumOptions(ss) + result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto]): string = "google.protobuf.EnumDescriptorProto" +proc fullyQualifiedName*(T: typedesc[google_protobuf_FieldOptions]): string = "google.protobuf.FieldOptions" -proc readgoogle_protobuf_EnumDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_EnumDescriptorProto(stream) -proc writegoogle_protobuf_EnumDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumDescriptorProto(stream, google_protobuf_EnumDescriptorProto(msg)) +proc readgoogle_protobuf_FieldOptionsImpl(stream: Stream): Message = readgoogle_protobuf_FieldOptions(stream) +proc writegoogle_protobuf_FieldOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FieldOptions(stream, google_protobuf_FieldOptions(msg)) -proc google_protobuf_EnumDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_EnumDescriptorProtoImpl +proc google_protobuf_FieldOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_FieldOptionsImpl + result.writeImpl = writegoogle_protobuf_FieldOptionsImpl -proc newgoogle_protobuf_EnumDescriptorProto*(): google_protobuf_EnumDescriptorProto = +proc newgoogle_protobuf_FieldOptions*(): google_protobuf_FieldOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_EnumDescriptorProtoProcs() - result.name = "" - result.value = @[] - result.options = nil - result.reservedRange = @[] - result.reservedName = @[] + result.procs = google_protobuf_FieldOptionsProcs() + result.ctype = google_protobuf_FieldOptions_CType.STRING + result.packed = false + result.jstype = google_protobuf_FieldOptions_JSType.JS_NORMAL + result.lazy = false + result.deprecated = false + result.weak = false + result.uninterpretedOption = @[] -proc clearname*(message: google_protobuf_EnumDescriptorProto) = - message.name = "" +proc clearctype*(message: google_protobuf_FieldOptions) = + message.ctype = google_protobuf_FieldOptions_CType.STRING clearFields(message, [1]) -proc hasname*(message: google_protobuf_EnumDescriptorProto): bool = +proc hasctype*(message: google_protobuf_FieldOptions): bool = result = hasField(message, 1) -proc setname*(message: google_protobuf_EnumDescriptorProto, value: string) = - message.name = value +proc setctype*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_CType) = + message.ctype = value setField(message, 1) -proc name*(message: google_protobuf_EnumDescriptorProto): string {.inline.} = - message.name +proc ctype*(message: google_protobuf_FieldOptions): google_protobuf_FieldOptions_CType {.inline.} = + message.ctype -proc `name=`*(message: google_protobuf_EnumDescriptorProto, value: string) {.inline.} = - setname(message, value) +proc `ctype=`*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_CType) {.inline.} = + setctype(message, value) -proc clearvalue*(message: google_protobuf_EnumDescriptorProto) = - message.value = @[] +proc clearpacked*(message: google_protobuf_FieldOptions) = + message.packed = false clearFields(message, [2]) -proc hasvalue*(message: google_protobuf_EnumDescriptorProto): bool = - result = hasField(message, 2) or (len(message.value) > 0) +proc haspacked*(message: google_protobuf_FieldOptions): bool = + result = hasField(message, 2) -proc setvalue*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumValueDescriptorProto]) = - message.value = value +proc setpacked*(message: google_protobuf_FieldOptions, value: bool) = + message.packed = value setField(message, 2) -proc addvalue*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumValueDescriptorProto) = - add(message.value, value) +proc packed*(message: google_protobuf_FieldOptions): bool {.inline.} = + message.packed -proc value*(message: google_protobuf_EnumDescriptorProto): seq[google_protobuf_EnumValueDescriptorProto] {.inline.} = - message.value +proc `packed=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = + setpacked(message, value) -proc `value=`*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumValueDescriptorProto]) {.inline.} = - setvalue(message, value) +proc clearjstype*(message: google_protobuf_FieldOptions) = + message.jstype = google_protobuf_FieldOptions_JSType.JS_NORMAL + clearFields(message, [6]) -proc clearoptions*(message: google_protobuf_EnumDescriptorProto) = - message.options = nil - clearFields(message, [3]) +proc hasjstype*(message: google_protobuf_FieldOptions): bool = + result = hasField(message, 6) -proc hasoptions*(message: google_protobuf_EnumDescriptorProto): bool = - result = hasField(message, 3) +proc setjstype*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_JSType) = + message.jstype = value + setField(message, 6) -proc setoptions*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) = - message.options = value - setField(message, 3) +proc jstype*(message: google_protobuf_FieldOptions): google_protobuf_FieldOptions_JSType {.inline.} = + message.jstype -proc options*(message: google_protobuf_EnumDescriptorProto): google_protobuf_EnumOptions {.inline.} = - message.options +proc `jstype=`*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_JSType) {.inline.} = + setjstype(message, value) -proc `options=`*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) {.inline.} = - setoptions(message, value) +proc clearlazy*(message: google_protobuf_FieldOptions) = + message.lazy = false + clearFields(message, [5]) -proc clearreservedRange*(message: google_protobuf_EnumDescriptorProto) = - message.reservedRange = @[] - clearFields(message, [4]) - -proc hasreservedRange*(message: google_protobuf_EnumDescriptorProto): bool = - result = hasField(message, 4) or (len(message.reservedRange) > 0) - -proc setreservedRange*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumDescriptorProto_EnumReservedRange]) = - message.reservedRange = value - setField(message, 4) - -proc addreservedRange*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumDescriptorProto_EnumReservedRange) = - add(message.reservedRange, value) - -proc reservedRange*(message: google_protobuf_EnumDescriptorProto): seq[google_protobuf_EnumDescriptorProto_EnumReservedRange] {.inline.} = - message.reservedRange - -proc `reservedRange=`*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumDescriptorProto_EnumReservedRange]) {.inline.} = - setreservedRange(message, value) - -proc clearreservedName*(message: google_protobuf_EnumDescriptorProto) = - message.reservedName = @[] - clearFields(message, [5]) - -proc hasreservedName*(message: google_protobuf_EnumDescriptorProto): bool = - result = hasField(message, 5) or (len(message.reservedName) > 0) +proc haslazy*(message: google_protobuf_FieldOptions): bool = + result = hasField(message, 5) -proc setreservedName*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) = - message.reservedName = value +proc setlazy*(message: google_protobuf_FieldOptions, value: bool) = + message.lazy = value setField(message, 5) -proc addreservedName*(message: google_protobuf_EnumDescriptorProto, value: string) = - add(message.reservedName, value) - -proc reservedName*(message: google_protobuf_EnumDescriptorProto): seq[string] {.inline.} = - message.reservedName - -proc `reservedName=`*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) {.inline.} = - setreservedName(message, value) +proc lazy*(message: google_protobuf_FieldOptions): bool {.inline.} = + message.lazy -proc sizeOfgoogle_protobuf_EnumDescriptorProto*(message: google_protobuf_EnumDescriptorProto): uint64 = - if hasname(message): - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.name) - for value in message.value: - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumValueDescriptorProto(value)) - if hasoptions(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumOptions(message.options)) - for value in message.reservedRange: - result = result + sizeOfTag(4, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(value)) - for value in message.reservedName: - result = result + sizeOfTag(5, WireType.LengthDelimited) - result = result + sizeOfString(value) - result = result + sizeOfUnknownFields(message) +proc `lazy=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = + setlazy(message, value) -proc writegoogle_protobuf_EnumDescriptorProto*(stream: Stream, message: google_protobuf_EnumDescriptorProto) = - if hasname(message): - protoWriteString(stream, message.name, 1) - for value in message.value: - writeMessage(stream, value, 2) - if hasoptions(message): - writeMessage(stream, message.options, 3) - for value in message.reservedRange: - writeMessage(stream, value, 4) - for value in message.reservedName: - protoWriteString(stream, value, 5) - writeUnknownFields(stream, message) +proc cleardeprecated*(message: google_protobuf_FieldOptions) = + message.deprecated = false + clearFields(message, [3]) -proc readgoogle_protobuf_EnumDescriptorProto*(stream: Stream): google_protobuf_EnumDescriptorProto = - result = newgoogle_protobuf_EnumDescriptorProto() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.LengthDelimited) - setname(result, protoReadString(stream)) - of 2: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addvalue(result, newgoogle_protobuf_EnumValueDescriptorProto(data)) - of 3: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_EnumOptions(data)) - of 4: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addreservedRange(result, newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(data)) - of 5: - expectWireType(wireType, WireType.LengthDelimited) - addreservedName(result, protoReadString(stream)) - else: readUnknownField(stream, result, tag) +proc hasdeprecated*(message: google_protobuf_FieldOptions): bool = + result = hasField(message, 3) -proc serialize*(message: google_protobuf_EnumDescriptorProto): string = - let - ss = newStringStream() - writegoogle_protobuf_EnumDescriptorProto(ss, message) - result = ss.data +proc setdeprecated*(message: google_protobuf_FieldOptions, value: bool) = + message.deprecated = value + setField(message, 3) -proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto = - let - ss = newStringStream(data) - result = readgoogle_protobuf_EnumDescriptorProto(ss) +proc deprecated*(message: google_protobuf_FieldOptions): bool {.inline.} = + message.deprecated -proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_EnumDescriptorProto(ss) +proc `deprecated=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = + setdeprecated(message, value) +proc clearweak*(message: google_protobuf_FieldOptions) = + message.weak = false + clearFields(message, [10]) -proc fullyQualifiedName*(T: typedesc[google_protobuf_ExtensionRangeOptions]): string = "google.protobuf.ExtensionRangeOptions" +proc hasweak*(message: google_protobuf_FieldOptions): bool = + result = hasField(message, 10) -proc readgoogle_protobuf_ExtensionRangeOptionsImpl(stream: Stream): Message = readgoogle_protobuf_ExtensionRangeOptions(stream) -proc writegoogle_protobuf_ExtensionRangeOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ExtensionRangeOptions(stream, google_protobuf_ExtensionRangeOptions(msg)) +proc setweak*(message: google_protobuf_FieldOptions, value: bool) = + message.weak = value + setField(message, 10) -proc google_protobuf_ExtensionRangeOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_ExtensionRangeOptionsImpl - result.writeImpl = writegoogle_protobuf_ExtensionRangeOptionsImpl +proc weak*(message: google_protobuf_FieldOptions): bool {.inline.} = + message.weak -proc newgoogle_protobuf_ExtensionRangeOptions*(): google_protobuf_ExtensionRangeOptions = - new(result) - initMessage(result[]) - result.procs = google_protobuf_ExtensionRangeOptionsProcs() - result.uninterpretedOption = @[] +proc `weak=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = + setweak(message, value) -proc clearuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions) = +proc clearuninterpretedOption*(message: google_protobuf_FieldOptions) = message.uninterpretedOption = @[] clearFields(message, [999]) -proc hasuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions): bool = +proc hasuninterpretedOption*(message: google_protobuf_FieldOptions): bool = result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc setuninterpretedOption*(message: google_protobuf_ExtensionRangeOptions, value: seq[google_protobuf_UninterpretedOption]) = +proc setuninterpretedOption*(message: google_protobuf_FieldOptions, value: seq[google_protobuf_UninterpretedOption]) = message.uninterpretedOption = value setField(message, 999) -proc adduninterpretedOption*(message: google_protobuf_ExtensionRangeOptions, value: google_protobuf_UninterpretedOption) = +proc adduninterpretedOption*(message: google_protobuf_FieldOptions, value: google_protobuf_UninterpretedOption) = add(message.uninterpretedOption, value) -proc uninterpretedOption*(message: google_protobuf_ExtensionRangeOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = +proc uninterpretedOption*(message: google_protobuf_FieldOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = message.uninterpretedOption -proc `uninterpretedOption=`*(message: google_protobuf_ExtensionRangeOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = +proc `uninterpretedOption=`*(message: google_protobuf_FieldOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = setuninterpretedOption(message, value) -proc sizeOfgoogle_protobuf_ExtensionRangeOptions*(message: google_protobuf_ExtensionRangeOptions): uint64 = +proc sizeOfgoogle_protobuf_FieldOptions*(message: google_protobuf_FieldOptions): uint64 = + if hasctype(message): + result = result + sizeOfTag(1, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_FieldOptions_CType](message.ctype) + if haspacked(message): + result = result + sizeOfTag(2, WireType.Varint) + result = result + sizeOfBool(message.packed) + if hasjstype(message): + result = result + sizeOfTag(6, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_FieldOptions_JSType](message.jstype) + if haslazy(message): + result = result + sizeOfTag(5, WireType.Varint) + result = result + sizeOfBool(message.lazy) + if hasdeprecated(message): + result = result + sizeOfTag(3, WireType.Varint) + result = result + sizeOfBool(message.deprecated) + if hasweak(message): + result = result + sizeOfTag(10, WireType.Varint) + result = result + sizeOfBool(message.weak) for value in message.uninterpretedOption: result = result + sizeOfTag(999, WireType.LengthDelimited) result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_ExtensionRangeOptions*(stream: Stream, message: google_protobuf_ExtensionRangeOptions) = +proc writegoogle_protobuf_FieldOptions*(stream: Stream, message: google_protobuf_FieldOptions) = + if hasctype(message): + protoWriteEnum(stream, message.ctype, 1) + if haspacked(message): + protoWriteBool(stream, message.packed, 2) + if hasjstype(message): + protoWriteEnum(stream, message.jstype, 6) + if haslazy(message): + protoWriteBool(stream, message.lazy, 5) + if hasdeprecated(message): + protoWriteBool(stream, message.deprecated, 3) + if hasweak(message): + protoWriteBool(stream, message.weak, 10) for value in message.uninterpretedOption: writeMessage(stream, value, 999) writeUnknownFields(stream, message) -proc readgoogle_protobuf_ExtensionRangeOptions*(stream: Stream): google_protobuf_ExtensionRangeOptions = - result = newgoogle_protobuf_ExtensionRangeOptions() +proc readgoogle_protobuf_FieldOptions*(stream: Stream): google_protobuf_FieldOptions = + result = newgoogle_protobuf_FieldOptions() while not atEnd(stream): let tag = readTag(stream) @@ -1454,292 +1546,299 @@ proc readgoogle_protobuf_ExtensionRangeOptions*(stream: Stream): google_protobuf case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.Varint) + setctype(result, protoReadEnum[google_protobuf_FieldOptions_CType](stream)) + of 2: + expectWireType(wireType, WireType.Varint) + setpacked(result, protoReadBool(stream)) + of 6: + expectWireType(wireType, WireType.Varint) + setjstype(result, protoReadEnum[google_protobuf_FieldOptions_JSType](stream)) + of 5: + expectWireType(wireType, WireType.Varint) + setlazy(result, protoReadBool(stream)) + of 3: + expectWireType(wireType, WireType.Varint) + setdeprecated(result, protoReadBool(stream)) + of 10: + expectWireType(wireType, WireType.Varint) + setweak(result, protoReadBool(stream)) of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_ExtensionRangeOptions): string = +proc serialize*(message: google_protobuf_FieldOptions): string = let ss = newStringStream() - writegoogle_protobuf_ExtensionRangeOptions(ss, message) + writegoogle_protobuf_FieldOptions(ss, message) result = ss.data -proc newgoogle_protobuf_ExtensionRangeOptions*(data: string): google_protobuf_ExtensionRangeOptions = +proc newgoogle_protobuf_FieldOptions*(data: string): google_protobuf_FieldOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_ExtensionRangeOptions(ss) + result = readgoogle_protobuf_FieldOptions(ss) -proc newgoogle_protobuf_ExtensionRangeOptions*(data: seq[byte]): google_protobuf_ExtensionRangeOptions = +proc newgoogle_protobuf_FieldOptions*(data: seq[byte]): google_protobuf_FieldOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_ExtensionRangeOptions(ss) + result = readgoogle_protobuf_FieldOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo_Location]): string = "google.protobuf.SourceCodeInfo.Location" +proc fullyQualifiedName*(T: typedesc[google_protobuf_FieldDescriptorProto]): string = "google.protobuf.FieldDescriptorProto" -proc readgoogle_protobuf_SourceCodeInfo_LocationImpl(stream: Stream): Message = readgoogle_protobuf_SourceCodeInfo_Location(stream) -proc writegoogle_protobuf_SourceCodeInfo_LocationImpl(stream: Stream, msg: Message) = writegoogle_protobuf_SourceCodeInfo_Location(stream, google_protobuf_SourceCodeInfo_Location(msg)) +proc readgoogle_protobuf_FieldDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_FieldDescriptorProto(stream) +proc writegoogle_protobuf_FieldDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FieldDescriptorProto(stream, google_protobuf_FieldDescriptorProto(msg)) -proc google_protobuf_SourceCodeInfo_LocationProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_SourceCodeInfo_LocationImpl - result.writeImpl = writegoogle_protobuf_SourceCodeInfo_LocationImpl +proc google_protobuf_FieldDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_FieldDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_FieldDescriptorProtoImpl -proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location = +proc newgoogle_protobuf_FieldDescriptorProto*(): google_protobuf_FieldDescriptorProto = new(result) initMessage(result[]) - result.procs = google_protobuf_SourceCodeInfo_LocationProcs() - result.path = @[] - result.span = @[] - result.leadingComments = "" - result.trailingComments = "" - result.leadingDetachedComments = @[] - -proc clearpath*(message: google_protobuf_SourceCodeInfo_Location) = - message.path = @[] - clearFields(message, [1]) - -proc haspath*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 1) or (len(message.path) > 0) - -proc setpath*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = - message.path = value - setField(message, 1) - -proc addpath*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = - add(message.path, value) - -proc path*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = - message.path - -proc `path=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = - setpath(message, value) - -proc clearspan*(message: google_protobuf_SourceCodeInfo_Location) = - message.span = @[] - clearFields(message, [2]) + result.procs = google_protobuf_FieldDescriptorProtoProcs() + result.name = "" + result.number = 0 + result.label = google_protobuf_FieldDescriptorProto_Label.LABEL_OPTIONAL + result.ftype = google_protobuf_FieldDescriptorProto_Type.TYPE_DOUBLE + result.typeName = "" + result.extendee = "" + result.defaultValue = "" + result.oneofIndex = 0 + result.jsonName = "" + result.options = nil -proc hasspan*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 2) or (len(message.span) > 0) +proc clearname*(message: google_protobuf_FieldDescriptorProto) = + message.name = "" + clearFields(message, [1]) -proc setspan*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = - message.span = value - setField(message, 2) +proc hasname*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 1) -proc addspan*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = - add(message.span, value) +proc setname*(message: google_protobuf_FieldDescriptorProto, value: string) = + message.name = value + setField(message, 1) -proc span*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = - message.span +proc name*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = + message.name -proc `span=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = - setspan(message, value) +proc `name=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = + setname(message, value) -proc clearleadingComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.leadingComments = "" +proc clearnumber*(message: google_protobuf_FieldDescriptorProto) = + message.number = 0 clearFields(message, [3]) -proc hasleadingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = +proc hasnumber*(message: google_protobuf_FieldDescriptorProto): bool = result = hasField(message, 3) -proc setleadingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - message.leadingComments = value +proc setnumber*(message: google_protobuf_FieldDescriptorProto, value: int32) = + message.number = value setField(message, 3) -proc leadingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = - message.leadingComments +proc number*(message: google_protobuf_FieldDescriptorProto): int32 {.inline.} = + message.number -proc `leadingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = - setleadingComments(message, value) +proc `number=`*(message: google_protobuf_FieldDescriptorProto, value: int32) {.inline.} = + setnumber(message, value) -proc cleartrailingComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.trailingComments = "" +proc clearlabel*(message: google_protobuf_FieldDescriptorProto) = + message.label = google_protobuf_FieldDescriptorProto_Label.LABEL_OPTIONAL clearFields(message, [4]) -proc hastrailingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = +proc haslabel*(message: google_protobuf_FieldDescriptorProto): bool = result = hasField(message, 4) -proc settrailingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - message.trailingComments = value +proc setlabel*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Label) = + message.label = value setField(message, 4) -proc trailingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = - message.trailingComments +proc label*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldDescriptorProto_Label {.inline.} = + message.label -proc `trailingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = - settrailingComments(message, value) +proc `label=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Label) {.inline.} = + setlabel(message, value) -proc clearleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.leadingDetachedComments = @[] - clearFields(message, [6]) +proc clearftype*(message: google_protobuf_FieldDescriptorProto) = + message.ftype = google_protobuf_FieldDescriptorProto_Type.TYPE_DOUBLE + clearFields(message, [5]) -proc hasleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 6) or (len(message.leadingDetachedComments) > 0) +proc hasftype*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 5) -proc setleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) = - message.leadingDetachedComments = value - setField(message, 6) +proc setftype*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Type) = + message.ftype = value + setField(message, 5) -proc addleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - add(message.leadingDetachedComments, value) +proc ftype*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldDescriptorProto_Type {.inline.} = + message.ftype -proc leadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): seq[string] {.inline.} = - message.leadingDetachedComments +proc `ftype=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Type) {.inline.} = + setftype(message, value) -proc `leadingDetachedComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) {.inline.} = - setleadingDetachedComments(message, value) +proc cleartypeName*(message: google_protobuf_FieldDescriptorProto) = + message.typeName = "" + clearFields(message, [6]) -proc sizeOfgoogle_protobuf_SourceCodeInfo_Location*(message: google_protobuf_SourceCodeInfo_Location): uint64 = - if len(message.path) > 0: - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(packedFieldSize(message.path, FieldType.Int32)) - if len(message.span) > 0: - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(packedFieldSize(message.span, FieldType.Int32)) - if hasleadingComments(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfString(message.leadingComments) - if hastrailingComments(message): - result = result + sizeOfTag(4, WireType.LengthDelimited) - result = result + sizeOfString(message.trailingComments) - for value in message.leadingDetachedComments: - result = result + sizeOfTag(6, WireType.LengthDelimited) - result = result + sizeOfString(value) - result = result + sizeOfUnknownFields(message) +proc hastypeName*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 6) -proc writegoogle_protobuf_SourceCodeInfo_Location*(stream: Stream, message: google_protobuf_SourceCodeInfo_Location) = - if len(message.path) > 0: - writeTag(stream, 1, WireType.LengthDelimited) - writeVarint(stream, packedFieldSize(message.path, FieldType.Int32)) - for value in message.path: - protoWriteInt32(stream, value) - if len(message.span) > 0: - writeTag(stream, 2, WireType.LengthDelimited) - writeVarint(stream, packedFieldSize(message.span, FieldType.Int32)) - for value in message.span: - protoWriteInt32(stream, value) - if hasleadingComments(message): - protoWriteString(stream, message.leadingComments, 3) - if hastrailingComments(message): - protoWriteString(stream, message.trailingComments, 4) - for value in message.leadingDetachedComments: - protoWriteString(stream, value, 6) - writeUnknownFields(stream, message) +proc settypeName*(message: google_protobuf_FieldDescriptorProto, value: string) = + message.typeName = value + setField(message, 6) -proc readgoogle_protobuf_SourceCodeInfo_Location*(stream: Stream): google_protobuf_SourceCodeInfo_Location = - result = newgoogle_protobuf_SourceCodeInfo_Location() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) - if wireType == WireType.LengthDelimited: - let - size = readVarint(stream) - start = uint64(getPosition(stream)) - var consumed = 0'u64 - while consumed < size: - addpath(result, protoReadInt32(stream)) - consumed = uint64(getPosition(stream)) - start - if consumed != size: - raise newException(Exception, "packed field size mismatch") - else: - addpath(result, protoReadInt32(stream)) - of 2: - expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) - if wireType == WireType.LengthDelimited: - let - size = readVarint(stream) - start = uint64(getPosition(stream)) - var consumed = 0'u64 - while consumed < size: - addspan(result, protoReadInt32(stream)) - consumed = uint64(getPosition(stream)) - start - if consumed != size: - raise newException(Exception, "packed field size mismatch") - else: - addspan(result, protoReadInt32(stream)) - of 3: - expectWireType(wireType, WireType.LengthDelimited) - setleadingComments(result, protoReadString(stream)) - of 4: - expectWireType(wireType, WireType.LengthDelimited) - settrailingComments(result, protoReadString(stream)) - of 6: - expectWireType(wireType, WireType.LengthDelimited) - addleadingDetachedComments(result, protoReadString(stream)) - else: readUnknownField(stream, result, tag) +proc typeName*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = + message.typeName -proc serialize*(message: google_protobuf_SourceCodeInfo_Location): string = - let - ss = newStringStream() - writegoogle_protobuf_SourceCodeInfo_Location(ss, message) - result = ss.data +proc `typeName=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = + settypeName(message, value) -proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location = - let - ss = newStringStream(data) - result = readgoogle_protobuf_SourceCodeInfo_Location(ss) +proc clearextendee*(message: google_protobuf_FieldDescriptorProto) = + message.extendee = "" + clearFields(message, [2]) -proc newgoogle_protobuf_SourceCodeInfo_Location*(data: seq[byte]): google_protobuf_SourceCodeInfo_Location = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_SourceCodeInfo_Location(ss) +proc hasextendee*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 2) +proc setextendee*(message: google_protobuf_FieldDescriptorProto, value: string) = + message.extendee = value + setField(message, 2) -proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo]): string = "google.protobuf.SourceCodeInfo" +proc extendee*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = + message.extendee -proc readgoogle_protobuf_SourceCodeInfoImpl(stream: Stream): Message = readgoogle_protobuf_SourceCodeInfo(stream) -proc writegoogle_protobuf_SourceCodeInfoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_SourceCodeInfo(stream, google_protobuf_SourceCodeInfo(msg)) +proc `extendee=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = + setextendee(message, value) -proc google_protobuf_SourceCodeInfoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_SourceCodeInfoImpl - result.writeImpl = writegoogle_protobuf_SourceCodeInfoImpl +proc cleardefaultValue*(message: google_protobuf_FieldDescriptorProto) = + message.defaultValue = "" + clearFields(message, [7]) -proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo = - new(result) - initMessage(result[]) - result.procs = google_protobuf_SourceCodeInfoProcs() - result.location = @[] +proc hasdefaultValue*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 7) -proc clearlocation*(message: google_protobuf_SourceCodeInfo) = - message.location = @[] - clearFields(message, [1]) +proc setdefaultValue*(message: google_protobuf_FieldDescriptorProto, value: string) = + message.defaultValue = value + setField(message, 7) -proc haslocation*(message: google_protobuf_SourceCodeInfo): bool = - result = hasField(message, 1) or (len(message.location) > 0) +proc defaultValue*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = + message.defaultValue -proc setlocation*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) = - message.location = value - setField(message, 1) +proc `defaultValue=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = + setdefaultValue(message, value) -proc addlocation*(message: google_protobuf_SourceCodeInfo, value: google_protobuf_SourceCodeInfo_Location) = - add(message.location, value) +proc clearoneofIndex*(message: google_protobuf_FieldDescriptorProto) = + message.oneofIndex = 0 + clearFields(message, [9]) -proc location*(message: google_protobuf_SourceCodeInfo): seq[google_protobuf_SourceCodeInfo_Location] {.inline.} = - message.location +proc hasoneofIndex*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 9) -proc `location=`*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) {.inline.} = - setlocation(message, value) +proc setoneofIndex*(message: google_protobuf_FieldDescriptorProto, value: int32) = + message.oneofIndex = value + setField(message, 9) -proc sizeOfgoogle_protobuf_SourceCodeInfo*(message: google_protobuf_SourceCodeInfo): uint64 = - for value in message.location: +proc oneofIndex*(message: google_protobuf_FieldDescriptorProto): int32 {.inline.} = + message.oneofIndex + +proc `oneofIndex=`*(message: google_protobuf_FieldDescriptorProto, value: int32) {.inline.} = + setoneofIndex(message, value) + +proc clearjsonName*(message: google_protobuf_FieldDescriptorProto) = + message.jsonName = "" + clearFields(message, [10]) + +proc hasjsonName*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 10) + +proc setjsonName*(message: google_protobuf_FieldDescriptorProto, value: string) = + message.jsonName = value + setField(message, 10) + +proc jsonName*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = + message.jsonName + +proc `jsonName=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = + setjsonName(message, value) + +proc clearoptions*(message: google_protobuf_FieldDescriptorProto) = + message.options = nil + clearFields(message, [8]) + +proc hasoptions*(message: google_protobuf_FieldDescriptorProto): bool = + result = hasField(message, 8) + +proc setoptions*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldOptions) = + message.options = value + setField(message, 8) + +proc options*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldOptions {.inline.} = + message.options + +proc `options=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldOptions) {.inline.} = + setoptions(message, value) + +proc sizeOfgoogle_protobuf_FieldDescriptorProto*(message: google_protobuf_FieldDescriptorProto): uint64 = + if hasname(message): result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_SourceCodeInfo_Location(value)) + result = result + sizeOfString(message.name) + if hasnumber(message): + result = result + sizeOfTag(3, WireType.Varint) + result = result + sizeOfInt32(message.number) + if haslabel(message): + result = result + sizeOfTag(4, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_FieldDescriptorProto_Label](message.label) + if hasftype(message): + result = result + sizeOfTag(5, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_FieldDescriptorProto_Type](message.ftype) + if hastypeName(message): + result = result + sizeOfTag(6, WireType.LengthDelimited) + result = result + sizeOfString(message.typeName) + if hasextendee(message): + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfString(message.extendee) + if hasdefaultValue(message): + result = result + sizeOfTag(7, WireType.LengthDelimited) + result = result + sizeOfString(message.defaultValue) + if hasoneofIndex(message): + result = result + sizeOfTag(9, WireType.Varint) + result = result + sizeOfInt32(message.oneofIndex) + if hasjsonName(message): + result = result + sizeOfTag(10, WireType.LengthDelimited) + result = result + sizeOfString(message.jsonName) + if hasoptions(message): + result = result + sizeOfTag(8, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldOptions(message.options)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) = - for value in message.location: - writeMessage(stream, value, 1) +proc writegoogle_protobuf_FieldDescriptorProto*(stream: Stream, message: google_protobuf_FieldDescriptorProto) = + if hasname(message): + protoWriteString(stream, message.name, 1) + if hasnumber(message): + protoWriteInt32(stream, message.number, 3) + if haslabel(message): + protoWriteEnum(stream, message.label, 4) + if hasftype(message): + protoWriteEnum(stream, message.ftype, 5) + if hastypeName(message): + protoWriteString(stream, message.typeName, 6) + if hasextendee(message): + protoWriteString(stream, message.extendee, 2) + if hasdefaultValue(message): + protoWriteString(stream, message.defaultValue, 7) + if hasoneofIndex(message): + protoWriteInt32(stream, message.oneofIndex, 9) + if hasjsonName(message): + protoWriteString(stream, message.jsonName, 10) + if hasoptions(message): + writeMessage(stream, message.options, 8) writeUnknownFields(stream, message) -proc readgoogle_protobuf_SourceCodeInfo*(stream: Stream): google_protobuf_SourceCodeInfo = - result = newgoogle_protobuf_SourceCodeInfo() +proc readgoogle_protobuf_FieldDescriptorProto*(stream: Stream): google_protobuf_FieldDescriptorProto = + result = newgoogle_protobuf_FieldDescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -1748,214 +1847,149 @@ proc readgoogle_protobuf_SourceCodeInfo*(stream: Stream): google_protobuf_Source of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: + expectWireType(wireType, WireType.LengthDelimited) + setname(result, protoReadString(stream)) + of 3: + expectWireType(wireType, WireType.Varint) + setnumber(result, protoReadInt32(stream)) + of 4: + expectWireType(wireType, WireType.Varint) + setlabel(result, protoReadEnum[google_protobuf_FieldDescriptorProto_Label](stream)) + of 5: + expectWireType(wireType, WireType.Varint) + setftype(result, protoReadEnum[google_protobuf_FieldDescriptorProto_Type](stream)) + of 6: + expectWireType(wireType, WireType.LengthDelimited) + settypeName(result, protoReadString(stream)) + of 2: + expectWireType(wireType, WireType.LengthDelimited) + setextendee(result, protoReadString(stream)) + of 7: + expectWireType(wireType, WireType.LengthDelimited) + setdefaultValue(result, protoReadString(stream)) + of 9: + expectWireType(wireType, WireType.Varint) + setoneofIndex(result, protoReadInt32(stream)) + of 10: + expectWireType(wireType, WireType.LengthDelimited) + setjsonName(result, protoReadString(stream)) + of 8: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - addlocation(result, newgoogle_protobuf_SourceCodeInfo_Location(data)) + setoptions(result, newgoogle_protobuf_FieldOptions(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_SourceCodeInfo): string = +proc serialize*(message: google_protobuf_FieldDescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_SourceCodeInfo(ss, message) + writegoogle_protobuf_FieldDescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo = +proc newgoogle_protobuf_FieldDescriptorProto*(data: string): google_protobuf_FieldDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_SourceCodeInfo(ss) + result = readgoogle_protobuf_FieldDescriptorProto(ss) -proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo = +proc newgoogle_protobuf_FieldDescriptorProto*(data: seq[byte]): google_protobuf_FieldDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_SourceCodeInfo(ss) + result = readgoogle_protobuf_FieldDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_FieldOptions]): string = "google.protobuf.FieldOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodOptions]): string = "google.protobuf.MethodOptions" -proc readgoogle_protobuf_FieldOptionsImpl(stream: Stream): Message = readgoogle_protobuf_FieldOptions(stream) -proc writegoogle_protobuf_FieldOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FieldOptions(stream, google_protobuf_FieldOptions(msg)) +proc readgoogle_protobuf_MethodOptionsImpl(stream: Stream): Message = readgoogle_protobuf_MethodOptions(stream) +proc writegoogle_protobuf_MethodOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MethodOptions(stream, google_protobuf_MethodOptions(msg)) -proc google_protobuf_FieldOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_FieldOptionsImpl - result.writeImpl = writegoogle_protobuf_FieldOptionsImpl +proc google_protobuf_MethodOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MethodOptionsImpl + result.writeImpl = writegoogle_protobuf_MethodOptionsImpl -proc newgoogle_protobuf_FieldOptions*(): google_protobuf_FieldOptions = +proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_FieldOptionsProcs() - result.ctype = google_protobuf_FieldOptions_CType.STRING - result.packed = false - result.jstype = google_protobuf_FieldOptions_JSType.JS_NORMAL - result.lazy = false + result.procs = google_protobuf_MethodOptionsProcs() result.deprecated = false - result.weak = false + result.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN result.uninterpretedOption = @[] -proc clearctype*(message: google_protobuf_FieldOptions) = - message.ctype = google_protobuf_FieldOptions_CType.STRING - clearFields(message, [1]) +proc cleardeprecated*(message: google_protobuf_MethodOptions) = + message.deprecated = false + clearFields(message, [33]) -proc hasctype*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 1) +proc hasdeprecated*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 33) -proc setctype*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_CType) = - message.ctype = value - setField(message, 1) +proc setdeprecated*(message: google_protobuf_MethodOptions, value: bool) = + message.deprecated = value + setField(message, 33) -proc ctype*(message: google_protobuf_FieldOptions): google_protobuf_FieldOptions_CType {.inline.} = - message.ctype +proc deprecated*(message: google_protobuf_MethodOptions): bool {.inline.} = + message.deprecated -proc `ctype=`*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_CType) {.inline.} = - setctype(message, value) +proc `deprecated=`*(message: google_protobuf_MethodOptions, value: bool) {.inline.} = + setdeprecated(message, value) -proc clearpacked*(message: google_protobuf_FieldOptions) = - message.packed = false - clearFields(message, [2]) +proc clearidempotencyLevel*(message: google_protobuf_MethodOptions) = + message.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN + clearFields(message, [34]) -proc haspacked*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 2) +proc hasidempotencyLevel*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 34) -proc setpacked*(message: google_protobuf_FieldOptions, value: bool) = - message.packed = value - setField(message, 2) +proc setidempotencyLevel*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) = + message.idempotencyLevel = value + setField(message, 34) -proc packed*(message: google_protobuf_FieldOptions): bool {.inline.} = - message.packed +proc idempotencyLevel*(message: google_protobuf_MethodOptions): google_protobuf_MethodOptions_IdempotencyLevel {.inline.} = + message.idempotencyLevel -proc `packed=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = - setpacked(message, value) +proc `idempotencyLevel=`*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) {.inline.} = + setidempotencyLevel(message, value) -proc clearjstype*(message: google_protobuf_FieldOptions) = - message.jstype = google_protobuf_FieldOptions_JSType.JS_NORMAL - clearFields(message, [6]) +proc clearuninterpretedOption*(message: google_protobuf_MethodOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc hasjstype*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 6) +proc hasuninterpretedOption*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc setjstype*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_JSType) = - message.jstype = value - setField(message, 6) +proc setuninterpretedOption*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc jstype*(message: google_protobuf_FieldOptions): google_protobuf_FieldOptions_JSType {.inline.} = - message.jstype +proc adduninterpretedOption*(message: google_protobuf_MethodOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc `jstype=`*(message: google_protobuf_FieldOptions, value: google_protobuf_FieldOptions_JSType) {.inline.} = - setjstype(message, value) +proc uninterpretedOption*(message: google_protobuf_MethodOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -proc clearlazy*(message: google_protobuf_FieldOptions) = - message.lazy = false - clearFields(message, [5]) - -proc haslazy*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 5) - -proc setlazy*(message: google_protobuf_FieldOptions, value: bool) = - message.lazy = value - setField(message, 5) - -proc lazy*(message: google_protobuf_FieldOptions): bool {.inline.} = - message.lazy - -proc `lazy=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = - setlazy(message, value) - -proc cleardeprecated*(message: google_protobuf_FieldOptions) = - message.deprecated = false - clearFields(message, [3]) - -proc hasdeprecated*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 3) - -proc setdeprecated*(message: google_protobuf_FieldOptions, value: bool) = - message.deprecated = value - setField(message, 3) - -proc deprecated*(message: google_protobuf_FieldOptions): bool {.inline.} = - message.deprecated - -proc `deprecated=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = - setdeprecated(message, value) - -proc clearweak*(message: google_protobuf_FieldOptions) = - message.weak = false - clearFields(message, [10]) - -proc hasweak*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 10) - -proc setweak*(message: google_protobuf_FieldOptions, value: bool) = - message.weak = value - setField(message, 10) - -proc weak*(message: google_protobuf_FieldOptions): bool {.inline.} = - message.weak - -proc `weak=`*(message: google_protobuf_FieldOptions, value: bool) {.inline.} = - setweak(message, value) - -proc clearuninterpretedOption*(message: google_protobuf_FieldOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) - -proc hasuninterpretedOption*(message: google_protobuf_FieldOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) - -proc setuninterpretedOption*(message: google_protobuf_FieldOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) - -proc adduninterpretedOption*(message: google_protobuf_FieldOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) - -proc uninterpretedOption*(message: google_protobuf_FieldOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption - -proc `uninterpretedOption=`*(message: google_protobuf_FieldOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = +proc `uninterpretedOption=`*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = setuninterpretedOption(message, value) -proc sizeOfgoogle_protobuf_FieldOptions*(message: google_protobuf_FieldOptions): uint64 = - if hasctype(message): - result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_FieldOptions_CType](message.ctype) - if haspacked(message): - result = result + sizeOfTag(2, WireType.Varint) - result = result + sizeOfBool(message.packed) - if hasjstype(message): - result = result + sizeOfTag(6, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_FieldOptions_JSType](message.jstype) - if haslazy(message): - result = result + sizeOfTag(5, WireType.Varint) - result = result + sizeOfBool(message.lazy) +proc sizeOfgoogle_protobuf_MethodOptions*(message: google_protobuf_MethodOptions): uint64 = if hasdeprecated(message): - result = result + sizeOfTag(3, WireType.Varint) + result = result + sizeOfTag(33, WireType.Varint) result = result + sizeOfBool(message.deprecated) - if hasweak(message): - result = result + sizeOfTag(10, WireType.Varint) - result = result + sizeOfBool(message.weak) + if hasidempotencyLevel(message): + result = result + sizeOfTag(34, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_MethodOptions_IdempotencyLevel](message.idempotencyLevel) for value in message.uninterpretedOption: result = result + sizeOfTag(999, WireType.LengthDelimited) result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_FieldOptions*(stream: Stream, message: google_protobuf_FieldOptions) = - if hasctype(message): - protoWriteEnum(stream, message.ctype, 1) - if haspacked(message): - protoWriteBool(stream, message.packed, 2) - if hasjstype(message): - protoWriteEnum(stream, message.jstype, 6) - if haslazy(message): - protoWriteBool(stream, message.lazy, 5) +proc writegoogle_protobuf_MethodOptions*(stream: Stream, message: google_protobuf_MethodOptions) = if hasdeprecated(message): - protoWriteBool(stream, message.deprecated, 3) - if hasweak(message): - protoWriteBool(stream, message.weak, 10) + protoWriteBool(stream, message.deprecated, 33) + if hasidempotencyLevel(message): + protoWriteEnum(stream, message.idempotencyLevel, 34) for value in message.uninterpretedOption: writeMessage(stream, value, 999) writeUnknownFields(stream, message) -proc readgoogle_protobuf_FieldOptions*(stream: Stream): google_protobuf_FieldOptions = - result = newgoogle_protobuf_FieldOptions() +proc readgoogle_protobuf_MethodOptions*(stream: Stream): google_protobuf_MethodOptions = + result = newgoogle_protobuf_MethodOptions() while not atEnd(stream): let tag = readTag(stream) @@ -1963,299 +1997,195 @@ proc readgoogle_protobuf_FieldOptions*(stream: Stream): google_protobuf_FieldOpt case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.Varint) - setctype(result, protoReadEnum[google_protobuf_FieldOptions_CType](stream)) - of 2: - expectWireType(wireType, WireType.Varint) - setpacked(result, protoReadBool(stream)) - of 6: - expectWireType(wireType, WireType.Varint) - setjstype(result, protoReadEnum[google_protobuf_FieldOptions_JSType](stream)) - of 5: - expectWireType(wireType, WireType.Varint) - setlazy(result, protoReadBool(stream)) - of 3: + of 33: expectWireType(wireType, WireType.Varint) setdeprecated(result, protoReadBool(stream)) - of 10: + of 34: expectWireType(wireType, WireType.Varint) - setweak(result, protoReadBool(stream)) + setidempotencyLevel(result, protoReadEnum[google_protobuf_MethodOptions_IdempotencyLevel](stream)) of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_FieldOptions): string = +proc serialize*(message: google_protobuf_MethodOptions): string = let ss = newStringStream() - writegoogle_protobuf_FieldOptions(ss, message) + writegoogle_protobuf_MethodOptions(ss, message) result = ss.data -proc newgoogle_protobuf_FieldOptions*(data: string): google_protobuf_FieldOptions = +proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_FieldOptions(ss) + result = readgoogle_protobuf_MethodOptions(ss) -proc newgoogle_protobuf_FieldOptions*(data: seq[byte]): google_protobuf_FieldOptions = +proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_FieldOptions(ss) + result = readgoogle_protobuf_MethodOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_FieldDescriptorProto]): string = "google.protobuf.FieldDescriptorProto" +proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodDescriptorProto]): string = "google.protobuf.MethodDescriptorProto" -proc readgoogle_protobuf_FieldDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_FieldDescriptorProto(stream) -proc writegoogle_protobuf_FieldDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FieldDescriptorProto(stream, google_protobuf_FieldDescriptorProto(msg)) +proc readgoogle_protobuf_MethodDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_MethodDescriptorProto(stream) +proc writegoogle_protobuf_MethodDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MethodDescriptorProto(stream, google_protobuf_MethodDescriptorProto(msg)) -proc google_protobuf_FieldDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_FieldDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_FieldDescriptorProtoImpl +proc google_protobuf_MethodDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MethodDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_MethodDescriptorProtoImpl -proc newgoogle_protobuf_FieldDescriptorProto*(): google_protobuf_FieldDescriptorProto = +proc newgoogle_protobuf_MethodDescriptorProto*(): google_protobuf_MethodDescriptorProto = new(result) initMessage(result[]) - result.procs = google_protobuf_FieldDescriptorProtoProcs() + result.procs = google_protobuf_MethodDescriptorProtoProcs() result.name = "" - result.number = 0 - result.label = google_protobuf_FieldDescriptorProto_Label.LABEL_OPTIONAL - result.ftype = google_protobuf_FieldDescriptorProto_Type.TYPE_DOUBLE - result.typeName = "" - result.extendee = "" - result.defaultValue = "" - result.oneofIndex = 0 - result.jsonName = "" + result.inputType = "" + result.outputType = "" result.options = nil + result.clientStreaming = false + result.serverStreaming = false -proc clearname*(message: google_protobuf_FieldDescriptorProto) = +proc clearname*(message: google_protobuf_MethodDescriptorProto) = message.name = "" clearFields(message, [1]) -proc hasname*(message: google_protobuf_FieldDescriptorProto): bool = +proc hasname*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 1) -proc setname*(message: google_protobuf_FieldDescriptorProto, value: string) = +proc setname*(message: google_protobuf_MethodDescriptorProto, value: string) = message.name = value setField(message, 1) -proc name*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = +proc name*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = message.name -proc `name=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = +proc `name=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = setname(message, value) -proc clearnumber*(message: google_protobuf_FieldDescriptorProto) = - message.number = 0 +proc clearinputType*(message: google_protobuf_MethodDescriptorProto) = + message.inputType = "" + clearFields(message, [2]) + +proc hasinputType*(message: google_protobuf_MethodDescriptorProto): bool = + result = hasField(message, 2) + +proc setinputType*(message: google_protobuf_MethodDescriptorProto, value: string) = + message.inputType = value + setField(message, 2) + +proc inputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = + message.inputType + +proc `inputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = + setinputType(message, value) + +proc clearoutputType*(message: google_protobuf_MethodDescriptorProto) = + message.outputType = "" clearFields(message, [3]) -proc hasnumber*(message: google_protobuf_FieldDescriptorProto): bool = +proc hasoutputType*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 3) -proc setnumber*(message: google_protobuf_FieldDescriptorProto, value: int32) = - message.number = value +proc setoutputType*(message: google_protobuf_MethodDescriptorProto, value: string) = + message.outputType = value setField(message, 3) -proc number*(message: google_protobuf_FieldDescriptorProto): int32 {.inline.} = - message.number +proc outputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = + message.outputType -proc `number=`*(message: google_protobuf_FieldDescriptorProto, value: int32) {.inline.} = - setnumber(message, value) +proc `outputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = + setoutputType(message, value) -proc clearlabel*(message: google_protobuf_FieldDescriptorProto) = - message.label = google_protobuf_FieldDescriptorProto_Label.LABEL_OPTIONAL +proc clearoptions*(message: google_protobuf_MethodDescriptorProto) = + message.options = nil clearFields(message, [4]) -proc haslabel*(message: google_protobuf_FieldDescriptorProto): bool = +proc hasoptions*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 4) -proc setlabel*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Label) = - message.label = value +proc setoptions*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) = + message.options = value setField(message, 4) -proc label*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldDescriptorProto_Label {.inline.} = - message.label +proc options*(message: google_protobuf_MethodDescriptorProto): google_protobuf_MethodOptions {.inline.} = + message.options -proc `label=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Label) {.inline.} = - setlabel(message, value) +proc `options=`*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) {.inline.} = + setoptions(message, value) -proc clearftype*(message: google_protobuf_FieldDescriptorProto) = - message.ftype = google_protobuf_FieldDescriptorProto_Type.TYPE_DOUBLE +proc clearclientStreaming*(message: google_protobuf_MethodDescriptorProto) = + message.clientStreaming = false clearFields(message, [5]) -proc hasftype*(message: google_protobuf_FieldDescriptorProto): bool = +proc hasclientStreaming*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 5) -proc setftype*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Type) = - message.ftype = value +proc setclientStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = + message.clientStreaming = value setField(message, 5) -proc ftype*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldDescriptorProto_Type {.inline.} = - message.ftype +proc clientStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = + message.clientStreaming -proc `ftype=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldDescriptorProto_Type) {.inline.} = - setftype(message, value) +proc `clientStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = + setclientStreaming(message, value) -proc cleartypeName*(message: google_protobuf_FieldDescriptorProto) = - message.typeName = "" +proc clearserverStreaming*(message: google_protobuf_MethodDescriptorProto) = + message.serverStreaming = false clearFields(message, [6]) -proc hastypeName*(message: google_protobuf_FieldDescriptorProto): bool = +proc hasserverStreaming*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 6) -proc settypeName*(message: google_protobuf_FieldDescriptorProto, value: string) = - message.typeName = value +proc setserverStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = + message.serverStreaming = value setField(message, 6) -proc typeName*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = - message.typeName - -proc `typeName=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = - settypeName(message, value) - -proc clearextendee*(message: google_protobuf_FieldDescriptorProto) = - message.extendee = "" - clearFields(message, [2]) - -proc hasextendee*(message: google_protobuf_FieldDescriptorProto): bool = - result = hasField(message, 2) - -proc setextendee*(message: google_protobuf_FieldDescriptorProto, value: string) = - message.extendee = value - setField(message, 2) - -proc extendee*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = - message.extendee - -proc `extendee=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = - setextendee(message, value) - -proc cleardefaultValue*(message: google_protobuf_FieldDescriptorProto) = - message.defaultValue = "" - clearFields(message, [7]) - -proc hasdefaultValue*(message: google_protobuf_FieldDescriptorProto): bool = - result = hasField(message, 7) - -proc setdefaultValue*(message: google_protobuf_FieldDescriptorProto, value: string) = - message.defaultValue = value - setField(message, 7) - -proc defaultValue*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = - message.defaultValue - -proc `defaultValue=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = - setdefaultValue(message, value) - -proc clearoneofIndex*(message: google_protobuf_FieldDescriptorProto) = - message.oneofIndex = 0 - clearFields(message, [9]) - -proc hasoneofIndex*(message: google_protobuf_FieldDescriptorProto): bool = - result = hasField(message, 9) - -proc setoneofIndex*(message: google_protobuf_FieldDescriptorProto, value: int32) = - message.oneofIndex = value - setField(message, 9) - -proc oneofIndex*(message: google_protobuf_FieldDescriptorProto): int32 {.inline.} = - message.oneofIndex - -proc `oneofIndex=`*(message: google_protobuf_FieldDescriptorProto, value: int32) {.inline.} = - setoneofIndex(message, value) - -proc clearjsonName*(message: google_protobuf_FieldDescriptorProto) = - message.jsonName = "" - clearFields(message, [10]) - -proc hasjsonName*(message: google_protobuf_FieldDescriptorProto): bool = - result = hasField(message, 10) - -proc setjsonName*(message: google_protobuf_FieldDescriptorProto, value: string) = - message.jsonName = value - setField(message, 10) - -proc jsonName*(message: google_protobuf_FieldDescriptorProto): string {.inline.} = - message.jsonName - -proc `jsonName=`*(message: google_protobuf_FieldDescriptorProto, value: string) {.inline.} = - setjsonName(message, value) - -proc clearoptions*(message: google_protobuf_FieldDescriptorProto) = - message.options = nil - clearFields(message, [8]) - -proc hasoptions*(message: google_protobuf_FieldDescriptorProto): bool = - result = hasField(message, 8) - -proc setoptions*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldOptions) = - message.options = value - setField(message, 8) - -proc options*(message: google_protobuf_FieldDescriptorProto): google_protobuf_FieldOptions {.inline.} = - message.options +proc serverStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = + message.serverStreaming -proc `options=`*(message: google_protobuf_FieldDescriptorProto, value: google_protobuf_FieldOptions) {.inline.} = - setoptions(message, value) +proc `serverStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = + setserverStreaming(message, value) -proc sizeOfgoogle_protobuf_FieldDescriptorProto*(message: google_protobuf_FieldDescriptorProto): uint64 = +proc sizeOfgoogle_protobuf_MethodDescriptorProto*(message: google_protobuf_MethodDescriptorProto): uint64 = if hasname(message): result = result + sizeOfTag(1, WireType.LengthDelimited) result = result + sizeOfString(message.name) - if hasnumber(message): - result = result + sizeOfTag(3, WireType.Varint) - result = result + sizeOfInt32(message.number) - if haslabel(message): - result = result + sizeOfTag(4, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_FieldDescriptorProto_Label](message.label) - if hasftype(message): - result = result + sizeOfTag(5, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_FieldDescriptorProto_Type](message.ftype) - if hastypeName(message): - result = result + sizeOfTag(6, WireType.LengthDelimited) - result = result + sizeOfString(message.typeName) - if hasextendee(message): + if hasinputType(message): result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfString(message.extendee) - if hasdefaultValue(message): - result = result + sizeOfTag(7, WireType.LengthDelimited) - result = result + sizeOfString(message.defaultValue) - if hasoneofIndex(message): - result = result + sizeOfTag(9, WireType.Varint) - result = result + sizeOfInt32(message.oneofIndex) - if hasjsonName(message): - result = result + sizeOfTag(10, WireType.LengthDelimited) - result = result + sizeOfString(message.jsonName) + result = result + sizeOfString(message.inputType) + if hasoutputType(message): + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfString(message.outputType) if hasoptions(message): - result = result + sizeOfTag(8, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldOptions(message.options)) + result = result + sizeOfTag(4, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MethodOptions(message.options)) + if hasclientStreaming(message): + result = result + sizeOfTag(5, WireType.Varint) + result = result + sizeOfBool(message.clientStreaming) + if hasserverStreaming(message): + result = result + sizeOfTag(6, WireType.Varint) + result = result + sizeOfBool(message.serverStreaming) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_FieldDescriptorProto*(stream: Stream, message: google_protobuf_FieldDescriptorProto) = +proc writegoogle_protobuf_MethodDescriptorProto*(stream: Stream, message: google_protobuf_MethodDescriptorProto) = if hasname(message): protoWriteString(stream, message.name, 1) - if hasnumber(message): - protoWriteInt32(stream, message.number, 3) - if haslabel(message): - protoWriteEnum(stream, message.label, 4) - if hasftype(message): - protoWriteEnum(stream, message.ftype, 5) - if hastypeName(message): - protoWriteString(stream, message.typeName, 6) - if hasextendee(message): - protoWriteString(stream, message.extendee, 2) - if hasdefaultValue(message): - protoWriteString(stream, message.defaultValue, 7) - if hasoneofIndex(message): - protoWriteInt32(stream, message.oneofIndex, 9) - if hasjsonName(message): - protoWriteString(stream, message.jsonName, 10) + if hasinputType(message): + protoWriteString(stream, message.inputType, 2) + if hasoutputType(message): + protoWriteString(stream, message.outputType, 3) if hasoptions(message): - writeMessage(stream, message.options, 8) + writeMessage(stream, message.options, 4) + if hasclientStreaming(message): + protoWriteBool(stream, message.clientStreaming, 5) + if hasserverStreaming(message): + protoWriteBool(stream, message.serverStreaming, 6) writeUnknownFields(stream, message) -proc readgoogle_protobuf_FieldDescriptorProto*(stream: Stream): google_protobuf_FieldDescriptorProto = - result = newgoogle_protobuf_FieldDescriptorProto() +proc readgoogle_protobuf_MethodDescriptorProto*(stream: Stream): google_protobuf_MethodDescriptorProto = + result = newgoogle_protobuf_MethodDescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -2266,144 +2196,187 @@ proc readgoogle_protobuf_FieldDescriptorProto*(stream: Stream): google_protobuf_ of 1: expectWireType(wireType, WireType.LengthDelimited) setname(result, protoReadString(stream)) + of 2: + expectWireType(wireType, WireType.LengthDelimited) + setinputType(result, protoReadString(stream)) of 3: - expectWireType(wireType, WireType.Varint) - setnumber(result, protoReadInt32(stream)) + expectWireType(wireType, WireType.LengthDelimited) + setoutputType(result, protoReadString(stream)) of 4: - expectWireType(wireType, WireType.Varint) - setlabel(result, protoReadEnum[google_protobuf_FieldDescriptorProto_Label](stream)) + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + setoptions(result, newgoogle_protobuf_MethodOptions(data)) of 5: expectWireType(wireType, WireType.Varint) - setftype(result, protoReadEnum[google_protobuf_FieldDescriptorProto_Type](stream)) + setclientStreaming(result, protoReadBool(stream)) of 6: - expectWireType(wireType, WireType.LengthDelimited) - settypeName(result, protoReadString(stream)) - of 2: - expectWireType(wireType, WireType.LengthDelimited) - setextendee(result, protoReadString(stream)) - of 7: - expectWireType(wireType, WireType.LengthDelimited) - setdefaultValue(result, protoReadString(stream)) - of 9: expectWireType(wireType, WireType.Varint) - setoneofIndex(result, protoReadInt32(stream)) - of 10: - expectWireType(wireType, WireType.LengthDelimited) - setjsonName(result, protoReadString(stream)) - of 8: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_FieldOptions(data)) + setserverStreaming(result, protoReadBool(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_FieldDescriptorProto): string = +proc serialize*(message: google_protobuf_MethodDescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_FieldDescriptorProto(ss, message) + writegoogle_protobuf_MethodDescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_FieldDescriptorProto*(data: string): google_protobuf_FieldDescriptorProto = +proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_FieldDescriptorProto(ss) + result = readgoogle_protobuf_MethodDescriptorProto(ss) -proc newgoogle_protobuf_FieldDescriptorProto*(data: seq[byte]): google_protobuf_FieldDescriptorProto = +proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_FieldDescriptorProto(ss) + result = readgoogle_protobuf_MethodDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ExtensionRange]): string = "google.protobuf.DescriptorProto.ExtensionRange" +proc fullyQualifiedName*(T: typedesc[google_protobuf_OneofOptions]): string = "google.protobuf.OneofOptions" -proc readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto_ExtensionRange(stream) -proc writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl(stream: Stream, msg: Message) = writegoogle_protobuf_DescriptorProto_ExtensionRange(stream, google_protobuf_DescriptorProto_ExtensionRange(msg)) +proc readgoogle_protobuf_OneofOptionsImpl(stream: Stream): Message = readgoogle_protobuf_OneofOptions(stream) +proc writegoogle_protobuf_OneofOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_OneofOptions(stream, google_protobuf_OneofOptions(msg)) -proc google_protobuf_DescriptorProto_ExtensionRangeProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl - result.writeImpl = writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl +proc google_protobuf_OneofOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_OneofOptionsImpl + result.writeImpl = writegoogle_protobuf_OneofOptionsImpl -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_OneofOptions*(): google_protobuf_OneofOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_DescriptorProto_ExtensionRangeProcs() - result.start = 0 - result.fend = 0 - result.options = nil + result.procs = google_protobuf_OneofOptionsProcs() + result.uninterpretedOption = @[] -proc clearstart*(message: google_protobuf_DescriptorProto_ExtensionRange) = - message.start = 0 - clearFields(message, [1]) +proc clearuninterpretedOption*(message: google_protobuf_OneofOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc hasstart*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 1) +proc hasuninterpretedOption*(message: google_protobuf_OneofOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc setstart*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = - message.start = value - setField(message, 1) +proc setuninterpretedOption*(message: google_protobuf_OneofOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc start*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = - message.start +proc adduninterpretedOption*(message: google_protobuf_OneofOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc `start=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = - setstart(message, value) +proc uninterpretedOption*(message: google_protobuf_OneofOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -proc clearfend*(message: google_protobuf_DescriptorProto_ExtensionRange) = - message.fend = 0 - clearFields(message, [2]) +proc `uninterpretedOption=`*(message: google_protobuf_OneofOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) -proc hasfend*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 2) +proc sizeOfgoogle_protobuf_OneofOptions*(message: google_protobuf_OneofOptions): uint64 = + for value in message.uninterpretedOption: + result = result + sizeOfTag(999, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) + result = result + sizeOfUnknownFields(message) -proc setfend*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = - message.fend = value - setField(message, 2) +proc writegoogle_protobuf_OneofOptions*(stream: Stream, message: google_protobuf_OneofOptions) = + for value in message.uninterpretedOption: + writeMessage(stream, value, 999) + writeUnknownFields(stream, message) -proc fend*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = - message.fend +proc readgoogle_protobuf_OneofOptions*(stream: Stream): google_protobuf_OneofOptions = + result = newgoogle_protobuf_OneofOptions() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 999: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) + else: readUnknownField(stream, result, tag) -proc `fend=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = - setfend(message, value) +proc serialize*(message: google_protobuf_OneofOptions): string = + let + ss = newStringStream() + writegoogle_protobuf_OneofOptions(ss, message) + result = ss.data -proc clearoptions*(message: google_protobuf_DescriptorProto_ExtensionRange) = +proc newgoogle_protobuf_OneofOptions*(data: string): google_protobuf_OneofOptions = + let + ss = newStringStream(data) + result = readgoogle_protobuf_OneofOptions(ss) + +proc newgoogle_protobuf_OneofOptions*(data: seq[byte]): google_protobuf_OneofOptions = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_OneofOptions(ss) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_OneofDescriptorProto]): string = "google.protobuf.OneofDescriptorProto" + +proc readgoogle_protobuf_OneofDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_OneofDescriptorProto(stream) +proc writegoogle_protobuf_OneofDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_OneofDescriptorProto(stream, google_protobuf_OneofDescriptorProto(msg)) + +proc google_protobuf_OneofDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_OneofDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_OneofDescriptorProtoImpl + +proc newgoogle_protobuf_OneofDescriptorProto*(): google_protobuf_OneofDescriptorProto = + new(result) + initMessage(result[]) + result.procs = google_protobuf_OneofDescriptorProtoProcs() + result.name = "" + result.options = nil + +proc clearname*(message: google_protobuf_OneofDescriptorProto) = + message.name = "" + clearFields(message, [1]) + +proc hasname*(message: google_protobuf_OneofDescriptorProto): bool = + result = hasField(message, 1) + +proc setname*(message: google_protobuf_OneofDescriptorProto, value: string) = + message.name = value + setField(message, 1) + +proc name*(message: google_protobuf_OneofDescriptorProto): string {.inline.} = + message.name + +proc `name=`*(message: google_protobuf_OneofDescriptorProto, value: string) {.inline.} = + setname(message, value) + +proc clearoptions*(message: google_protobuf_OneofDescriptorProto) = message.options = nil - clearFields(message, [3]) + clearFields(message, [2]) -proc hasoptions*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 3) +proc hasoptions*(message: google_protobuf_OneofDescriptorProto): bool = + result = hasField(message, 2) -proc setoptions*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) = +proc setoptions*(message: google_protobuf_OneofDescriptorProto, value: google_protobuf_OneofOptions) = message.options = value - setField(message, 3) + setField(message, 2) -proc options*(message: google_protobuf_DescriptorProto_ExtensionRange): google_protobuf_ExtensionRangeOptions {.inline.} = +proc options*(message: google_protobuf_OneofDescriptorProto): google_protobuf_OneofOptions {.inline.} = message.options -proc `options=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) {.inline.} = +proc `options=`*(message: google_protobuf_OneofDescriptorProto, value: google_protobuf_OneofOptions) {.inline.} = setoptions(message, value) -proc sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange*(message: google_protobuf_DescriptorProto_ExtensionRange): uint64 = - if hasstart(message): - result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfInt32(message.start) - if hasfend(message): - result = result + sizeOfTag(2, WireType.Varint) - result = result + sizeOfInt32(message.fend) +proc sizeOfgoogle_protobuf_OneofDescriptorProto*(message: google_protobuf_OneofDescriptorProto): uint64 = + if hasname(message): + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfString(message.name) if hasoptions(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ExtensionRangeOptions(message.options)) + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_OneofOptions(message.options)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream, message: google_protobuf_DescriptorProto_ExtensionRange) = - if hasstart(message): - protoWriteInt32(stream, message.start, 1) - if hasfend(message): - protoWriteInt32(stream, message.fend, 2) +proc writegoogle_protobuf_OneofDescriptorProto*(stream: Stream, message: google_protobuf_OneofDescriptorProto) = + if hasname(message): + protoWriteString(stream, message.name, 1) if hasoptions(message): - writeMessage(stream, message.options, 3) + writeMessage(stream, message.options, 2) writeUnknownFields(stream, message) -proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange = - result = newgoogle_protobuf_DescriptorProto_ExtensionRange() +proc readgoogle_protobuf_OneofDescriptorProto*(stream: Stream): google_protobuf_OneofDescriptorProto = + result = newgoogle_protobuf_OneofDescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -2412,174 +2385,125 @@ proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.Varint) - setstart(result, protoReadInt32(stream)) + expectWireType(wireType, WireType.LengthDelimited) + setname(result, protoReadString(stream)) of 2: - expectWireType(wireType, WireType.Varint) - setfend(result, protoReadInt32(stream)) - of 3: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_ExtensionRangeOptions(data)) + setoptions(result, newgoogle_protobuf_OneofOptions(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_DescriptorProto_ExtensionRange): string = +proc serialize*(message: google_protobuf_OneofDescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_DescriptorProto_ExtensionRange(ss, message) + writegoogle_protobuf_OneofDescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_OneofDescriptorProto*(data: string): google_protobuf_OneofDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) + result = readgoogle_protobuf_OneofDescriptorProto(ss) -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_OneofDescriptorProto*(data: seq[byte]): google_protobuf_OneofDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) + result = readgoogle_protobuf_OneofDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_MessageOptions]): string = "google.protobuf.MessageOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumOptions]): string = "google.protobuf.EnumOptions" -proc readgoogle_protobuf_MessageOptionsImpl(stream: Stream): Message = readgoogle_protobuf_MessageOptions(stream) -proc writegoogle_protobuf_MessageOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MessageOptions(stream, google_protobuf_MessageOptions(msg)) +proc readgoogle_protobuf_EnumOptionsImpl(stream: Stream): Message = readgoogle_protobuf_EnumOptions(stream) +proc writegoogle_protobuf_EnumOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumOptions(stream, google_protobuf_EnumOptions(msg)) -proc google_protobuf_MessageOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MessageOptionsImpl - result.writeImpl = writegoogle_protobuf_MessageOptionsImpl +proc google_protobuf_EnumOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumOptionsImpl + result.writeImpl = writegoogle_protobuf_EnumOptionsImpl -proc newgoogle_protobuf_MessageOptions*(): google_protobuf_MessageOptions = +proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_MessageOptionsProcs() - result.messageSetWireFormat = false - result.noStandardDescriptorAccessor = false + result.procs = google_protobuf_EnumOptionsProcs() + result.allowAlias = false result.deprecated = false - result.mapEntry = false result.uninterpretedOption = @[] -proc clearmessageSetWireFormat*(message: google_protobuf_MessageOptions) = - message.messageSetWireFormat = false - clearFields(message, [1]) - -proc hasmessageSetWireFormat*(message: google_protobuf_MessageOptions): bool = - result = hasField(message, 1) - -proc setmessageSetWireFormat*(message: google_protobuf_MessageOptions, value: bool) = - message.messageSetWireFormat = value - setField(message, 1) - -proc messageSetWireFormat*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.messageSetWireFormat - -proc `messageSetWireFormat=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setmessageSetWireFormat(message, value) - -proc clearnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions) = - message.noStandardDescriptorAccessor = false +proc clearallowAlias*(message: google_protobuf_EnumOptions) = + message.allowAlias = false clearFields(message, [2]) -proc hasnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool = +proc hasallowAlias*(message: google_protobuf_EnumOptions): bool = result = hasField(message, 2) -proc setnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions, value: bool) = - message.noStandardDescriptorAccessor = value +proc setallowAlias*(message: google_protobuf_EnumOptions, value: bool) = + message.allowAlias = value setField(message, 2) -proc noStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.noStandardDescriptorAccessor +proc allowAlias*(message: google_protobuf_EnumOptions): bool {.inline.} = + message.allowAlias -proc `noStandardDescriptorAccessor=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setnoStandardDescriptorAccessor(message, value) +proc `allowAlias=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = + setallowAlias(message, value) -proc cleardeprecated*(message: google_protobuf_MessageOptions) = +proc cleardeprecated*(message: google_protobuf_EnumOptions) = message.deprecated = false clearFields(message, [3]) -proc hasdeprecated*(message: google_protobuf_MessageOptions): bool = +proc hasdeprecated*(message: google_protobuf_EnumOptions): bool = result = hasField(message, 3) -proc setdeprecated*(message: google_protobuf_MessageOptions, value: bool) = +proc setdeprecated*(message: google_protobuf_EnumOptions, value: bool) = message.deprecated = value setField(message, 3) -proc deprecated*(message: google_protobuf_MessageOptions): bool {.inline.} = +proc deprecated*(message: google_protobuf_EnumOptions): bool {.inline.} = message.deprecated -proc `deprecated=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = +proc `deprecated=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = setdeprecated(message, value) -proc clearmapEntry*(message: google_protobuf_MessageOptions) = - message.mapEntry = false - clearFields(message, [7]) - -proc hasmapEntry*(message: google_protobuf_MessageOptions): bool = - result = hasField(message, 7) - -proc setmapEntry*(message: google_protobuf_MessageOptions, value: bool) = - message.mapEntry = value - setField(message, 7) - -proc mapEntry*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.mapEntry - -proc `mapEntry=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setmapEntry(message, value) - -proc clearuninterpretedOption*(message: google_protobuf_MessageOptions) = +proc clearuninterpretedOption*(message: google_protobuf_EnumOptions) = message.uninterpretedOption = @[] clearFields(message, [999]) -proc hasuninterpretedOption*(message: google_protobuf_MessageOptions): bool = +proc hasuninterpretedOption*(message: google_protobuf_EnumOptions): bool = result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc setuninterpretedOption*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) = +proc setuninterpretedOption*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) = message.uninterpretedOption = value setField(message, 999) -proc adduninterpretedOption*(message: google_protobuf_MessageOptions, value: google_protobuf_UninterpretedOption) = +proc adduninterpretedOption*(message: google_protobuf_EnumOptions, value: google_protobuf_UninterpretedOption) = add(message.uninterpretedOption, value) -proc uninterpretedOption*(message: google_protobuf_MessageOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = +proc uninterpretedOption*(message: google_protobuf_EnumOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = message.uninterpretedOption -proc `uninterpretedOption=`*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = +proc `uninterpretedOption=`*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = setuninterpretedOption(message, value) -proc sizeOfgoogle_protobuf_MessageOptions*(message: google_protobuf_MessageOptions): uint64 = - if hasmessageSetWireFormat(message): - result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfBool(message.messageSetWireFormat) - if hasnoStandardDescriptorAccessor(message): +proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 = + if hasallowAlias(message): result = result + sizeOfTag(2, WireType.Varint) - result = result + sizeOfBool(message.noStandardDescriptorAccessor) + result = result + sizeOfBool(message.allowAlias) if hasdeprecated(message): result = result + sizeOfTag(3, WireType.Varint) result = result + sizeOfBool(message.deprecated) - if hasmapEntry(message): - result = result + sizeOfTag(7, WireType.Varint) - result = result + sizeOfBool(message.mapEntry) for value in message.uninterpretedOption: result = result + sizeOfTag(999, WireType.LengthDelimited) result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_MessageOptions*(stream: Stream, message: google_protobuf_MessageOptions) = - if hasmessageSetWireFormat(message): - protoWriteBool(stream, message.messageSetWireFormat, 1) - if hasnoStandardDescriptorAccessor(message): - protoWriteBool(stream, message.noStandardDescriptorAccessor, 2) +proc writegoogle_protobuf_EnumOptions*(stream: Stream, message: google_protobuf_EnumOptions) = + if hasallowAlias(message): + protoWriteBool(stream, message.allowAlias, 2) if hasdeprecated(message): protoWriteBool(stream, message.deprecated, 3) - if hasmapEntry(message): - protoWriteBool(stream, message.mapEntry, 7) for value in message.uninterpretedOption: writeMessage(stream, value, 999) writeUnknownFields(stream, message) -proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_MessageOptions = - result = newgoogle_protobuf_MessageOptions() +proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions = + result = newgoogle_protobuf_EnumOptions() while not atEnd(stream): let tag = readTag(stream) @@ -2587,187 +2511,187 @@ proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_Messag case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.Varint) - setmessageSetWireFormat(result, protoReadBool(stream)) of 2: expectWireType(wireType, WireType.Varint) - setnoStandardDescriptorAccessor(result, protoReadBool(stream)) + setallowAlias(result, protoReadBool(stream)) of 3: expectWireType(wireType, WireType.Varint) setdeprecated(result, protoReadBool(stream)) - of 7: - expectWireType(wireType, WireType.Varint) - setmapEntry(result, protoReadBool(stream)) of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_MessageOptions): string = +proc serialize*(message: google_protobuf_EnumOptions): string = let ss = newStringStream() - writegoogle_protobuf_MessageOptions(ss, message) + writegoogle_protobuf_EnumOptions(ss, message) result = ss.data -proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions = +proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_MessageOptions(ss) + result = readgoogle_protobuf_EnumOptions(ss) -proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions = +proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MessageOptions(ss) + result = readgoogle_protobuf_EnumOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_OneofOptions]): string = "google.protobuf.OneofOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo_Location]): string = "google.protobuf.SourceCodeInfo.Location" -proc readgoogle_protobuf_OneofOptionsImpl(stream: Stream): Message = readgoogle_protobuf_OneofOptions(stream) -proc writegoogle_protobuf_OneofOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_OneofOptions(stream, google_protobuf_OneofOptions(msg)) +proc readgoogle_protobuf_SourceCodeInfo_LocationImpl(stream: Stream): Message = readgoogle_protobuf_SourceCodeInfo_Location(stream) +proc writegoogle_protobuf_SourceCodeInfo_LocationImpl(stream: Stream, msg: Message) = writegoogle_protobuf_SourceCodeInfo_Location(stream, google_protobuf_SourceCodeInfo_Location(msg)) -proc google_protobuf_OneofOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_OneofOptionsImpl - result.writeImpl = writegoogle_protobuf_OneofOptionsImpl +proc google_protobuf_SourceCodeInfo_LocationProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_SourceCodeInfo_LocationImpl + result.writeImpl = writegoogle_protobuf_SourceCodeInfo_LocationImpl -proc newgoogle_protobuf_OneofOptions*(): google_protobuf_OneofOptions = +proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location = new(result) initMessage(result[]) - result.procs = google_protobuf_OneofOptionsProcs() - result.uninterpretedOption = @[] + result.procs = google_protobuf_SourceCodeInfo_LocationProcs() + result.path = @[] + result.span = @[] + result.leadingComments = "" + result.trailingComments = "" + result.leadingDetachedComments = @[] -proc clearuninterpretedOption*(message: google_protobuf_OneofOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) +proc clearpath*(message: google_protobuf_SourceCodeInfo_Location) = + message.path = @[] + clearFields(message, [1]) -proc hasuninterpretedOption*(message: google_protobuf_OneofOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) +proc haspath*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 1) or (len(message.path) > 0) -proc setuninterpretedOption*(message: google_protobuf_OneofOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) +proc setpath*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = + message.path = value + setField(message, 1) -proc adduninterpretedOption*(message: google_protobuf_OneofOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) +proc addpath*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = + add(message.path, value) -proc uninterpretedOption*(message: google_protobuf_OneofOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption +proc path*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = + message.path -proc `uninterpretedOption=`*(message: google_protobuf_OneofOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) +proc `path=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = + setpath(message, value) -proc sizeOfgoogle_protobuf_OneofOptions*(message: google_protobuf_OneofOptions): uint64 = - for value in message.uninterpretedOption: - result = result + sizeOfTag(999, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) - result = result + sizeOfUnknownFields(message) +proc clearspan*(message: google_protobuf_SourceCodeInfo_Location) = + message.span = @[] + clearFields(message, [2]) -proc writegoogle_protobuf_OneofOptions*(stream: Stream, message: google_protobuf_OneofOptions) = - for value in message.uninterpretedOption: - writeMessage(stream, value, 999) - writeUnknownFields(stream, message) +proc hasspan*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 2) or (len(message.span) > 0) -proc readgoogle_protobuf_OneofOptions*(stream: Stream): google_protobuf_OneofOptions = - result = newgoogle_protobuf_OneofOptions() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 999: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) - else: readUnknownField(stream, result, tag) +proc setspan*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = + message.span = value + setField(message, 2) -proc serialize*(message: google_protobuf_OneofOptions): string = - let - ss = newStringStream() - writegoogle_protobuf_OneofOptions(ss, message) - result = ss.data +proc addspan*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = + add(message.span, value) -proc newgoogle_protobuf_OneofOptions*(data: string): google_protobuf_OneofOptions = - let - ss = newStringStream(data) - result = readgoogle_protobuf_OneofOptions(ss) +proc span*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = + message.span -proc newgoogle_protobuf_OneofOptions*(data: seq[byte]): google_protobuf_OneofOptions = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_OneofOptions(ss) +proc `span=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = + setspan(message, value) +proc clearleadingComments*(message: google_protobuf_SourceCodeInfo_Location) = + message.leadingComments = "" + clearFields(message, [3]) -proc fullyQualifiedName*(T: typedesc[google_protobuf_OneofDescriptorProto]): string = "google.protobuf.OneofDescriptorProto" +proc hasleadingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 3) -proc readgoogle_protobuf_OneofDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_OneofDescriptorProto(stream) -proc writegoogle_protobuf_OneofDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_OneofDescriptorProto(stream, google_protobuf_OneofDescriptorProto(msg)) +proc setleadingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + message.leadingComments = value + setField(message, 3) -proc google_protobuf_OneofDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_OneofDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_OneofDescriptorProtoImpl +proc leadingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = + message.leadingComments -proc newgoogle_protobuf_OneofDescriptorProto*(): google_protobuf_OneofDescriptorProto = - new(result) - initMessage(result[]) - result.procs = google_protobuf_OneofDescriptorProtoProcs() - result.name = "" - result.options = nil +proc `leadingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = + setleadingComments(message, value) -proc clearname*(message: google_protobuf_OneofDescriptorProto) = - message.name = "" - clearFields(message, [1]) +proc cleartrailingComments*(message: google_protobuf_SourceCodeInfo_Location) = + message.trailingComments = "" + clearFields(message, [4]) -proc hasname*(message: google_protobuf_OneofDescriptorProto): bool = - result = hasField(message, 1) +proc hastrailingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 4) -proc setname*(message: google_protobuf_OneofDescriptorProto, value: string) = - message.name = value - setField(message, 1) +proc settrailingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + message.trailingComments = value + setField(message, 4) -proc name*(message: google_protobuf_OneofDescriptorProto): string {.inline.} = - message.name +proc trailingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = + message.trailingComments -proc `name=`*(message: google_protobuf_OneofDescriptorProto, value: string) {.inline.} = - setname(message, value) +proc `trailingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = + settrailingComments(message, value) -proc clearoptions*(message: google_protobuf_OneofDescriptorProto) = - message.options = nil - clearFields(message, [2]) +proc clearleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location) = + message.leadingDetachedComments = @[] + clearFields(message, [6]) -proc hasoptions*(message: google_protobuf_OneofDescriptorProto): bool = - result = hasField(message, 2) +proc hasleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 6) or (len(message.leadingDetachedComments) > 0) -proc setoptions*(message: google_protobuf_OneofDescriptorProto, value: google_protobuf_OneofOptions) = - message.options = value - setField(message, 2) +proc setleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) = + message.leadingDetachedComments = value + setField(message, 6) -proc options*(message: google_protobuf_OneofDescriptorProto): google_protobuf_OneofOptions {.inline.} = - message.options +proc addleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + add(message.leadingDetachedComments, value) -proc `options=`*(message: google_protobuf_OneofDescriptorProto, value: google_protobuf_OneofOptions) {.inline.} = - setoptions(message, value) +proc leadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): seq[string] {.inline.} = + message.leadingDetachedComments -proc sizeOfgoogle_protobuf_OneofDescriptorProto*(message: google_protobuf_OneofDescriptorProto): uint64 = - if hasname(message): +proc `leadingDetachedComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) {.inline.} = + setleadingDetachedComments(message, value) + +proc sizeOfgoogle_protobuf_SourceCodeInfo_Location*(message: google_protobuf_SourceCodeInfo_Location): uint64 = + if len(message.path) > 0: result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.name) - if hasoptions(message): + result = result + sizeOfLengthDelimited(packedFieldSize(message.path, FieldType.Int32)) + if len(message.span) > 0: result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_OneofOptions(message.options)) + result = result + sizeOfLengthDelimited(packedFieldSize(message.span, FieldType.Int32)) + if hasleadingComments(message): + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfString(message.leadingComments) + if hastrailingComments(message): + result = result + sizeOfTag(4, WireType.LengthDelimited) + result = result + sizeOfString(message.trailingComments) + for value in message.leadingDetachedComments: + result = result + sizeOfTag(6, WireType.LengthDelimited) + result = result + sizeOfString(value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_OneofDescriptorProto*(stream: Stream, message: google_protobuf_OneofDescriptorProto) = - if hasname(message): - protoWriteString(stream, message.name, 1) - if hasoptions(message): - writeMessage(stream, message.options, 2) +proc writegoogle_protobuf_SourceCodeInfo_Location*(stream: Stream, message: google_protobuf_SourceCodeInfo_Location) = + if len(message.path) > 0: + writeTag(stream, 1, WireType.LengthDelimited) + writeVarint(stream, packedFieldSize(message.path, FieldType.Int32)) + for value in message.path: + protoWriteInt32(stream, value) + if len(message.span) > 0: + writeTag(stream, 2, WireType.LengthDelimited) + writeVarint(stream, packedFieldSize(message.span, FieldType.Int32)) + for value in message.span: + protoWriteInt32(stream, value) + if hasleadingComments(message): + protoWriteString(stream, message.leadingComments, 3) + if hastrailingComments(message): + protoWriteString(stream, message.trailingComments, 4) + for value in message.leadingDetachedComments: + protoWriteString(stream, value, 6) writeUnknownFields(stream, message) -proc readgoogle_protobuf_OneofDescriptorProto*(stream: Stream): google_protobuf_OneofDescriptorProto = - result = newgoogle_protobuf_OneofDescriptorProto() +proc readgoogle_protobuf_SourceCodeInfo_Location*(stream: Stream): google_protobuf_SourceCodeInfo_Location = + result = newgoogle_protobuf_SourceCodeInfo_Location() while not atEnd(stream): let tag = readTag(stream) @@ -2776,29 +2700,59 @@ proc readgoogle_protobuf_OneofDescriptorProto*(stream: Stream): google_protobuf_ of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.LengthDelimited) - setname(result, protoReadString(stream)) + expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) + if wireType == WireType.LengthDelimited: + let + size = readVarint(stream) + start = uint64(getPosition(stream)) + var consumed = 0'u64 + while consumed < size: + addpath(result, protoReadInt32(stream)) + consumed = uint64(getPosition(stream)) - start + if consumed != size: + raise newException(Exception, "packed field size mismatch") + else: + addpath(result, protoReadInt32(stream)) of 2: + expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) + if wireType == WireType.LengthDelimited: + let + size = readVarint(stream) + start = uint64(getPosition(stream)) + var consumed = 0'u64 + while consumed < size: + addspan(result, protoReadInt32(stream)) + consumed = uint64(getPosition(stream)) - start + if consumed != size: + raise newException(Exception, "packed field size mismatch") + else: + addspan(result, protoReadInt32(stream)) + of 3: expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_OneofOptions(data)) + setleadingComments(result, protoReadString(stream)) + of 4: + expectWireType(wireType, WireType.LengthDelimited) + settrailingComments(result, protoReadString(stream)) + of 6: + expectWireType(wireType, WireType.LengthDelimited) + addleadingDetachedComments(result, protoReadString(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_OneofDescriptorProto): string = +proc serialize*(message: google_protobuf_SourceCodeInfo_Location): string = let ss = newStringStream() - writegoogle_protobuf_OneofDescriptorProto(ss, message) + writegoogle_protobuf_SourceCodeInfo_Location(ss, message) result = ss.data -proc newgoogle_protobuf_OneofDescriptorProto*(data: string): google_protobuf_OneofDescriptorProto = +proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location = let ss = newStringStream(data) - result = readgoogle_protobuf_OneofDescriptorProto(ss) + result = readgoogle_protobuf_SourceCodeInfo_Location(ss) -proc newgoogle_protobuf_OneofDescriptorProto*(data: seq[byte]): google_protobuf_OneofDescriptorProto = +proc newgoogle_protobuf_SourceCodeInfo_Location*(data: seq[byte]): google_protobuf_SourceCodeInfo_Location = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_OneofDescriptorProto(ss) + result = readgoogle_protobuf_SourceCodeInfo_Location(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ReservedRange]): string = "google.protobuf.DescriptorProto.ReservedRange" @@ -2901,282 +2855,330 @@ proc newgoogle_protobuf_DescriptorProto_ReservedRange*(data: seq[byte]): google_ result = readgoogle_protobuf_DescriptorProto_ReservedRange(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto]): string = "google.protobuf.DescriptorProto" +proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo]): string = "google.protobuf.SourceCodeInfo" -proc readgoogle_protobuf_DescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto(stream) -proc writegoogle_protobuf_DescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_DescriptorProto(stream, google_protobuf_DescriptorProto(msg)) +proc readgoogle_protobuf_SourceCodeInfoImpl(stream: Stream): Message = readgoogle_protobuf_SourceCodeInfo(stream) +proc writegoogle_protobuf_SourceCodeInfoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_SourceCodeInfo(stream, google_protobuf_SourceCodeInfo(msg)) -proc google_protobuf_DescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_DescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_DescriptorProtoImpl +proc google_protobuf_SourceCodeInfoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_SourceCodeInfoImpl + result.writeImpl = writegoogle_protobuf_SourceCodeInfoImpl -proc newgoogle_protobuf_DescriptorProto*(): google_protobuf_DescriptorProto = +proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo = new(result) initMessage(result[]) - result.procs = google_protobuf_DescriptorProtoProcs() - result.name = "" - result.field = @[] - result.extension = @[] - result.nestedType = @[] - result.enumType = @[] - result.extensionRange = @[] - result.oneofDecl = @[] - result.options = nil - result.reservedRange = @[] - result.reservedName = @[] + result.procs = google_protobuf_SourceCodeInfoProcs() + result.location = @[] -proc clearname*(message: google_protobuf_DescriptorProto) = - message.name = "" +proc clearlocation*(message: google_protobuf_SourceCodeInfo) = + message.location = @[] clearFields(message, [1]) -proc hasname*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 1) +proc haslocation*(message: google_protobuf_SourceCodeInfo): bool = + result = hasField(message, 1) or (len(message.location) > 0) -proc setname*(message: google_protobuf_DescriptorProto, value: string) = - message.name = value +proc setlocation*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) = + message.location = value setField(message, 1) -proc name*(message: google_protobuf_DescriptorProto): string {.inline.} = - message.name - -proc `name=`*(message: google_protobuf_DescriptorProto, value: string) {.inline.} = - setname(message, value) - -proc clearfield*(message: google_protobuf_DescriptorProto) = - message.field = @[] - clearFields(message, [2]) - -proc hasfield*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 2) or (len(message.field) > 0) - -proc setfield*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) = - message.field = value - setField(message, 2) +proc addlocation*(message: google_protobuf_SourceCodeInfo, value: google_protobuf_SourceCodeInfo_Location) = + add(message.location, value) -proc addfield*(message: google_protobuf_DescriptorProto, value: google_protobuf_FieldDescriptorProto) = - add(message.field, value) +proc location*(message: google_protobuf_SourceCodeInfo): seq[google_protobuf_SourceCodeInfo_Location] {.inline.} = + message.location -proc field*(message: google_protobuf_DescriptorProto): seq[google_protobuf_FieldDescriptorProto] {.inline.} = - message.field +proc `location=`*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) {.inline.} = + setlocation(message, value) -proc `field=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) {.inline.} = - setfield(message, value) +proc sizeOfgoogle_protobuf_SourceCodeInfo*(message: google_protobuf_SourceCodeInfo): uint64 = + for value in message.location: + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_SourceCodeInfo_Location(value)) + result = result + sizeOfUnknownFields(message) -proc clearextension*(message: google_protobuf_DescriptorProto) = - message.extension = @[] - clearFields(message, [6]) +proc writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) = + for value in message.location: + writeMessage(stream, value, 1) + writeUnknownFields(stream, message) -proc hasextension*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 6) or (len(message.extension) > 0) +proc readgoogle_protobuf_SourceCodeInfo*(stream: Stream): google_protobuf_SourceCodeInfo = + result = newgoogle_protobuf_SourceCodeInfo() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + addlocation(result, newgoogle_protobuf_SourceCodeInfo_Location(data)) + else: readUnknownField(stream, result, tag) -proc setextension*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) = - message.extension = value - setField(message, 6) +proc serialize*(message: google_protobuf_SourceCodeInfo): string = + let + ss = newStringStream() + writegoogle_protobuf_SourceCodeInfo(ss, message) + result = ss.data -proc addextension*(message: google_protobuf_DescriptorProto, value: google_protobuf_FieldDescriptorProto) = - add(message.extension, value) +proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo = + let + ss = newStringStream(data) + result = readgoogle_protobuf_SourceCodeInfo(ss) -proc extension*(message: google_protobuf_DescriptorProto): seq[google_protobuf_FieldDescriptorProto] {.inline.} = - message.extension +proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_SourceCodeInfo(ss) -proc `extension=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) {.inline.} = - setextension(message, value) -proc clearnestedType*(message: google_protobuf_DescriptorProto) = - message.nestedType = @[] - clearFields(message, [3]) +proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto_EnumReservedRange]): string = "google.protobuf.EnumDescriptorProto.EnumReservedRange" -proc hasnestedType*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 3) or (len(message.nestedType) > 0) +proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl(stream: Stream): Message = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(stream) +proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(stream, google_protobuf_EnumDescriptorProto_EnumReservedRange(msg)) -proc setnestedType*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto]) = - message.nestedType = value - setField(message, 3) +proc google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl + result.writeImpl = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl -proc addnestedType*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto) = - add(message.nestedType, value) +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(): google_protobuf_EnumDescriptorProto_EnumReservedRange = + new(result) + initMessage(result[]) + result.procs = google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs() + result.start = 0 + result.fend = 0 -proc nestedType*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto] {.inline.} = - message.nestedType +proc clearstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = + message.start = 0 + clearFields(message, [1]) -proc `nestedType=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto]) {.inline.} = - setnestedType(message, value) +proc hasstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = + result = hasField(message, 1) -proc clearenumType*(message: google_protobuf_DescriptorProto) = - message.enumType = @[] - clearFields(message, [4]) +proc setstart*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = + message.start = value + setField(message, 1) -proc hasenumType*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 4) or (len(message.enumType) > 0) +proc start*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = + message.start -proc setenumType*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_EnumDescriptorProto]) = - message.enumType = value - setField(message, 4) +proc `start=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = + setstart(message, value) -proc addenumType*(message: google_protobuf_DescriptorProto, value: google_protobuf_EnumDescriptorProto) = - add(message.enumType, value) +proc clearfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = + message.fend = 0 + clearFields(message, [2]) -proc enumType*(message: google_protobuf_DescriptorProto): seq[google_protobuf_EnumDescriptorProto] {.inline.} = - message.enumType +proc hasfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = + result = hasField(message, 2) -proc `enumType=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_EnumDescriptorProto]) {.inline.} = - setenumType(message, value) +proc setfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = + message.fend = value + setField(message, 2) -proc clearextensionRange*(message: google_protobuf_DescriptorProto) = - message.extensionRange = @[] - clearFields(message, [5]) +proc fend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = + message.fend -proc hasextensionRange*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 5) or (len(message.extensionRange) > 0) +proc `fend=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = + setfend(message, value) -proc setextensionRange*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ExtensionRange]) = - message.extensionRange = value - setField(message, 5) +proc sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): uint64 = + if hasstart(message): + result = result + sizeOfTag(1, WireType.Varint) + result = result + sizeOfInt32(message.start) + if hasfend(message): + result = result + sizeOfTag(2, WireType.Varint) + result = result + sizeOfInt32(message.fend) + result = result + sizeOfUnknownFields(message) -proc addextensionRange*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto_ExtensionRange) = - add(message.extensionRange, value) +proc writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream, message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = + if hasstart(message): + protoWriteInt32(stream, message.start, 1) + if hasfend(message): + protoWriteInt32(stream, message.fend, 2) + writeUnknownFields(stream, message) -proc extensionRange*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto_ExtensionRange] {.inline.} = - message.extensionRange +proc readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(stream: Stream): google_protobuf_EnumDescriptorProto_EnumReservedRange = + result = newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.Varint) + setstart(result, protoReadInt32(stream)) + of 2: + expectWireType(wireType, WireType.Varint) + setfend(result, protoReadInt32(stream)) + else: readUnknownField(stream, result, tag) -proc `extensionRange=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ExtensionRange]) {.inline.} = - setextensionRange(message, value) +proc serialize*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): string = + let + ss = newStringStream() + writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss, message) + result = ss.data -proc clearoneofDecl*(message: google_protobuf_DescriptorProto) = - message.oneofDecl = @[] - clearFields(message, [8]) +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange = + let + ss = newStringStream(data) + result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) -proc hasoneofDecl*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 8) or (len(message.oneofDecl) > 0) +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: seq[byte]): google_protobuf_EnumDescriptorProto_EnumReservedRange = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) -proc setoneofDecl*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_OneofDescriptorProto]) = - message.oneofDecl = value - setField(message, 8) -proc addoneofDecl*(message: google_protobuf_DescriptorProto, value: google_protobuf_OneofDescriptorProto) = - add(message.oneofDecl, value) +proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto]): string = "google.protobuf.EnumDescriptorProto" -proc oneofDecl*(message: google_protobuf_DescriptorProto): seq[google_protobuf_OneofDescriptorProto] {.inline.} = - message.oneofDecl +proc readgoogle_protobuf_EnumDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_EnumDescriptorProto(stream) +proc writegoogle_protobuf_EnumDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_EnumDescriptorProto(stream, google_protobuf_EnumDescriptorProto(msg)) -proc `oneofDecl=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_OneofDescriptorProto]) {.inline.} = - setoneofDecl(message, value) +proc google_protobuf_EnumDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_EnumDescriptorProtoImpl -proc clearoptions*(message: google_protobuf_DescriptorProto) = +proc newgoogle_protobuf_EnumDescriptorProto*(): google_protobuf_EnumDescriptorProto = + new(result) + initMessage(result[]) + result.procs = google_protobuf_EnumDescriptorProtoProcs() + result.name = "" + result.value = @[] + result.options = nil + result.reservedRange = @[] + result.reservedName = @[] + +proc clearname*(message: google_protobuf_EnumDescriptorProto) = + message.name = "" + clearFields(message, [1]) + +proc hasname*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 1) + +proc setname*(message: google_protobuf_EnumDescriptorProto, value: string) = + message.name = value + setField(message, 1) + +proc name*(message: google_protobuf_EnumDescriptorProto): string {.inline.} = + message.name + +proc `name=`*(message: google_protobuf_EnumDescriptorProto, value: string) {.inline.} = + setname(message, value) + +proc clearvalue*(message: google_protobuf_EnumDescriptorProto) = + message.value = @[] + clearFields(message, [2]) + +proc hasvalue*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 2) or (len(message.value) > 0) + +proc setvalue*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumValueDescriptorProto]) = + message.value = value + setField(message, 2) + +proc addvalue*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumValueDescriptorProto) = + add(message.value, value) + +proc value*(message: google_protobuf_EnumDescriptorProto): seq[google_protobuf_EnumValueDescriptorProto] {.inline.} = + message.value + +proc `value=`*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumValueDescriptorProto]) {.inline.} = + setvalue(message, value) + +proc clearoptions*(message: google_protobuf_EnumDescriptorProto) = message.options = nil - clearFields(message, [7]) + clearFields(message, [3]) -proc hasoptions*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 7) +proc hasoptions*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 3) -proc setoptions*(message: google_protobuf_DescriptorProto, value: google_protobuf_MessageOptions) = +proc setoptions*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) = message.options = value - setField(message, 7) + setField(message, 3) -proc options*(message: google_protobuf_DescriptorProto): google_protobuf_MessageOptions {.inline.} = +proc options*(message: google_protobuf_EnumDescriptorProto): google_protobuf_EnumOptions {.inline.} = message.options -proc `options=`*(message: google_protobuf_DescriptorProto, value: google_protobuf_MessageOptions) {.inline.} = +proc `options=`*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) {.inline.} = setoptions(message, value) -proc clearreservedRange*(message: google_protobuf_DescriptorProto) = +proc clearreservedRange*(message: google_protobuf_EnumDescriptorProto) = message.reservedRange = @[] - clearFields(message, [9]) + clearFields(message, [4]) -proc hasreservedRange*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 9) or (len(message.reservedRange) > 0) +proc hasreservedRange*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 4) or (len(message.reservedRange) > 0) -proc setreservedRange*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ReservedRange]) = +proc setreservedRange*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumDescriptorProto_EnumReservedRange]) = message.reservedRange = value - setField(message, 9) + setField(message, 4) -proc addreservedRange*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto_ReservedRange) = +proc addreservedRange*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumDescriptorProto_EnumReservedRange) = add(message.reservedRange, value) -proc reservedRange*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto_ReservedRange] {.inline.} = +proc reservedRange*(message: google_protobuf_EnumDescriptorProto): seq[google_protobuf_EnumDescriptorProto_EnumReservedRange] {.inline.} = message.reservedRange -proc `reservedRange=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ReservedRange]) {.inline.} = +proc `reservedRange=`*(message: google_protobuf_EnumDescriptorProto, value: seq[google_protobuf_EnumDescriptorProto_EnumReservedRange]) {.inline.} = setreservedRange(message, value) -proc clearreservedName*(message: google_protobuf_DescriptorProto) = +proc clearreservedName*(message: google_protobuf_EnumDescriptorProto) = message.reservedName = @[] - clearFields(message, [10]) + clearFields(message, [5]) -proc hasreservedName*(message: google_protobuf_DescriptorProto): bool = - result = hasField(message, 10) or (len(message.reservedName) > 0) +proc hasreservedName*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 5) or (len(message.reservedName) > 0) -proc setreservedName*(message: google_protobuf_DescriptorProto, value: seq[string]) = +proc setreservedName*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) = message.reservedName = value - setField(message, 10) + setField(message, 5) -proc addreservedName*(message: google_protobuf_DescriptorProto, value: string) = +proc addreservedName*(message: google_protobuf_EnumDescriptorProto, value: string) = add(message.reservedName, value) -proc reservedName*(message: google_protobuf_DescriptorProto): seq[string] {.inline.} = +proc reservedName*(message: google_protobuf_EnumDescriptorProto): seq[string] {.inline.} = message.reservedName -proc `reservedName=`*(message: google_protobuf_DescriptorProto, value: seq[string]) {.inline.} = +proc `reservedName=`*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) {.inline.} = setreservedName(message, value) -proc sizeOfgoogle_protobuf_DescriptorProto*(message: google_protobuf_DescriptorProto): uint64 = +proc sizeOfgoogle_protobuf_EnumDescriptorProto*(message: google_protobuf_EnumDescriptorProto): uint64 = if hasname(message): result = result + sizeOfTag(1, WireType.LengthDelimited) result = result + sizeOfString(message.name) - for value in message.field: + for value in message.value: result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldDescriptorProto(value)) - for value in message.extension: - result = result + sizeOfTag(6, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldDescriptorProto(value)) - for value in message.nestedType: - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto(value)) - for value in message.enumType: - result = result + sizeOfTag(4, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumDescriptorProto(value)) - for value in message.extensionRange: - result = result + sizeOfTag(5, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange(value)) - for value in message.oneofDecl: - result = result + sizeOfTag(8, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_OneofDescriptorProto(value)) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumValueDescriptorProto(value)) if hasoptions(message): - result = result + sizeOfTag(7, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MessageOptions(message.options)) + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumOptions(message.options)) for value in message.reservedRange: - result = result + sizeOfTag(9, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto_ReservedRange(value)) + result = result + sizeOfTag(4, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(value)) for value in message.reservedName: - result = result + sizeOfTag(10, WireType.LengthDelimited) + result = result + sizeOfTag(5, WireType.LengthDelimited) result = result + sizeOfString(value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_DescriptorProto*(stream: Stream, message: google_protobuf_DescriptorProto) = +proc writegoogle_protobuf_EnumDescriptorProto*(stream: Stream, message: google_protobuf_EnumDescriptorProto) = if hasname(message): protoWriteString(stream, message.name, 1) - for value in message.field: + for value in message.value: writeMessage(stream, value, 2) - for value in message.extension: - writeMessage(stream, value, 6) - for value in message.nestedType: - writeMessage(stream, value, 3) - for value in message.enumType: - writeMessage(stream, value, 4) - for value in message.extensionRange: - writeMessage(stream, value, 5) - for value in message.oneofDecl: - writeMessage(stream, value, 8) if hasoptions(message): - writeMessage(stream, message.options, 7) + writeMessage(stream, message.options, 3) for value in message.reservedRange: - writeMessage(stream, value, 9) + writeMessage(stream, value, 4) for value in message.reservedName: - protoWriteString(stream, value, 10) + protoWriteString(stream, value, 5) writeUnknownFields(stream, message) -proc readgoogle_protobuf_DescriptorProto*(stream: Stream): google_protobuf_DescriptorProto = - result = newgoogle_protobuf_DescriptorProto() +proc readgoogle_protobuf_EnumDescriptorProto*(stream: Stream): google_protobuf_EnumDescriptorProto = + result = newgoogle_protobuf_EnumDescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -3190,519 +3192,573 @@ proc readgoogle_protobuf_DescriptorProto*(stream: Stream): google_protobuf_Descr of 2: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - addfield(result, newgoogle_protobuf_FieldDescriptorProto(data)) - of 6: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addextension(result, newgoogle_protobuf_FieldDescriptorProto(data)) + addvalue(result, newgoogle_protobuf_EnumValueDescriptorProto(data)) of 3: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - addnestedType(result, newgoogle_protobuf_DescriptorProto(data)) + setoptions(result, newgoogle_protobuf_EnumOptions(data)) of 4: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - addenumType(result, newgoogle_protobuf_EnumDescriptorProto(data)) + addreservedRange(result, newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(data)) of 5: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addextensionRange(result, newgoogle_protobuf_DescriptorProto_ExtensionRange(data)) - of 8: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addoneofDecl(result, newgoogle_protobuf_OneofDescriptorProto(data)) - of 7: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_MessageOptions(data)) - of 9: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addreservedRange(result, newgoogle_protobuf_DescriptorProto_ReservedRange(data)) - of 10: expectWireType(wireType, WireType.LengthDelimited) addreservedName(result, protoReadString(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_DescriptorProto): string = +proc serialize*(message: google_protobuf_EnumDescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_DescriptorProto(ss, message) + writegoogle_protobuf_EnumDescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_DescriptorProto*(data: string): google_protobuf_DescriptorProto = +proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_DescriptorProto(ss) + result = readgoogle_protobuf_EnumDescriptorProto(ss) -proc newgoogle_protobuf_DescriptorProto*(data: seq[byte]): google_protobuf_DescriptorProto = +proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_DescriptorProto(ss) + result = readgoogle_protobuf_EnumDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_FileOptions]): string = "google.protobuf.FileOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_GeneratedCodeInfo]): string = "google.protobuf.GeneratedCodeInfo" -proc readgoogle_protobuf_FileOptionsImpl(stream: Stream): Message = readgoogle_protobuf_FileOptions(stream) -proc writegoogle_protobuf_FileOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FileOptions(stream, google_protobuf_FileOptions(msg)) +proc readgoogle_protobuf_GeneratedCodeInfoImpl(stream: Stream): Message = readgoogle_protobuf_GeneratedCodeInfo(stream) +proc writegoogle_protobuf_GeneratedCodeInfoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_GeneratedCodeInfo(stream, google_protobuf_GeneratedCodeInfo(msg)) -proc google_protobuf_FileOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_FileOptionsImpl - result.writeImpl = writegoogle_protobuf_FileOptionsImpl +proc google_protobuf_GeneratedCodeInfoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_GeneratedCodeInfoImpl + result.writeImpl = writegoogle_protobuf_GeneratedCodeInfoImpl -proc newgoogle_protobuf_FileOptions*(): google_protobuf_FileOptions = +proc newgoogle_protobuf_GeneratedCodeInfo*(): google_protobuf_GeneratedCodeInfo = new(result) initMessage(result[]) - result.procs = google_protobuf_FileOptionsProcs() - result.javaPackage = "" - result.javaOuterClassname = "" - result.javaMultipleFiles = false - result.javaGenerateEqualsAndHash = false - result.javaStringCheckUtf8 = false - result.optimizeFor = google_protobuf_FileOptions_OptimizeMode.SPEED - result.goPackage = "" - result.ccGenericServices = false - result.javaGenericServices = false - result.pyGenericServices = false - result.phpGenericServices = false - result.deprecated = false - result.ccEnableArenas = false - result.objcClassPrefix = "" - result.csharpNamespace = "" - result.swiftPrefix = "" - result.phpClassPrefix = "" - result.phpNamespace = "" - result.uninterpretedOption = @[] + result.procs = google_protobuf_GeneratedCodeInfoProcs() + result.annotation = @[] -proc clearjavaPackage*(message: google_protobuf_FileOptions) = - message.javaPackage = "" +proc clearannotation*(message: google_protobuf_GeneratedCodeInfo) = + message.annotation = @[] clearFields(message, [1]) -proc hasjavaPackage*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 1) +proc hasannotation*(message: google_protobuf_GeneratedCodeInfo): bool = + result = hasField(message, 1) or (len(message.annotation) > 0) -proc setjavaPackage*(message: google_protobuf_FileOptions, value: string) = - message.javaPackage = value +proc setannotation*(message: google_protobuf_GeneratedCodeInfo, value: seq[google_protobuf_GeneratedCodeInfo_Annotation]) = + message.annotation = value setField(message, 1) -proc javaPackage*(message: google_protobuf_FileOptions): string {.inline.} = - message.javaPackage - -proc `javaPackage=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setjavaPackage(message, value) +proc addannotation*(message: google_protobuf_GeneratedCodeInfo, value: google_protobuf_GeneratedCodeInfo_Annotation) = + add(message.annotation, value) -proc clearjavaOuterClassname*(message: google_protobuf_FileOptions) = - message.javaOuterClassname = "" - clearFields(message, [8]) +proc annotation*(message: google_protobuf_GeneratedCodeInfo): seq[google_protobuf_GeneratedCodeInfo_Annotation] {.inline.} = + message.annotation -proc hasjavaOuterClassname*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 8) +proc `annotation=`*(message: google_protobuf_GeneratedCodeInfo, value: seq[google_protobuf_GeneratedCodeInfo_Annotation]) {.inline.} = + setannotation(message, value) -proc setjavaOuterClassname*(message: google_protobuf_FileOptions, value: string) = - message.javaOuterClassname = value - setField(message, 8) +proc sizeOfgoogle_protobuf_GeneratedCodeInfo*(message: google_protobuf_GeneratedCodeInfo): uint64 = + for value in message.annotation: + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation(value)) + result = result + sizeOfUnknownFields(message) -proc javaOuterClassname*(message: google_protobuf_FileOptions): string {.inline.} = - message.javaOuterClassname +proc writegoogle_protobuf_GeneratedCodeInfo*(stream: Stream, message: google_protobuf_GeneratedCodeInfo) = + for value in message.annotation: + writeMessage(stream, value, 1) + writeUnknownFields(stream, message) -proc `javaOuterClassname=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setjavaOuterClassname(message, value) +proc readgoogle_protobuf_GeneratedCodeInfo*(stream: Stream): google_protobuf_GeneratedCodeInfo = + result = newgoogle_protobuf_GeneratedCodeInfo() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + addannotation(result, newgoogle_protobuf_GeneratedCodeInfo_Annotation(data)) + else: readUnknownField(stream, result, tag) -proc clearjavaMultipleFiles*(message: google_protobuf_FileOptions) = - message.javaMultipleFiles = false - clearFields(message, [10]) +proc serialize*(message: google_protobuf_GeneratedCodeInfo): string = + let + ss = newStringStream() + writegoogle_protobuf_GeneratedCodeInfo(ss, message) + result = ss.data -proc hasjavaMultipleFiles*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 10) +proc newgoogle_protobuf_GeneratedCodeInfo*(data: string): google_protobuf_GeneratedCodeInfo = + let + ss = newStringStream(data) + result = readgoogle_protobuf_GeneratedCodeInfo(ss) -proc setjavaMultipleFiles*(message: google_protobuf_FileOptions, value: bool) = - message.javaMultipleFiles = value - setField(message, 10) +proc newgoogle_protobuf_GeneratedCodeInfo*(data: seq[byte]): google_protobuf_GeneratedCodeInfo = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_GeneratedCodeInfo(ss) -proc javaMultipleFiles*(message: google_protobuf_FileOptions): bool {.inline.} = - message.javaMultipleFiles -proc `javaMultipleFiles=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setjavaMultipleFiles(message, value) +proc fullyQualifiedName*(T: typedesc[google_protobuf_MessageOptions]): string = "google.protobuf.MessageOptions" -proc clearjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions) = - message.javaGenerateEqualsAndHash = false - clearFields(message, [20]) +proc readgoogle_protobuf_MessageOptionsImpl(stream: Stream): Message = readgoogle_protobuf_MessageOptions(stream) +proc writegoogle_protobuf_MessageOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MessageOptions(stream, google_protobuf_MessageOptions(msg)) -proc hasjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 20) +proc google_protobuf_MessageOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MessageOptionsImpl + result.writeImpl = writegoogle_protobuf_MessageOptionsImpl -proc setjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions, value: bool) = - message.javaGenerateEqualsAndHash = value - setField(message, 20) +proc newgoogle_protobuf_MessageOptions*(): google_protobuf_MessageOptions = + new(result) + initMessage(result[]) + result.procs = google_protobuf_MessageOptionsProcs() + result.messageSetWireFormat = false + result.noStandardDescriptorAccessor = false + result.deprecated = false + result.mapEntry = false + result.uninterpretedOption = @[] -proc javaGenerateEqualsAndHash*(message: google_protobuf_FileOptions): bool {.inline.} = - message.javaGenerateEqualsAndHash +proc clearmessageSetWireFormat*(message: google_protobuf_MessageOptions) = + message.messageSetWireFormat = false + clearFields(message, [1]) -proc `javaGenerateEqualsAndHash=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setjavaGenerateEqualsAndHash(message, value) +proc hasmessageSetWireFormat*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 1) -proc clearjavaStringCheckUtf8*(message: google_protobuf_FileOptions) = - message.javaStringCheckUtf8 = false - clearFields(message, [27]) +proc setmessageSetWireFormat*(message: google_protobuf_MessageOptions, value: bool) = + message.messageSetWireFormat = value + setField(message, 1) -proc hasjavaStringCheckUtf8*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 27) +proc messageSetWireFormat*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.messageSetWireFormat -proc setjavaStringCheckUtf8*(message: google_protobuf_FileOptions, value: bool) = - message.javaStringCheckUtf8 = value - setField(message, 27) +proc `messageSetWireFormat=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = + setmessageSetWireFormat(message, value) -proc javaStringCheckUtf8*(message: google_protobuf_FileOptions): bool {.inline.} = - message.javaStringCheckUtf8 +proc clearnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions) = + message.noStandardDescriptorAccessor = false + clearFields(message, [2]) -proc `javaStringCheckUtf8=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setjavaStringCheckUtf8(message, value) +proc hasnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 2) -proc clearoptimizeFor*(message: google_protobuf_FileOptions) = - message.optimizeFor = google_protobuf_FileOptions_OptimizeMode.SPEED - clearFields(message, [9]) +proc setnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions, value: bool) = + message.noStandardDescriptorAccessor = value + setField(message, 2) -proc hasoptimizeFor*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 9) +proc noStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.noStandardDescriptorAccessor -proc setoptimizeFor*(message: google_protobuf_FileOptions, value: google_protobuf_FileOptions_OptimizeMode) = - message.optimizeFor = value - setField(message, 9) +proc `noStandardDescriptorAccessor=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = + setnoStandardDescriptorAccessor(message, value) -proc optimizeFor*(message: google_protobuf_FileOptions): google_protobuf_FileOptions_OptimizeMode {.inline.} = - message.optimizeFor +proc cleardeprecated*(message: google_protobuf_MessageOptions) = + message.deprecated = false + clearFields(message, [3]) -proc `optimizeFor=`*(message: google_protobuf_FileOptions, value: google_protobuf_FileOptions_OptimizeMode) {.inline.} = - setoptimizeFor(message, value) +proc hasdeprecated*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 3) -proc cleargoPackage*(message: google_protobuf_FileOptions) = - message.goPackage = "" - clearFields(message, [11]) +proc setdeprecated*(message: google_protobuf_MessageOptions, value: bool) = + message.deprecated = value + setField(message, 3) -proc hasgoPackage*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 11) +proc deprecated*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.deprecated -proc setgoPackage*(message: google_protobuf_FileOptions, value: string) = - message.goPackage = value - setField(message, 11) +proc `deprecated=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = + setdeprecated(message, value) -proc goPackage*(message: google_protobuf_FileOptions): string {.inline.} = - message.goPackage +proc clearmapEntry*(message: google_protobuf_MessageOptions) = + message.mapEntry = false + clearFields(message, [7]) -proc `goPackage=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setgoPackage(message, value) +proc hasmapEntry*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 7) -proc clearccGenericServices*(message: google_protobuf_FileOptions) = - message.ccGenericServices = false - clearFields(message, [16]) +proc setmapEntry*(message: google_protobuf_MessageOptions, value: bool) = + message.mapEntry = value + setField(message, 7) -proc hasccGenericServices*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 16) +proc mapEntry*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.mapEntry -proc setccGenericServices*(message: google_protobuf_FileOptions, value: bool) = - message.ccGenericServices = value - setField(message, 16) +proc `mapEntry=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = + setmapEntry(message, value) -proc ccGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = - message.ccGenericServices +proc clearuninterpretedOption*(message: google_protobuf_MessageOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc `ccGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setccGenericServices(message, value) +proc hasuninterpretedOption*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc clearjavaGenericServices*(message: google_protobuf_FileOptions) = - message.javaGenericServices = false - clearFields(message, [17]) +proc setuninterpretedOption*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc hasjavaGenericServices*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 17) +proc adduninterpretedOption*(message: google_protobuf_MessageOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc setjavaGenericServices*(message: google_protobuf_FileOptions, value: bool) = - message.javaGenericServices = value - setField(message, 17) +proc uninterpretedOption*(message: google_protobuf_MessageOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -proc javaGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = - message.javaGenericServices +proc `uninterpretedOption=`*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) -proc `javaGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setjavaGenericServices(message, value) +proc sizeOfgoogle_protobuf_MessageOptions*(message: google_protobuf_MessageOptions): uint64 = + if hasmessageSetWireFormat(message): + result = result + sizeOfTag(1, WireType.Varint) + result = result + sizeOfBool(message.messageSetWireFormat) + if hasnoStandardDescriptorAccessor(message): + result = result + sizeOfTag(2, WireType.Varint) + result = result + sizeOfBool(message.noStandardDescriptorAccessor) + if hasdeprecated(message): + result = result + sizeOfTag(3, WireType.Varint) + result = result + sizeOfBool(message.deprecated) + if hasmapEntry(message): + result = result + sizeOfTag(7, WireType.Varint) + result = result + sizeOfBool(message.mapEntry) + for value in message.uninterpretedOption: + result = result + sizeOfTag(999, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) + result = result + sizeOfUnknownFields(message) -proc clearpyGenericServices*(message: google_protobuf_FileOptions) = - message.pyGenericServices = false - clearFields(message, [18]) +proc writegoogle_protobuf_MessageOptions*(stream: Stream, message: google_protobuf_MessageOptions) = + if hasmessageSetWireFormat(message): + protoWriteBool(stream, message.messageSetWireFormat, 1) + if hasnoStandardDescriptorAccessor(message): + protoWriteBool(stream, message.noStandardDescriptorAccessor, 2) + if hasdeprecated(message): + protoWriteBool(stream, message.deprecated, 3) + if hasmapEntry(message): + protoWriteBool(stream, message.mapEntry, 7) + for value in message.uninterpretedOption: + writeMessage(stream, value, 999) + writeUnknownFields(stream, message) -proc haspyGenericServices*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 18) +proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_MessageOptions = + result = newgoogle_protobuf_MessageOptions() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.Varint) + setmessageSetWireFormat(result, protoReadBool(stream)) + of 2: + expectWireType(wireType, WireType.Varint) + setnoStandardDescriptorAccessor(result, protoReadBool(stream)) + of 3: + expectWireType(wireType, WireType.Varint) + setdeprecated(result, protoReadBool(stream)) + of 7: + expectWireType(wireType, WireType.Varint) + setmapEntry(result, protoReadBool(stream)) + of 999: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) + else: readUnknownField(stream, result, tag) -proc setpyGenericServices*(message: google_protobuf_FileOptions, value: bool) = - message.pyGenericServices = value - setField(message, 18) +proc serialize*(message: google_protobuf_MessageOptions): string = + let + ss = newStringStream() + writegoogle_protobuf_MessageOptions(ss, message) + result = ss.data -proc pyGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = - message.pyGenericServices +proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions = + let + ss = newStringStream(data) + result = readgoogle_protobuf_MessageOptions(ss) -proc `pyGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setpyGenericServices(message, value) +proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_MessageOptions(ss) -proc clearphpGenericServices*(message: google_protobuf_FileOptions) = - message.phpGenericServices = false - clearFields(message, [42]) -proc hasphpGenericServices*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 42) +proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto]): string = "google.protobuf.DescriptorProto" -proc setphpGenericServices*(message: google_protobuf_FileOptions, value: bool) = - message.phpGenericServices = value - setField(message, 42) +proc readgoogle_protobuf_DescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto(stream) +proc writegoogle_protobuf_DescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_DescriptorProto(stream, google_protobuf_DescriptorProto(msg)) -proc phpGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = - message.phpGenericServices +proc google_protobuf_DescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_DescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_DescriptorProtoImpl -proc `phpGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setphpGenericServices(message, value) +proc newgoogle_protobuf_DescriptorProto*(): google_protobuf_DescriptorProto = + new(result) + initMessage(result[]) + result.procs = google_protobuf_DescriptorProtoProcs() + result.name = "" + result.field = @[] + result.extension = @[] + result.nestedType = @[] + result.enumType = @[] + result.extensionRange = @[] + result.oneofDecl = @[] + result.options = nil + result.reservedRange = @[] + result.reservedName = @[] -proc cleardeprecated*(message: google_protobuf_FileOptions) = - message.deprecated = false - clearFields(message, [23]) +proc clearname*(message: google_protobuf_DescriptorProto) = + message.name = "" + clearFields(message, [1]) -proc hasdeprecated*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 23) +proc hasname*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 1) -proc setdeprecated*(message: google_protobuf_FileOptions, value: bool) = - message.deprecated = value - setField(message, 23) +proc setname*(message: google_protobuf_DescriptorProto, value: string) = + message.name = value + setField(message, 1) -proc deprecated*(message: google_protobuf_FileOptions): bool {.inline.} = - message.deprecated +proc name*(message: google_protobuf_DescriptorProto): string {.inline.} = + message.name -proc `deprecated=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setdeprecated(message, value) +proc `name=`*(message: google_protobuf_DescriptorProto, value: string) {.inline.} = + setname(message, value) -proc clearccEnableArenas*(message: google_protobuf_FileOptions) = - message.ccEnableArenas = false - clearFields(message, [31]) +proc clearfield*(message: google_protobuf_DescriptorProto) = + message.field = @[] + clearFields(message, [2]) -proc hasccEnableArenas*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 31) +proc hasfield*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 2) or (len(message.field) > 0) -proc setccEnableArenas*(message: google_protobuf_FileOptions, value: bool) = - message.ccEnableArenas = value - setField(message, 31) +proc setfield*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) = + message.field = value + setField(message, 2) -proc ccEnableArenas*(message: google_protobuf_FileOptions): bool {.inline.} = - message.ccEnableArenas +proc addfield*(message: google_protobuf_DescriptorProto, value: google_protobuf_FieldDescriptorProto) = + add(message.field, value) -proc `ccEnableArenas=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = - setccEnableArenas(message, value) +proc field*(message: google_protobuf_DescriptorProto): seq[google_protobuf_FieldDescriptorProto] {.inline.} = + message.field -proc clearobjcClassPrefix*(message: google_protobuf_FileOptions) = - message.objcClassPrefix = "" - clearFields(message, [36]) +proc `field=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) {.inline.} = + setfield(message, value) -proc hasobjcClassPrefix*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 36) +proc clearextension*(message: google_protobuf_DescriptorProto) = + message.extension = @[] + clearFields(message, [6]) -proc setobjcClassPrefix*(message: google_protobuf_FileOptions, value: string) = - message.objcClassPrefix = value - setField(message, 36) +proc hasextension*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 6) or (len(message.extension) > 0) -proc objcClassPrefix*(message: google_protobuf_FileOptions): string {.inline.} = - message.objcClassPrefix +proc setextension*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) = + message.extension = value + setField(message, 6) -proc `objcClassPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setobjcClassPrefix(message, value) +proc addextension*(message: google_protobuf_DescriptorProto, value: google_protobuf_FieldDescriptorProto) = + add(message.extension, value) -proc clearcsharpNamespace*(message: google_protobuf_FileOptions) = - message.csharpNamespace = "" - clearFields(message, [37]) +proc extension*(message: google_protobuf_DescriptorProto): seq[google_protobuf_FieldDescriptorProto] {.inline.} = + message.extension -proc hascsharpNamespace*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 37) +proc `extension=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_FieldDescriptorProto]) {.inline.} = + setextension(message, value) -proc setcsharpNamespace*(message: google_protobuf_FileOptions, value: string) = - message.csharpNamespace = value - setField(message, 37) +proc clearnestedType*(message: google_protobuf_DescriptorProto) = + message.nestedType = @[] + clearFields(message, [3]) -proc csharpNamespace*(message: google_protobuf_FileOptions): string {.inline.} = - message.csharpNamespace +proc hasnestedType*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 3) or (len(message.nestedType) > 0) -proc `csharpNamespace=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setcsharpNamespace(message, value) +proc setnestedType*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto]) = + message.nestedType = value + setField(message, 3) -proc clearswiftPrefix*(message: google_protobuf_FileOptions) = - message.swiftPrefix = "" - clearFields(message, [39]) +proc addnestedType*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto) = + add(message.nestedType, value) -proc hasswiftPrefix*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 39) +proc nestedType*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto] {.inline.} = + message.nestedType -proc setswiftPrefix*(message: google_protobuf_FileOptions, value: string) = - message.swiftPrefix = value - setField(message, 39) +proc `nestedType=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto]) {.inline.} = + setnestedType(message, value) -proc swiftPrefix*(message: google_protobuf_FileOptions): string {.inline.} = - message.swiftPrefix +proc clearenumType*(message: google_protobuf_DescriptorProto) = + message.enumType = @[] + clearFields(message, [4]) -proc `swiftPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setswiftPrefix(message, value) +proc hasenumType*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 4) or (len(message.enumType) > 0) -proc clearphpClassPrefix*(message: google_protobuf_FileOptions) = - message.phpClassPrefix = "" - clearFields(message, [40]) +proc setenumType*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_EnumDescriptorProto]) = + message.enumType = value + setField(message, 4) -proc hasphpClassPrefix*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 40) +proc addenumType*(message: google_protobuf_DescriptorProto, value: google_protobuf_EnumDescriptorProto) = + add(message.enumType, value) -proc setphpClassPrefix*(message: google_protobuf_FileOptions, value: string) = - message.phpClassPrefix = value - setField(message, 40) +proc enumType*(message: google_protobuf_DescriptorProto): seq[google_protobuf_EnumDescriptorProto] {.inline.} = + message.enumType -proc phpClassPrefix*(message: google_protobuf_FileOptions): string {.inline.} = - message.phpClassPrefix +proc `enumType=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_EnumDescriptorProto]) {.inline.} = + setenumType(message, value) -proc `phpClassPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setphpClassPrefix(message, value) +proc clearextensionRange*(message: google_protobuf_DescriptorProto) = + message.extensionRange = @[] + clearFields(message, [5]) -proc clearphpNamespace*(message: google_protobuf_FileOptions) = - message.phpNamespace = "" - clearFields(message, [41]) +proc hasextensionRange*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 5) or (len(message.extensionRange) > 0) -proc hasphpNamespace*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 41) +proc setextensionRange*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ExtensionRange]) = + message.extensionRange = value + setField(message, 5) -proc setphpNamespace*(message: google_protobuf_FileOptions, value: string) = - message.phpNamespace = value - setField(message, 41) +proc addextensionRange*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto_ExtensionRange) = + add(message.extensionRange, value) -proc phpNamespace*(message: google_protobuf_FileOptions): string {.inline.} = - message.phpNamespace +proc extensionRange*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto_ExtensionRange] {.inline.} = + message.extensionRange -proc `phpNamespace=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = - setphpNamespace(message, value) +proc `extensionRange=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ExtensionRange]) {.inline.} = + setextensionRange(message, value) -proc clearuninterpretedOption*(message: google_protobuf_FileOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) +proc clearoneofDecl*(message: google_protobuf_DescriptorProto) = + message.oneofDecl = @[] + clearFields(message, [8]) -proc hasuninterpretedOption*(message: google_protobuf_FileOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) +proc hasoneofDecl*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 8) or (len(message.oneofDecl) > 0) -proc setuninterpretedOption*(message: google_protobuf_FileOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) +proc setoneofDecl*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_OneofDescriptorProto]) = + message.oneofDecl = value + setField(message, 8) -proc adduninterpretedOption*(message: google_protobuf_FileOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) +proc addoneofDecl*(message: google_protobuf_DescriptorProto, value: google_protobuf_OneofDescriptorProto) = + add(message.oneofDecl, value) -proc uninterpretedOption*(message: google_protobuf_FileOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption +proc oneofDecl*(message: google_protobuf_DescriptorProto): seq[google_protobuf_OneofDescriptorProto] {.inline.} = + message.oneofDecl -proc `uninterpretedOption=`*(message: google_protobuf_FileOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) +proc `oneofDecl=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_OneofDescriptorProto]) {.inline.} = + setoneofDecl(message, value) -proc sizeOfgoogle_protobuf_FileOptions*(message: google_protobuf_FileOptions): uint64 = - if hasjavaPackage(message): +proc clearoptions*(message: google_protobuf_DescriptorProto) = + message.options = nil + clearFields(message, [7]) + +proc hasoptions*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 7) + +proc setoptions*(message: google_protobuf_DescriptorProto, value: google_protobuf_MessageOptions) = + message.options = value + setField(message, 7) + +proc options*(message: google_protobuf_DescriptorProto): google_protobuf_MessageOptions {.inline.} = + message.options + +proc `options=`*(message: google_protobuf_DescriptorProto, value: google_protobuf_MessageOptions) {.inline.} = + setoptions(message, value) + +proc clearreservedRange*(message: google_protobuf_DescriptorProto) = + message.reservedRange = @[] + clearFields(message, [9]) + +proc hasreservedRange*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 9) or (len(message.reservedRange) > 0) + +proc setreservedRange*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ReservedRange]) = + message.reservedRange = value + setField(message, 9) + +proc addreservedRange*(message: google_protobuf_DescriptorProto, value: google_protobuf_DescriptorProto_ReservedRange) = + add(message.reservedRange, value) + +proc reservedRange*(message: google_protobuf_DescriptorProto): seq[google_protobuf_DescriptorProto_ReservedRange] {.inline.} = + message.reservedRange + +proc `reservedRange=`*(message: google_protobuf_DescriptorProto, value: seq[google_protobuf_DescriptorProto_ReservedRange]) {.inline.} = + setreservedRange(message, value) + +proc clearreservedName*(message: google_protobuf_DescriptorProto) = + message.reservedName = @[] + clearFields(message, [10]) + +proc hasreservedName*(message: google_protobuf_DescriptorProto): bool = + result = hasField(message, 10) or (len(message.reservedName) > 0) + +proc setreservedName*(message: google_protobuf_DescriptorProto, value: seq[string]) = + message.reservedName = value + setField(message, 10) + +proc addreservedName*(message: google_protobuf_DescriptorProto, value: string) = + add(message.reservedName, value) + +proc reservedName*(message: google_protobuf_DescriptorProto): seq[string] {.inline.} = + message.reservedName + +proc `reservedName=`*(message: google_protobuf_DescriptorProto, value: seq[string]) {.inline.} = + setreservedName(message, value) + +proc sizeOfgoogle_protobuf_DescriptorProto*(message: google_protobuf_DescriptorProto): uint64 = + if hasname(message): result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.javaPackage) - if hasjavaOuterClassname(message): + result = result + sizeOfString(message.name) + for value in message.field: + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldDescriptorProto(value)) + for value in message.extension: + result = result + sizeOfTag(6, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_FieldDescriptorProto(value)) + for value in message.nestedType: + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto(value)) + for value in message.enumType: + result = result + sizeOfTag(4, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_EnumDescriptorProto(value)) + for value in message.extensionRange: + result = result + sizeOfTag(5, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto_ExtensionRange(value)) + for value in message.oneofDecl: result = result + sizeOfTag(8, WireType.LengthDelimited) - result = result + sizeOfString(message.javaOuterClassname) - if hasjavaMultipleFiles(message): - result = result + sizeOfTag(10, WireType.Varint) - result = result + sizeOfBool(message.javaMultipleFiles) - if hasjavaGenerateEqualsAndHash(message): - result = result + sizeOfTag(20, WireType.Varint) - result = result + sizeOfBool(message.javaGenerateEqualsAndHash) - if hasjavaStringCheckUtf8(message): - result = result + sizeOfTag(27, WireType.Varint) - result = result + sizeOfBool(message.javaStringCheckUtf8) - if hasoptimizeFor(message): - result = result + sizeOfTag(9, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_FileOptions_OptimizeMode](message.optimizeFor) - if hasgoPackage(message): - result = result + sizeOfTag(11, WireType.LengthDelimited) - result = result + sizeOfString(message.goPackage) - if hasccGenericServices(message): - result = result + sizeOfTag(16, WireType.Varint) - result = result + sizeOfBool(message.ccGenericServices) - if hasjavaGenericServices(message): - result = result + sizeOfTag(17, WireType.Varint) - result = result + sizeOfBool(message.javaGenericServices) - if haspyGenericServices(message): - result = result + sizeOfTag(18, WireType.Varint) - result = result + sizeOfBool(message.pyGenericServices) - if hasphpGenericServices(message): - result = result + sizeOfTag(42, WireType.Varint) - result = result + sizeOfBool(message.phpGenericServices) - if hasdeprecated(message): - result = result + sizeOfTag(23, WireType.Varint) - result = result + sizeOfBool(message.deprecated) - if hasccEnableArenas(message): - result = result + sizeOfTag(31, WireType.Varint) - result = result + sizeOfBool(message.ccEnableArenas) - if hasobjcClassPrefix(message): - result = result + sizeOfTag(36, WireType.LengthDelimited) - result = result + sizeOfString(message.objcClassPrefix) - if hascsharpNamespace(message): - result = result + sizeOfTag(37, WireType.LengthDelimited) - result = result + sizeOfString(message.csharpNamespace) - if hasswiftPrefix(message): - result = result + sizeOfTag(39, WireType.LengthDelimited) - result = result + sizeOfString(message.swiftPrefix) - if hasphpClassPrefix(message): - result = result + sizeOfTag(40, WireType.LengthDelimited) - result = result + sizeOfString(message.phpClassPrefix) - if hasphpNamespace(message): - result = result + sizeOfTag(41, WireType.LengthDelimited) - result = result + sizeOfString(message.phpNamespace) - for value in message.uninterpretedOption: - result = result + sizeOfTag(999, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_OneofDescriptorProto(value)) + if hasoptions(message): + result = result + sizeOfTag(7, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MessageOptions(message.options)) + for value in message.reservedRange: + result = result + sizeOfTag(9, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_DescriptorProto_ReservedRange(value)) + for value in message.reservedName: + result = result + sizeOfTag(10, WireType.LengthDelimited) + result = result + sizeOfString(value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_FileOptions*(stream: Stream, message: google_protobuf_FileOptions) = - if hasjavaPackage(message): - protoWriteString(stream, message.javaPackage, 1) - if hasjavaOuterClassname(message): - protoWriteString(stream, message.javaOuterClassname, 8) - if hasjavaMultipleFiles(message): - protoWriteBool(stream, message.javaMultipleFiles, 10) - if hasjavaGenerateEqualsAndHash(message): - protoWriteBool(stream, message.javaGenerateEqualsAndHash, 20) - if hasjavaStringCheckUtf8(message): - protoWriteBool(stream, message.javaStringCheckUtf8, 27) - if hasoptimizeFor(message): - protoWriteEnum(stream, message.optimizeFor, 9) - if hasgoPackage(message): - protoWriteString(stream, message.goPackage, 11) - if hasccGenericServices(message): - protoWriteBool(stream, message.ccGenericServices, 16) - if hasjavaGenericServices(message): - protoWriteBool(stream, message.javaGenericServices, 17) - if haspyGenericServices(message): - protoWriteBool(stream, message.pyGenericServices, 18) - if hasphpGenericServices(message): - protoWriteBool(stream, message.phpGenericServices, 42) - if hasdeprecated(message): - protoWriteBool(stream, message.deprecated, 23) - if hasccEnableArenas(message): - protoWriteBool(stream, message.ccEnableArenas, 31) - if hasobjcClassPrefix(message): - protoWriteString(stream, message.objcClassPrefix, 36) - if hascsharpNamespace(message): - protoWriteString(stream, message.csharpNamespace, 37) - if hasswiftPrefix(message): - protoWriteString(stream, message.swiftPrefix, 39) - if hasphpClassPrefix(message): - protoWriteString(stream, message.phpClassPrefix, 40) - if hasphpNamespace(message): - protoWriteString(stream, message.phpNamespace, 41) - for value in message.uninterpretedOption: - writeMessage(stream, value, 999) +proc writegoogle_protobuf_DescriptorProto*(stream: Stream, message: google_protobuf_DescriptorProto) = + if hasname(message): + protoWriteString(stream, message.name, 1) + for value in message.field: + writeMessage(stream, value, 2) + for value in message.extension: + writeMessage(stream, value, 6) + for value in message.nestedType: + writeMessage(stream, value, 3) + for value in message.enumType: + writeMessage(stream, value, 4) + for value in message.extensionRange: + writeMessage(stream, value, 5) + for value in message.oneofDecl: + writeMessage(stream, value, 8) + if hasoptions(message): + writeMessage(stream, message.options, 7) + for value in message.reservedRange: + writeMessage(stream, value, 9) + for value in message.reservedName: + protoWriteString(stream, value, 10) writeUnknownFields(stream, message) -proc readgoogle_protobuf_FileOptions*(stream: Stream): google_protobuf_FileOptions = - result = newgoogle_protobuf_FileOptions() +proc readgoogle_protobuf_DescriptorProto*(stream: Stream): google_protobuf_DescriptorProto = + result = newgoogle_protobuf_DescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -3712,79 +3768,59 @@ proc readgoogle_protobuf_FileOptions*(stream: Stream): google_protobuf_FileOptio raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.LengthDelimited) - setjavaPackage(result, protoReadString(stream)) - of 8: + setname(result, protoReadString(stream)) + of 2: expectWireType(wireType, WireType.LengthDelimited) - setjavaOuterClassname(result, protoReadString(stream)) - of 10: - expectWireType(wireType, WireType.Varint) - setjavaMultipleFiles(result, protoReadBool(stream)) - of 20: - expectWireType(wireType, WireType.Varint) - setjavaGenerateEqualsAndHash(result, protoReadBool(stream)) - of 27: - expectWireType(wireType, WireType.Varint) - setjavaStringCheckUtf8(result, protoReadBool(stream)) - of 9: - expectWireType(wireType, WireType.Varint) - setoptimizeFor(result, protoReadEnum[google_protobuf_FileOptions_OptimizeMode](stream)) - of 11: + let data = readLengthDelimited(stream) + addfield(result, newgoogle_protobuf_FieldDescriptorProto(data)) + of 6: expectWireType(wireType, WireType.LengthDelimited) - setgoPackage(result, protoReadString(stream)) - of 16: - expectWireType(wireType, WireType.Varint) - setccGenericServices(result, protoReadBool(stream)) - of 17: - expectWireType(wireType, WireType.Varint) - setjavaGenericServices(result, protoReadBool(stream)) - of 18: - expectWireType(wireType, WireType.Varint) - setpyGenericServices(result, protoReadBool(stream)) - of 42: - expectWireType(wireType, WireType.Varint) - setphpGenericServices(result, protoReadBool(stream)) - of 23: - expectWireType(wireType, WireType.Varint) - setdeprecated(result, protoReadBool(stream)) - of 31: - expectWireType(wireType, WireType.Varint) - setccEnableArenas(result, protoReadBool(stream)) - of 36: + let data = readLengthDelimited(stream) + addextension(result, newgoogle_protobuf_FieldDescriptorProto(data)) + of 3: expectWireType(wireType, WireType.LengthDelimited) - setobjcClassPrefix(result, protoReadString(stream)) - of 37: + let data = readLengthDelimited(stream) + addnestedType(result, newgoogle_protobuf_DescriptorProto(data)) + of 4: expectWireType(wireType, WireType.LengthDelimited) - setcsharpNamespace(result, protoReadString(stream)) - of 39: + let data = readLengthDelimited(stream) + addenumType(result, newgoogle_protobuf_EnumDescriptorProto(data)) + of 5: expectWireType(wireType, WireType.LengthDelimited) - setswiftPrefix(result, protoReadString(stream)) - of 40: + let data = readLengthDelimited(stream) + addextensionRange(result, newgoogle_protobuf_DescriptorProto_ExtensionRange(data)) + of 8: expectWireType(wireType, WireType.LengthDelimited) - setphpClassPrefix(result, protoReadString(stream)) - of 41: + let data = readLengthDelimited(stream) + addoneofDecl(result, newgoogle_protobuf_OneofDescriptorProto(data)) + of 7: expectWireType(wireType, WireType.LengthDelimited) - setphpNamespace(result, protoReadString(stream)) - of 999: + let data = readLengthDelimited(stream) + setoptions(result, newgoogle_protobuf_MessageOptions(data)) + of 9: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) + addreservedRange(result, newgoogle_protobuf_DescriptorProto_ReservedRange(data)) + of 10: + expectWireType(wireType, WireType.LengthDelimited) + addreservedName(result, protoReadString(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_FileOptions): string = +proc serialize*(message: google_protobuf_DescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_FileOptions(ss, message) + writegoogle_protobuf_DescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_FileOptions*(data: string): google_protobuf_FileOptions = +proc newgoogle_protobuf_DescriptorProto*(data: string): google_protobuf_DescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_FileOptions(ss) + result = readgoogle_protobuf_DescriptorProto(ss) -proc newgoogle_protobuf_FileOptions*(data: seq[byte]): google_protobuf_FileOptions = +proc newgoogle_protobuf_DescriptorProto*(data: seq[byte]): google_protobuf_DescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_FileOptions(ss) + result = readgoogle_protobuf_DescriptorProto(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_ServiceOptions]): string = "google.protobuf.ServiceOptions" @@ -3880,446 +3916,610 @@ proc serialize*(message: google_protobuf_ServiceOptions): string = writegoogle_protobuf_ServiceOptions(ss, message) result = ss.data -proc newgoogle_protobuf_ServiceOptions*(data: string): google_protobuf_ServiceOptions = +proc newgoogle_protobuf_ServiceOptions*(data: string): google_protobuf_ServiceOptions = + let + ss = newStringStream(data) + result = readgoogle_protobuf_ServiceOptions(ss) + +proc newgoogle_protobuf_ServiceOptions*(data: seq[byte]): google_protobuf_ServiceOptions = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_ServiceOptions(ss) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_ServiceDescriptorProto]): string = "google.protobuf.ServiceDescriptorProto" + +proc readgoogle_protobuf_ServiceDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_ServiceDescriptorProto(stream) +proc writegoogle_protobuf_ServiceDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ServiceDescriptorProto(stream, google_protobuf_ServiceDescriptorProto(msg)) + +proc google_protobuf_ServiceDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_ServiceDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_ServiceDescriptorProtoImpl + +proc newgoogle_protobuf_ServiceDescriptorProto*(): google_protobuf_ServiceDescriptorProto = + new(result) + initMessage(result[]) + result.procs = google_protobuf_ServiceDescriptorProtoProcs() + result.name = "" + result.fmethod = @[] + result.options = nil + +proc clearname*(message: google_protobuf_ServiceDescriptorProto) = + message.name = "" + clearFields(message, [1]) + +proc hasname*(message: google_protobuf_ServiceDescriptorProto): bool = + result = hasField(message, 1) + +proc setname*(message: google_protobuf_ServiceDescriptorProto, value: string) = + message.name = value + setField(message, 1) + +proc name*(message: google_protobuf_ServiceDescriptorProto): string {.inline.} = + message.name + +proc `name=`*(message: google_protobuf_ServiceDescriptorProto, value: string) {.inline.} = + setname(message, value) + +proc clearfmethod*(message: google_protobuf_ServiceDescriptorProto) = + message.fmethod = @[] + clearFields(message, [2]) + +proc hasfmethod*(message: google_protobuf_ServiceDescriptorProto): bool = + result = hasField(message, 2) or (len(message.fmethod) > 0) + +proc setfmethod*(message: google_protobuf_ServiceDescriptorProto, value: seq[google_protobuf_MethodDescriptorProto]) = + message.fmethod = value + setField(message, 2) + +proc addfmethod*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_MethodDescriptorProto) = + add(message.fmethod, value) + +proc fmethod*(message: google_protobuf_ServiceDescriptorProto): seq[google_protobuf_MethodDescriptorProto] {.inline.} = + message.fmethod + +proc `fmethod=`*(message: google_protobuf_ServiceDescriptorProto, value: seq[google_protobuf_MethodDescriptorProto]) {.inline.} = + setfmethod(message, value) + +proc clearoptions*(message: google_protobuf_ServiceDescriptorProto) = + message.options = nil + clearFields(message, [3]) + +proc hasoptions*(message: google_protobuf_ServiceDescriptorProto): bool = + result = hasField(message, 3) + +proc setoptions*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_ServiceOptions) = + message.options = value + setField(message, 3) + +proc options*(message: google_protobuf_ServiceDescriptorProto): google_protobuf_ServiceOptions {.inline.} = + message.options + +proc `options=`*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_ServiceOptions) {.inline.} = + setoptions(message, value) + +proc sizeOfgoogle_protobuf_ServiceDescriptorProto*(message: google_protobuf_ServiceDescriptorProto): uint64 = + if hasname(message): + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfString(message.name) + for value in message.fmethod: + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MethodDescriptorProto(value)) + if hasoptions(message): + result = result + sizeOfTag(3, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ServiceOptions(message.options)) + result = result + sizeOfUnknownFields(message) + +proc writegoogle_protobuf_ServiceDescriptorProto*(stream: Stream, message: google_protobuf_ServiceDescriptorProto) = + if hasname(message): + protoWriteString(stream, message.name, 1) + for value in message.fmethod: + writeMessage(stream, value, 2) + if hasoptions(message): + writeMessage(stream, message.options, 3) + writeUnknownFields(stream, message) + +proc readgoogle_protobuf_ServiceDescriptorProto*(stream: Stream): google_protobuf_ServiceDescriptorProto = + result = newgoogle_protobuf_ServiceDescriptorProto() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 1: + expectWireType(wireType, WireType.LengthDelimited) + setname(result, protoReadString(stream)) + of 2: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + addfmethod(result, newgoogle_protobuf_MethodDescriptorProto(data)) + of 3: + expectWireType(wireType, WireType.LengthDelimited) + let data = readLengthDelimited(stream) + setoptions(result, newgoogle_protobuf_ServiceOptions(data)) + else: readUnknownField(stream, result, tag) + +proc serialize*(message: google_protobuf_ServiceDescriptorProto): string = + let + ss = newStringStream() + writegoogle_protobuf_ServiceDescriptorProto(ss, message) + result = ss.data + +proc newgoogle_protobuf_ServiceDescriptorProto*(data: string): google_protobuf_ServiceDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_ServiceOptions(ss) + result = readgoogle_protobuf_ServiceDescriptorProto(ss) -proc newgoogle_protobuf_ServiceOptions*(data: seq[byte]): google_protobuf_ServiceOptions = +proc newgoogle_protobuf_ServiceDescriptorProto*(data: seq[byte]): google_protobuf_ServiceDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_ServiceOptions(ss) + result = readgoogle_protobuf_ServiceDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodOptions]): string = "google.protobuf.MethodOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_FileOptions]): string = "google.protobuf.FileOptions" -proc readgoogle_protobuf_MethodOptionsImpl(stream: Stream): Message = readgoogle_protobuf_MethodOptions(stream) -proc writegoogle_protobuf_MethodOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MethodOptions(stream, google_protobuf_MethodOptions(msg)) +proc readgoogle_protobuf_FileOptionsImpl(stream: Stream): Message = readgoogle_protobuf_FileOptions(stream) +proc writegoogle_protobuf_FileOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FileOptions(stream, google_protobuf_FileOptions(msg)) -proc google_protobuf_MethodOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MethodOptionsImpl - result.writeImpl = writegoogle_protobuf_MethodOptionsImpl +proc google_protobuf_FileOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_FileOptionsImpl + result.writeImpl = writegoogle_protobuf_FileOptionsImpl -proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions = +proc newgoogle_protobuf_FileOptions*(): google_protobuf_FileOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_MethodOptionsProcs() + result.procs = google_protobuf_FileOptionsProcs() + result.javaPackage = "" + result.javaOuterClassname = "" + result.javaMultipleFiles = false + result.javaGenerateEqualsAndHash = false + result.javaStringCheckUtf8 = false + result.optimizeFor = google_protobuf_FileOptions_OptimizeMode.SPEED + result.goPackage = "" + result.ccGenericServices = false + result.javaGenericServices = false + result.pyGenericServices = false + result.phpGenericServices = false result.deprecated = false - result.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN + result.ccEnableArenas = false + result.objcClassPrefix = "" + result.csharpNamespace = "" + result.swiftPrefix = "" + result.phpClassPrefix = "" + result.phpNamespace = "" result.uninterpretedOption = @[] -proc cleardeprecated*(message: google_protobuf_MethodOptions) = - message.deprecated = false - clearFields(message, [33]) +proc clearjavaPackage*(message: google_protobuf_FileOptions) = + message.javaPackage = "" + clearFields(message, [1]) -proc hasdeprecated*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 33) +proc hasjavaPackage*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 1) -proc setdeprecated*(message: google_protobuf_MethodOptions, value: bool) = - message.deprecated = value - setField(message, 33) +proc setjavaPackage*(message: google_protobuf_FileOptions, value: string) = + message.javaPackage = value + setField(message, 1) -proc deprecated*(message: google_protobuf_MethodOptions): bool {.inline.} = - message.deprecated +proc javaPackage*(message: google_protobuf_FileOptions): string {.inline.} = + message.javaPackage -proc `deprecated=`*(message: google_protobuf_MethodOptions, value: bool) {.inline.} = - setdeprecated(message, value) +proc `javaPackage=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setjavaPackage(message, value) -proc clearidempotencyLevel*(message: google_protobuf_MethodOptions) = - message.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN - clearFields(message, [34]) +proc clearjavaOuterClassname*(message: google_protobuf_FileOptions) = + message.javaOuterClassname = "" + clearFields(message, [8]) -proc hasidempotencyLevel*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 34) +proc hasjavaOuterClassname*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 8) -proc setidempotencyLevel*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) = - message.idempotencyLevel = value - setField(message, 34) +proc setjavaOuterClassname*(message: google_protobuf_FileOptions, value: string) = + message.javaOuterClassname = value + setField(message, 8) -proc idempotencyLevel*(message: google_protobuf_MethodOptions): google_protobuf_MethodOptions_IdempotencyLevel {.inline.} = - message.idempotencyLevel +proc javaOuterClassname*(message: google_protobuf_FileOptions): string {.inline.} = + message.javaOuterClassname -proc `idempotencyLevel=`*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) {.inline.} = - setidempotencyLevel(message, value) +proc `javaOuterClassname=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setjavaOuterClassname(message, value) -proc clearuninterpretedOption*(message: google_protobuf_MethodOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) +proc clearjavaMultipleFiles*(message: google_protobuf_FileOptions) = + message.javaMultipleFiles = false + clearFields(message, [10]) -proc hasuninterpretedOption*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) +proc hasjavaMultipleFiles*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 10) -proc setuninterpretedOption*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) +proc setjavaMultipleFiles*(message: google_protobuf_FileOptions, value: bool) = + message.javaMultipleFiles = value + setField(message, 10) -proc adduninterpretedOption*(message: google_protobuf_MethodOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) +proc javaMultipleFiles*(message: google_protobuf_FileOptions): bool {.inline.} = + message.javaMultipleFiles -proc uninterpretedOption*(message: google_protobuf_MethodOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption +proc `javaMultipleFiles=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setjavaMultipleFiles(message, value) -proc `uninterpretedOption=`*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) +proc clearjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions) = + message.javaGenerateEqualsAndHash = false + clearFields(message, [20]) -proc sizeOfgoogle_protobuf_MethodOptions*(message: google_protobuf_MethodOptions): uint64 = - if hasdeprecated(message): - result = result + sizeOfTag(33, WireType.Varint) - result = result + sizeOfBool(message.deprecated) - if hasidempotencyLevel(message): - result = result + sizeOfTag(34, WireType.Varint) - result = result + sizeOfEnum[google_protobuf_MethodOptions_IdempotencyLevel](message.idempotencyLevel) - for value in message.uninterpretedOption: - result = result + sizeOfTag(999, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) - result = result + sizeOfUnknownFields(message) +proc hasjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 20) -proc writegoogle_protobuf_MethodOptions*(stream: Stream, message: google_protobuf_MethodOptions) = - if hasdeprecated(message): - protoWriteBool(stream, message.deprecated, 33) - if hasidempotencyLevel(message): - protoWriteEnum(stream, message.idempotencyLevel, 34) - for value in message.uninterpretedOption: - writeMessage(stream, value, 999) - writeUnknownFields(stream, message) +proc setjavaGenerateEqualsAndHash*(message: google_protobuf_FileOptions, value: bool) = + message.javaGenerateEqualsAndHash = value + setField(message, 20) -proc readgoogle_protobuf_MethodOptions*(stream: Stream): google_protobuf_MethodOptions = - result = newgoogle_protobuf_MethodOptions() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 33: - expectWireType(wireType, WireType.Varint) - setdeprecated(result, protoReadBool(stream)) - of 34: - expectWireType(wireType, WireType.Varint) - setidempotencyLevel(result, protoReadEnum[google_protobuf_MethodOptions_IdempotencyLevel](stream)) - of 999: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) - else: readUnknownField(stream, result, tag) +proc javaGenerateEqualsAndHash*(message: google_protobuf_FileOptions): bool {.inline.} = + message.javaGenerateEqualsAndHash -proc serialize*(message: google_protobuf_MethodOptions): string = - let - ss = newStringStream() - writegoogle_protobuf_MethodOptions(ss, message) - result = ss.data +proc `javaGenerateEqualsAndHash=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setjavaGenerateEqualsAndHash(message, value) -proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions = - let - ss = newStringStream(data) - result = readgoogle_protobuf_MethodOptions(ss) +proc clearjavaStringCheckUtf8*(message: google_protobuf_FileOptions) = + message.javaStringCheckUtf8 = false + clearFields(message, [27]) -proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MethodOptions(ss) +proc hasjavaStringCheckUtf8*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 27) +proc setjavaStringCheckUtf8*(message: google_protobuf_FileOptions, value: bool) = + message.javaStringCheckUtf8 = value + setField(message, 27) -proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodDescriptorProto]): string = "google.protobuf.MethodDescriptorProto" +proc javaStringCheckUtf8*(message: google_protobuf_FileOptions): bool {.inline.} = + message.javaStringCheckUtf8 -proc readgoogle_protobuf_MethodDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_MethodDescriptorProto(stream) -proc writegoogle_protobuf_MethodDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_MethodDescriptorProto(stream, google_protobuf_MethodDescriptorProto(msg)) +proc `javaStringCheckUtf8=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setjavaStringCheckUtf8(message, value) -proc google_protobuf_MethodDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MethodDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_MethodDescriptorProtoImpl +proc clearoptimizeFor*(message: google_protobuf_FileOptions) = + message.optimizeFor = google_protobuf_FileOptions_OptimizeMode.SPEED + clearFields(message, [9]) -proc newgoogle_protobuf_MethodDescriptorProto*(): google_protobuf_MethodDescriptorProto = - new(result) - initMessage(result[]) - result.procs = google_protobuf_MethodDescriptorProtoProcs() - result.name = "" - result.inputType = "" - result.outputType = "" - result.options = nil - result.clientStreaming = false - result.serverStreaming = false +proc hasoptimizeFor*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 9) -proc clearname*(message: google_protobuf_MethodDescriptorProto) = - message.name = "" - clearFields(message, [1]) +proc setoptimizeFor*(message: google_protobuf_FileOptions, value: google_protobuf_FileOptions_OptimizeMode) = + message.optimizeFor = value + setField(message, 9) + +proc optimizeFor*(message: google_protobuf_FileOptions): google_protobuf_FileOptions_OptimizeMode {.inline.} = + message.optimizeFor + +proc `optimizeFor=`*(message: google_protobuf_FileOptions, value: google_protobuf_FileOptions_OptimizeMode) {.inline.} = + setoptimizeFor(message, value) + +proc cleargoPackage*(message: google_protobuf_FileOptions) = + message.goPackage = "" + clearFields(message, [11]) + +proc hasgoPackage*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 11) + +proc setgoPackage*(message: google_protobuf_FileOptions, value: string) = + message.goPackage = value + setField(message, 11) + +proc goPackage*(message: google_protobuf_FileOptions): string {.inline.} = + message.goPackage + +proc `goPackage=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setgoPackage(message, value) + +proc clearccGenericServices*(message: google_protobuf_FileOptions) = + message.ccGenericServices = false + clearFields(message, [16]) + +proc hasccGenericServices*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 16) + +proc setccGenericServices*(message: google_protobuf_FileOptions, value: bool) = + message.ccGenericServices = value + setField(message, 16) + +proc ccGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = + message.ccGenericServices -proc hasname*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 1) +proc `ccGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setccGenericServices(message, value) -proc setname*(message: google_protobuf_MethodDescriptorProto, value: string) = - message.name = value - setField(message, 1) +proc clearjavaGenericServices*(message: google_protobuf_FileOptions) = + message.javaGenericServices = false + clearFields(message, [17]) -proc name*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = - message.name +proc hasjavaGenericServices*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 17) -proc `name=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = - setname(message, value) +proc setjavaGenericServices*(message: google_protobuf_FileOptions, value: bool) = + message.javaGenericServices = value + setField(message, 17) -proc clearinputType*(message: google_protobuf_MethodDescriptorProto) = - message.inputType = "" - clearFields(message, [2]) +proc javaGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = + message.javaGenericServices -proc hasinputType*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 2) +proc `javaGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setjavaGenericServices(message, value) -proc setinputType*(message: google_protobuf_MethodDescriptorProto, value: string) = - message.inputType = value - setField(message, 2) +proc clearpyGenericServices*(message: google_protobuf_FileOptions) = + message.pyGenericServices = false + clearFields(message, [18]) -proc inputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = - message.inputType +proc haspyGenericServices*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 18) -proc `inputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = - setinputType(message, value) +proc setpyGenericServices*(message: google_protobuf_FileOptions, value: bool) = + message.pyGenericServices = value + setField(message, 18) -proc clearoutputType*(message: google_protobuf_MethodDescriptorProto) = - message.outputType = "" - clearFields(message, [3]) +proc pyGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = + message.pyGenericServices -proc hasoutputType*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 3) +proc `pyGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setpyGenericServices(message, value) -proc setoutputType*(message: google_protobuf_MethodDescriptorProto, value: string) = - message.outputType = value - setField(message, 3) +proc clearphpGenericServices*(message: google_protobuf_FileOptions) = + message.phpGenericServices = false + clearFields(message, [42]) -proc outputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = - message.outputType +proc hasphpGenericServices*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 42) -proc `outputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = - setoutputType(message, value) +proc setphpGenericServices*(message: google_protobuf_FileOptions, value: bool) = + message.phpGenericServices = value + setField(message, 42) -proc clearoptions*(message: google_protobuf_MethodDescriptorProto) = - message.options = nil - clearFields(message, [4]) +proc phpGenericServices*(message: google_protobuf_FileOptions): bool {.inline.} = + message.phpGenericServices -proc hasoptions*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 4) +proc `phpGenericServices=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setphpGenericServices(message, value) -proc setoptions*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) = - message.options = value - setField(message, 4) +proc cleardeprecated*(message: google_protobuf_FileOptions) = + message.deprecated = false + clearFields(message, [23]) -proc options*(message: google_protobuf_MethodDescriptorProto): google_protobuf_MethodOptions {.inline.} = - message.options +proc hasdeprecated*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 23) -proc `options=`*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) {.inline.} = - setoptions(message, value) +proc setdeprecated*(message: google_protobuf_FileOptions, value: bool) = + message.deprecated = value + setField(message, 23) -proc clearclientStreaming*(message: google_protobuf_MethodDescriptorProto) = - message.clientStreaming = false - clearFields(message, [5]) +proc deprecated*(message: google_protobuf_FileOptions): bool {.inline.} = + message.deprecated -proc hasclientStreaming*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 5) +proc `deprecated=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setdeprecated(message, value) -proc setclientStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = - message.clientStreaming = value - setField(message, 5) +proc clearccEnableArenas*(message: google_protobuf_FileOptions) = + message.ccEnableArenas = false + clearFields(message, [31]) -proc clientStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = - message.clientStreaming +proc hasccEnableArenas*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 31) -proc `clientStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = - setclientStreaming(message, value) +proc setccEnableArenas*(message: google_protobuf_FileOptions, value: bool) = + message.ccEnableArenas = value + setField(message, 31) -proc clearserverStreaming*(message: google_protobuf_MethodDescriptorProto) = - message.serverStreaming = false - clearFields(message, [6]) +proc ccEnableArenas*(message: google_protobuf_FileOptions): bool {.inline.} = + message.ccEnableArenas -proc hasserverStreaming*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 6) +proc `ccEnableArenas=`*(message: google_protobuf_FileOptions, value: bool) {.inline.} = + setccEnableArenas(message, value) -proc setserverStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = - message.serverStreaming = value - setField(message, 6) +proc clearobjcClassPrefix*(message: google_protobuf_FileOptions) = + message.objcClassPrefix = "" + clearFields(message, [36]) -proc serverStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = - message.serverStreaming +proc hasobjcClassPrefix*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 36) -proc `serverStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = - setserverStreaming(message, value) +proc setobjcClassPrefix*(message: google_protobuf_FileOptions, value: string) = + message.objcClassPrefix = value + setField(message, 36) -proc sizeOfgoogle_protobuf_MethodDescriptorProto*(message: google_protobuf_MethodDescriptorProto): uint64 = - if hasname(message): - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.name) - if hasinputType(message): - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfString(message.inputType) - if hasoutputType(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfString(message.outputType) - if hasoptions(message): - result = result + sizeOfTag(4, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MethodOptions(message.options)) - if hasclientStreaming(message): - result = result + sizeOfTag(5, WireType.Varint) - result = result + sizeOfBool(message.clientStreaming) - if hasserverStreaming(message): - result = result + sizeOfTag(6, WireType.Varint) - result = result + sizeOfBool(message.serverStreaming) - result = result + sizeOfUnknownFields(message) +proc objcClassPrefix*(message: google_protobuf_FileOptions): string {.inline.} = + message.objcClassPrefix -proc writegoogle_protobuf_MethodDescriptorProto*(stream: Stream, message: google_protobuf_MethodDescriptorProto) = - if hasname(message): - protoWriteString(stream, message.name, 1) - if hasinputType(message): - protoWriteString(stream, message.inputType, 2) - if hasoutputType(message): - protoWriteString(stream, message.outputType, 3) - if hasoptions(message): - writeMessage(stream, message.options, 4) - if hasclientStreaming(message): - protoWriteBool(stream, message.clientStreaming, 5) - if hasserverStreaming(message): - protoWriteBool(stream, message.serverStreaming, 6) - writeUnknownFields(stream, message) +proc `objcClassPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setobjcClassPrefix(message, value) -proc readgoogle_protobuf_MethodDescriptorProto*(stream: Stream): google_protobuf_MethodDescriptorProto = - result = newgoogle_protobuf_MethodDescriptorProto() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.LengthDelimited) - setname(result, protoReadString(stream)) - of 2: - expectWireType(wireType, WireType.LengthDelimited) - setinputType(result, protoReadString(stream)) - of 3: - expectWireType(wireType, WireType.LengthDelimited) - setoutputType(result, protoReadString(stream)) - of 4: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_MethodOptions(data)) - of 5: - expectWireType(wireType, WireType.Varint) - setclientStreaming(result, protoReadBool(stream)) - of 6: - expectWireType(wireType, WireType.Varint) - setserverStreaming(result, protoReadBool(stream)) - else: readUnknownField(stream, result, tag) +proc clearcsharpNamespace*(message: google_protobuf_FileOptions) = + message.csharpNamespace = "" + clearFields(message, [37]) -proc serialize*(message: google_protobuf_MethodDescriptorProto): string = - let - ss = newStringStream() - writegoogle_protobuf_MethodDescriptorProto(ss, message) - result = ss.data +proc hascsharpNamespace*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 37) -proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto = - let - ss = newStringStream(data) - result = readgoogle_protobuf_MethodDescriptorProto(ss) +proc setcsharpNamespace*(message: google_protobuf_FileOptions, value: string) = + message.csharpNamespace = value + setField(message, 37) -proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MethodDescriptorProto(ss) +proc csharpNamespace*(message: google_protobuf_FileOptions): string {.inline.} = + message.csharpNamespace +proc `csharpNamespace=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setcsharpNamespace(message, value) -proc fullyQualifiedName*(T: typedesc[google_protobuf_ServiceDescriptorProto]): string = "google.protobuf.ServiceDescriptorProto" +proc clearswiftPrefix*(message: google_protobuf_FileOptions) = + message.swiftPrefix = "" + clearFields(message, [39]) -proc readgoogle_protobuf_ServiceDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_ServiceDescriptorProto(stream) -proc writegoogle_protobuf_ServiceDescriptorProtoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ServiceDescriptorProto(stream, google_protobuf_ServiceDescriptorProto(msg)) +proc hasswiftPrefix*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 39) -proc google_protobuf_ServiceDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_ServiceDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_ServiceDescriptorProtoImpl +proc setswiftPrefix*(message: google_protobuf_FileOptions, value: string) = + message.swiftPrefix = value + setField(message, 39) -proc newgoogle_protobuf_ServiceDescriptorProto*(): google_protobuf_ServiceDescriptorProto = - new(result) - initMessage(result[]) - result.procs = google_protobuf_ServiceDescriptorProtoProcs() - result.name = "" - result.fmethod = @[] - result.options = nil +proc swiftPrefix*(message: google_protobuf_FileOptions): string {.inline.} = + message.swiftPrefix + +proc `swiftPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setswiftPrefix(message, value) -proc clearname*(message: google_protobuf_ServiceDescriptorProto) = - message.name = "" - clearFields(message, [1]) +proc clearphpClassPrefix*(message: google_protobuf_FileOptions) = + message.phpClassPrefix = "" + clearFields(message, [40]) -proc hasname*(message: google_protobuf_ServiceDescriptorProto): bool = - result = hasField(message, 1) +proc hasphpClassPrefix*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 40) -proc setname*(message: google_protobuf_ServiceDescriptorProto, value: string) = - message.name = value - setField(message, 1) +proc setphpClassPrefix*(message: google_protobuf_FileOptions, value: string) = + message.phpClassPrefix = value + setField(message, 40) -proc name*(message: google_protobuf_ServiceDescriptorProto): string {.inline.} = - message.name +proc phpClassPrefix*(message: google_protobuf_FileOptions): string {.inline.} = + message.phpClassPrefix -proc `name=`*(message: google_protobuf_ServiceDescriptorProto, value: string) {.inline.} = - setname(message, value) +proc `phpClassPrefix=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setphpClassPrefix(message, value) -proc clearfmethod*(message: google_protobuf_ServiceDescriptorProto) = - message.fmethod = @[] - clearFields(message, [2]) +proc clearphpNamespace*(message: google_protobuf_FileOptions) = + message.phpNamespace = "" + clearFields(message, [41]) -proc hasfmethod*(message: google_protobuf_ServiceDescriptorProto): bool = - result = hasField(message, 2) or (len(message.fmethod) > 0) +proc hasphpNamespace*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 41) -proc setfmethod*(message: google_protobuf_ServiceDescriptorProto, value: seq[google_protobuf_MethodDescriptorProto]) = - message.fmethod = value - setField(message, 2) +proc setphpNamespace*(message: google_protobuf_FileOptions, value: string) = + message.phpNamespace = value + setField(message, 41) -proc addfmethod*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_MethodDescriptorProto) = - add(message.fmethod, value) +proc phpNamespace*(message: google_protobuf_FileOptions): string {.inline.} = + message.phpNamespace -proc fmethod*(message: google_protobuf_ServiceDescriptorProto): seq[google_protobuf_MethodDescriptorProto] {.inline.} = - message.fmethod +proc `phpNamespace=`*(message: google_protobuf_FileOptions, value: string) {.inline.} = + setphpNamespace(message, value) -proc `fmethod=`*(message: google_protobuf_ServiceDescriptorProto, value: seq[google_protobuf_MethodDescriptorProto]) {.inline.} = - setfmethod(message, value) +proc clearuninterpretedOption*(message: google_protobuf_FileOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc clearoptions*(message: google_protobuf_ServiceDescriptorProto) = - message.options = nil - clearFields(message, [3]) +proc hasuninterpretedOption*(message: google_protobuf_FileOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc hasoptions*(message: google_protobuf_ServiceDescriptorProto): bool = - result = hasField(message, 3) +proc setuninterpretedOption*(message: google_protobuf_FileOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc setoptions*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_ServiceOptions) = - message.options = value - setField(message, 3) +proc adduninterpretedOption*(message: google_protobuf_FileOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc options*(message: google_protobuf_ServiceDescriptorProto): google_protobuf_ServiceOptions {.inline.} = - message.options +proc uninterpretedOption*(message: google_protobuf_FileOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -proc `options=`*(message: google_protobuf_ServiceDescriptorProto, value: google_protobuf_ServiceOptions) {.inline.} = - setoptions(message, value) +proc `uninterpretedOption=`*(message: google_protobuf_FileOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) -proc sizeOfgoogle_protobuf_ServiceDescriptorProto*(message: google_protobuf_ServiceDescriptorProto): uint64 = - if hasname(message): +proc sizeOfgoogle_protobuf_FileOptions*(message: google_protobuf_FileOptions): uint64 = + if hasjavaPackage(message): result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.name) - for value in message.fmethod: - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_MethodDescriptorProto(value)) - if hasoptions(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ServiceOptions(message.options)) + result = result + sizeOfString(message.javaPackage) + if hasjavaOuterClassname(message): + result = result + sizeOfTag(8, WireType.LengthDelimited) + result = result + sizeOfString(message.javaOuterClassname) + if hasjavaMultipleFiles(message): + result = result + sizeOfTag(10, WireType.Varint) + result = result + sizeOfBool(message.javaMultipleFiles) + if hasjavaGenerateEqualsAndHash(message): + result = result + sizeOfTag(20, WireType.Varint) + result = result + sizeOfBool(message.javaGenerateEqualsAndHash) + if hasjavaStringCheckUtf8(message): + result = result + sizeOfTag(27, WireType.Varint) + result = result + sizeOfBool(message.javaStringCheckUtf8) + if hasoptimizeFor(message): + result = result + sizeOfTag(9, WireType.Varint) + result = result + sizeOfEnum[google_protobuf_FileOptions_OptimizeMode](message.optimizeFor) + if hasgoPackage(message): + result = result + sizeOfTag(11, WireType.LengthDelimited) + result = result + sizeOfString(message.goPackage) + if hasccGenericServices(message): + result = result + sizeOfTag(16, WireType.Varint) + result = result + sizeOfBool(message.ccGenericServices) + if hasjavaGenericServices(message): + result = result + sizeOfTag(17, WireType.Varint) + result = result + sizeOfBool(message.javaGenericServices) + if haspyGenericServices(message): + result = result + sizeOfTag(18, WireType.Varint) + result = result + sizeOfBool(message.pyGenericServices) + if hasphpGenericServices(message): + result = result + sizeOfTag(42, WireType.Varint) + result = result + sizeOfBool(message.phpGenericServices) + if hasdeprecated(message): + result = result + sizeOfTag(23, WireType.Varint) + result = result + sizeOfBool(message.deprecated) + if hasccEnableArenas(message): + result = result + sizeOfTag(31, WireType.Varint) + result = result + sizeOfBool(message.ccEnableArenas) + if hasobjcClassPrefix(message): + result = result + sizeOfTag(36, WireType.LengthDelimited) + result = result + sizeOfString(message.objcClassPrefix) + if hascsharpNamespace(message): + result = result + sizeOfTag(37, WireType.LengthDelimited) + result = result + sizeOfString(message.csharpNamespace) + if hasswiftPrefix(message): + result = result + sizeOfTag(39, WireType.LengthDelimited) + result = result + sizeOfString(message.swiftPrefix) + if hasphpClassPrefix(message): + result = result + sizeOfTag(40, WireType.LengthDelimited) + result = result + sizeOfString(message.phpClassPrefix) + if hasphpNamespace(message): + result = result + sizeOfTag(41, WireType.LengthDelimited) + result = result + sizeOfString(message.phpNamespace) + for value in message.uninterpretedOption: + result = result + sizeOfTag(999, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_UninterpretedOption(value)) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_ServiceDescriptorProto*(stream: Stream, message: google_protobuf_ServiceDescriptorProto) = - if hasname(message): - protoWriteString(stream, message.name, 1) - for value in message.fmethod: - writeMessage(stream, value, 2) - if hasoptions(message): - writeMessage(stream, message.options, 3) +proc writegoogle_protobuf_FileOptions*(stream: Stream, message: google_protobuf_FileOptions) = + if hasjavaPackage(message): + protoWriteString(stream, message.javaPackage, 1) + if hasjavaOuterClassname(message): + protoWriteString(stream, message.javaOuterClassname, 8) + if hasjavaMultipleFiles(message): + protoWriteBool(stream, message.javaMultipleFiles, 10) + if hasjavaGenerateEqualsAndHash(message): + protoWriteBool(stream, message.javaGenerateEqualsAndHash, 20) + if hasjavaStringCheckUtf8(message): + protoWriteBool(stream, message.javaStringCheckUtf8, 27) + if hasoptimizeFor(message): + protoWriteEnum(stream, message.optimizeFor, 9) + if hasgoPackage(message): + protoWriteString(stream, message.goPackage, 11) + if hasccGenericServices(message): + protoWriteBool(stream, message.ccGenericServices, 16) + if hasjavaGenericServices(message): + protoWriteBool(stream, message.javaGenericServices, 17) + if haspyGenericServices(message): + protoWriteBool(stream, message.pyGenericServices, 18) + if hasphpGenericServices(message): + protoWriteBool(stream, message.phpGenericServices, 42) + if hasdeprecated(message): + protoWriteBool(stream, message.deprecated, 23) + if hasccEnableArenas(message): + protoWriteBool(stream, message.ccEnableArenas, 31) + if hasobjcClassPrefix(message): + protoWriteString(stream, message.objcClassPrefix, 36) + if hascsharpNamespace(message): + protoWriteString(stream, message.csharpNamespace, 37) + if hasswiftPrefix(message): + protoWriteString(stream, message.swiftPrefix, 39) + if hasphpClassPrefix(message): + protoWriteString(stream, message.phpClassPrefix, 40) + if hasphpNamespace(message): + protoWriteString(stream, message.phpNamespace, 41) + for value in message.uninterpretedOption: + writeMessage(stream, value, 999) writeUnknownFields(stream, message) -proc readgoogle_protobuf_ServiceDescriptorProto*(stream: Stream): google_protobuf_ServiceDescriptorProto = - result = newgoogle_protobuf_ServiceDescriptorProto() +proc readgoogle_protobuf_FileOptions*(stream: Stream): google_protobuf_FileOptions = + result = newgoogle_protobuf_FileOptions() while not atEnd(stream): let tag = readTag(stream) @@ -4329,32 +4529,79 @@ proc readgoogle_protobuf_ServiceDescriptorProto*(stream: Stream): google_protobu raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.LengthDelimited) - setname(result, protoReadString(stream)) - of 2: + setjavaPackage(result, protoReadString(stream)) + of 8: expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addfmethod(result, newgoogle_protobuf_MethodDescriptorProto(data)) - of 3: + setjavaOuterClassname(result, protoReadString(stream)) + of 10: + expectWireType(wireType, WireType.Varint) + setjavaMultipleFiles(result, protoReadBool(stream)) + of 20: + expectWireType(wireType, WireType.Varint) + setjavaGenerateEqualsAndHash(result, protoReadBool(stream)) + of 27: + expectWireType(wireType, WireType.Varint) + setjavaStringCheckUtf8(result, protoReadBool(stream)) + of 9: + expectWireType(wireType, WireType.Varint) + setoptimizeFor(result, protoReadEnum[google_protobuf_FileOptions_OptimizeMode](stream)) + of 11: + expectWireType(wireType, WireType.LengthDelimited) + setgoPackage(result, protoReadString(stream)) + of 16: + expectWireType(wireType, WireType.Varint) + setccGenericServices(result, protoReadBool(stream)) + of 17: + expectWireType(wireType, WireType.Varint) + setjavaGenericServices(result, protoReadBool(stream)) + of 18: + expectWireType(wireType, WireType.Varint) + setpyGenericServices(result, protoReadBool(stream)) + of 42: + expectWireType(wireType, WireType.Varint) + setphpGenericServices(result, protoReadBool(stream)) + of 23: + expectWireType(wireType, WireType.Varint) + setdeprecated(result, protoReadBool(stream)) + of 31: + expectWireType(wireType, WireType.Varint) + setccEnableArenas(result, protoReadBool(stream)) + of 36: + expectWireType(wireType, WireType.LengthDelimited) + setobjcClassPrefix(result, protoReadString(stream)) + of 37: + expectWireType(wireType, WireType.LengthDelimited) + setcsharpNamespace(result, protoReadString(stream)) + of 39: + expectWireType(wireType, WireType.LengthDelimited) + setswiftPrefix(result, protoReadString(stream)) + of 40: + expectWireType(wireType, WireType.LengthDelimited) + setphpClassPrefix(result, protoReadString(stream)) + of 41: + expectWireType(wireType, WireType.LengthDelimited) + setphpNamespace(result, protoReadString(stream)) + of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_ServiceOptions(data)) + adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_ServiceDescriptorProto): string = +proc serialize*(message: google_protobuf_FileOptions): string = let ss = newStringStream() - writegoogle_protobuf_ServiceDescriptorProto(ss, message) + writegoogle_protobuf_FileOptions(ss, message) result = ss.data -proc newgoogle_protobuf_ServiceDescriptorProto*(data: string): google_protobuf_ServiceDescriptorProto = +proc newgoogle_protobuf_FileOptions*(data: string): google_protobuf_FileOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_ServiceDescriptorProto(ss) + result = readgoogle_protobuf_FileOptions(ss) -proc newgoogle_protobuf_ServiceDescriptorProto*(data: seq[byte]): google_protobuf_ServiceDescriptorProto = +proc newgoogle_protobuf_FileOptions*(data: seq[byte]): google_protobuf_FileOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_ServiceDescriptorProto(ss) + result = readgoogle_protobuf_FileOptions(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_FileDescriptorProto]): string = "google.protobuf.FileDescriptorProto" @@ -4844,250 +5091,3 @@ proc newgoogle_protobuf_FileDescriptorSet*(data: seq[byte]): google_protobuf_Fil result = readgoogle_protobuf_FileDescriptorSet(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_GeneratedCodeInfo_Annotation]): string = "google.protobuf.GeneratedCodeInfo.Annotation" - -proc readgoogle_protobuf_GeneratedCodeInfo_AnnotationImpl(stream: Stream): Message = readgoogle_protobuf_GeneratedCodeInfo_Annotation(stream) -proc writegoogle_protobuf_GeneratedCodeInfo_AnnotationImpl(stream: Stream, msg: Message) = writegoogle_protobuf_GeneratedCodeInfo_Annotation(stream, google_protobuf_GeneratedCodeInfo_Annotation(msg)) - -proc google_protobuf_GeneratedCodeInfo_AnnotationProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_GeneratedCodeInfo_AnnotationImpl - result.writeImpl = writegoogle_protobuf_GeneratedCodeInfo_AnnotationImpl - -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(): google_protobuf_GeneratedCodeInfo_Annotation = - new(result) - initMessage(result[]) - result.procs = google_protobuf_GeneratedCodeInfo_AnnotationProcs() - result.path = @[] - result.sourceFile = "" - result.begin = 0 - result.fend = 0 - -proc clearpath*(message: google_protobuf_GeneratedCodeInfo_Annotation) = - message.path = @[] - clearFields(message, [1]) - -proc haspath*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = - result = hasField(message, 1) or (len(message.path) > 0) - -proc setpath*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: seq[int32]) = - message.path = value - setField(message, 1) - -proc addpath*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = - add(message.path, value) - -proc path*(message: google_protobuf_GeneratedCodeInfo_Annotation): seq[int32] {.inline.} = - message.path - -proc `path=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: seq[int32]) {.inline.} = - setpath(message, value) - -proc clearsourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation) = - message.sourceFile = "" - clearFields(message, [2]) - -proc hassourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = - result = hasField(message, 2) - -proc setsourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: string) = - message.sourceFile = value - setField(message, 2) - -proc sourceFile*(message: google_protobuf_GeneratedCodeInfo_Annotation): string {.inline.} = - message.sourceFile - -proc `sourceFile=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: string) {.inline.} = - setsourceFile(message, value) - -proc clearbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation) = - message.begin = 0 - clearFields(message, [3]) - -proc hasbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = - result = hasField(message, 3) - -proc setbegin*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = - message.begin = value - setField(message, 3) - -proc begin*(message: google_protobuf_GeneratedCodeInfo_Annotation): int32 {.inline.} = - message.begin - -proc `begin=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) {.inline.} = - setbegin(message, value) - -proc clearfend*(message: google_protobuf_GeneratedCodeInfo_Annotation) = - message.fend = 0 - clearFields(message, [4]) - -proc hasfend*(message: google_protobuf_GeneratedCodeInfo_Annotation): bool = - result = hasField(message, 4) - -proc setfend*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) = - message.fend = value - setField(message, 4) - -proc fend*(message: google_protobuf_GeneratedCodeInfo_Annotation): int32 {.inline.} = - message.fend - -proc `fend=`*(message: google_protobuf_GeneratedCodeInfo_Annotation, value: int32) {.inline.} = - setfend(message, value) - -proc sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation*(message: google_protobuf_GeneratedCodeInfo_Annotation): uint64 = - if len(message.path) > 0: - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(packedFieldSize(message.path, FieldType.Int32)) - if hassourceFile(message): - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfString(message.sourceFile) - if hasbegin(message): - result = result + sizeOfTag(3, WireType.Varint) - result = result + sizeOfInt32(message.begin) - if hasfend(message): - result = result + sizeOfTag(4, WireType.Varint) - result = result + sizeOfInt32(message.fend) - result = result + sizeOfUnknownFields(message) - -proc writegoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream, message: google_protobuf_GeneratedCodeInfo_Annotation) = - if len(message.path) > 0: - writeTag(stream, 1, WireType.LengthDelimited) - writeVarint(stream, packedFieldSize(message.path, FieldType.Int32)) - for value in message.path: - protoWriteInt32(stream, value) - if hassourceFile(message): - protoWriteString(stream, message.sourceFile, 2) - if hasbegin(message): - protoWriteInt32(stream, message.begin, 3) - if hasfend(message): - protoWriteInt32(stream, message.fend, 4) - writeUnknownFields(stream, message) - -proc readgoogle_protobuf_GeneratedCodeInfo_Annotation*(stream: Stream): google_protobuf_GeneratedCodeInfo_Annotation = - result = newgoogle_protobuf_GeneratedCodeInfo_Annotation() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.Varint, WireType.LengthDelimited) - if wireType == WireType.LengthDelimited: - let - size = readVarint(stream) - start = uint64(getPosition(stream)) - var consumed = 0'u64 - while consumed < size: - addpath(result, protoReadInt32(stream)) - consumed = uint64(getPosition(stream)) - start - if consumed != size: - raise newException(Exception, "packed field size mismatch") - else: - addpath(result, protoReadInt32(stream)) - of 2: - expectWireType(wireType, WireType.LengthDelimited) - setsourceFile(result, protoReadString(stream)) - of 3: - expectWireType(wireType, WireType.Varint) - setbegin(result, protoReadInt32(stream)) - of 4: - expectWireType(wireType, WireType.Varint) - setfend(result, protoReadInt32(stream)) - else: readUnknownField(stream, result, tag) - -proc serialize*(message: google_protobuf_GeneratedCodeInfo_Annotation): string = - let - ss = newStringStream() - writegoogle_protobuf_GeneratedCodeInfo_Annotation(ss, message) - result = ss.data - -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: string): google_protobuf_GeneratedCodeInfo_Annotation = - let - ss = newStringStream(data) - result = readgoogle_protobuf_GeneratedCodeInfo_Annotation(ss) - -proc newgoogle_protobuf_GeneratedCodeInfo_Annotation*(data: seq[byte]): google_protobuf_GeneratedCodeInfo_Annotation = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_GeneratedCodeInfo_Annotation(ss) - - -proc fullyQualifiedName*(T: typedesc[google_protobuf_GeneratedCodeInfo]): string = "google.protobuf.GeneratedCodeInfo" - -proc readgoogle_protobuf_GeneratedCodeInfoImpl(stream: Stream): Message = readgoogle_protobuf_GeneratedCodeInfo(stream) -proc writegoogle_protobuf_GeneratedCodeInfoImpl(stream: Stream, msg: Message) = writegoogle_protobuf_GeneratedCodeInfo(stream, google_protobuf_GeneratedCodeInfo(msg)) - -proc google_protobuf_GeneratedCodeInfoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_GeneratedCodeInfoImpl - result.writeImpl = writegoogle_protobuf_GeneratedCodeInfoImpl - -proc newgoogle_protobuf_GeneratedCodeInfo*(): google_protobuf_GeneratedCodeInfo = - new(result) - initMessage(result[]) - result.procs = google_protobuf_GeneratedCodeInfoProcs() - result.annotation = @[] - -proc clearannotation*(message: google_protobuf_GeneratedCodeInfo) = - message.annotation = @[] - clearFields(message, [1]) - -proc hasannotation*(message: google_protobuf_GeneratedCodeInfo): bool = - result = hasField(message, 1) or (len(message.annotation) > 0) - -proc setannotation*(message: google_protobuf_GeneratedCodeInfo, value: seq[google_protobuf_GeneratedCodeInfo_Annotation]) = - message.annotation = value - setField(message, 1) - -proc addannotation*(message: google_protobuf_GeneratedCodeInfo, value: google_protobuf_GeneratedCodeInfo_Annotation) = - add(message.annotation, value) - -proc annotation*(message: google_protobuf_GeneratedCodeInfo): seq[google_protobuf_GeneratedCodeInfo_Annotation] {.inline.} = - message.annotation - -proc `annotation=`*(message: google_protobuf_GeneratedCodeInfo, value: seq[google_protobuf_GeneratedCodeInfo_Annotation]) {.inline.} = - setannotation(message, value) - -proc sizeOfgoogle_protobuf_GeneratedCodeInfo*(message: google_protobuf_GeneratedCodeInfo): uint64 = - for value in message.annotation: - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_GeneratedCodeInfo_Annotation(value)) - result = result + sizeOfUnknownFields(message) - -proc writegoogle_protobuf_GeneratedCodeInfo*(stream: Stream, message: google_protobuf_GeneratedCodeInfo) = - for value in message.annotation: - writeMessage(stream, value, 1) - writeUnknownFields(stream, message) - -proc readgoogle_protobuf_GeneratedCodeInfo*(stream: Stream): google_protobuf_GeneratedCodeInfo = - result = newgoogle_protobuf_GeneratedCodeInfo() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: - expectWireType(wireType, WireType.LengthDelimited) - let data = readLengthDelimited(stream) - addannotation(result, newgoogle_protobuf_GeneratedCodeInfo_Annotation(data)) - else: readUnknownField(stream, result, tag) - -proc serialize*(message: google_protobuf_GeneratedCodeInfo): string = - let - ss = newStringStream() - writegoogle_protobuf_GeneratedCodeInfo(ss, message) - result = ss.data - -proc newgoogle_protobuf_GeneratedCodeInfo*(data: string): google_protobuf_GeneratedCodeInfo = - let - ss = newStringStream(data) - result = readgoogle_protobuf_GeneratedCodeInfo(ss) - -proc newgoogle_protobuf_GeneratedCodeInfo*(data: seq[byte]): google_protobuf_GeneratedCodeInfo = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_GeneratedCodeInfo(ss) - - diff --git a/nimpb/wkt/struct_pb.nim b/nimpb/wkt/struct_pb.nim index 78538ac..658a26d 100644 --- a/nimpb/wkt/struct_pb.nim +++ b/nimpb/wkt/struct_pb.nim @@ -42,10 +42,6 @@ type google_protobuf_ListValueObj* = object of Message values: seq[google_protobuf_Value] -proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, key: string, value: google_protobuf_Value) -proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, tbl: TableRef[string, google_protobuf_Value]) -proc sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key: string, value: google_protobuf_Value): uint64 - proc newgoogle_protobuf_Struct*(): google_protobuf_Struct proc newgoogle_protobuf_Struct*(data: string): google_protobuf_Struct proc newgoogle_protobuf_Struct*(data: seq[byte]): google_protobuf_Struct @@ -67,44 +63,9 @@ proc writegoogle_protobuf_Value*(stream: Stream, message: google_protobuf_Value) proc readgoogle_protobuf_Value*(stream: Stream): google_protobuf_Value proc sizeOfgoogle_protobuf_Value*(message: google_protobuf_Value): uint64 -proc sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key: string, value: google_protobuf_Value): uint64 = - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(key) - result = result + sizeOfTag(2, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_Value(value)) - -proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, key: string, value: google_protobuf_Value) = - protoWriteString(stream, key, 1) - writeMessage(stream, value, 2) - -proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, tbl: TableRef[string, google_protobuf_Value]) = - var - key: string - gotKey = false - value: google_protobuf_Value - gotValue = false - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 1: - key = protoReadString(stream) - gotKey = true - of 2: - let - size = readVarint(stream) - data = safeReadStr(stream, int(size)) - pbs = newStringStream(data) - value = readgoogle_protobuf_Value(pbs) - gotValue = true - else: skipField(stream, wireType) - if not gotKey: - raise newException(Exception, "missing key") - if not gotValue: - raise newException(Exception, "missing value") - tbl[key] = value - +proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, key: string, value: google_protobuf_Value) +proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, tbl: TableRef[string, google_protobuf_Value]) +proc sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key: string, value: google_protobuf_Value): uint64 proc fullyQualifiedName*(T: typedesc[google_protobuf_Struct]): string = "google.protobuf.Struct" @@ -275,7 +236,7 @@ proc newgoogle_protobuf_Value*(): google_protobuf_Value = new(result) initMessage(result[]) result.procs = google_protobuf_ValueProcs() - result.kind.kind = google_protobuf_Value_kind_Kind.NotSet + result.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.NotSet) proc clearnullValue*(message: google_protobuf_Value) = reset(message.kind) @@ -287,9 +248,9 @@ proc hasnullValue*(message: google_protobuf_Value): bool = proc setnullValue*(message: google_protobuf_Value, value: google_protobuf_NullValue) = if message.kind.kind != google_protobuf_Value_kind_Kind.NullValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.NullValue - message.kind.nullValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.NullValue, nullValue: value) + else: + message.kind.nullValue = value setField(message, 1) clearFields(message, [2, 3, 4, 5, 6]) @@ -309,9 +270,9 @@ proc hasnumberValue*(message: google_protobuf_Value): bool = proc setnumberValue*(message: google_protobuf_Value, value: float64) = if message.kind.kind != google_protobuf_Value_kind_Kind.NumberValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.NumberValue - message.kind.numberValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.NumberValue, numberValue: value) + else: + message.kind.numberValue = value setField(message, 2) clearFields(message, [1, 3, 4, 5, 6]) @@ -331,9 +292,9 @@ proc hasstringValue*(message: google_protobuf_Value): bool = proc setstringValue*(message: google_protobuf_Value, value: string) = if message.kind.kind != google_protobuf_Value_kind_Kind.StringValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.StringValue - message.kind.stringValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.StringValue, stringValue: value) + else: + message.kind.stringValue = value setField(message, 3) clearFields(message, [1, 2, 4, 5, 6]) @@ -353,9 +314,9 @@ proc hasboolValue*(message: google_protobuf_Value): bool = proc setboolValue*(message: google_protobuf_Value, value: bool) = if message.kind.kind != google_protobuf_Value_kind_Kind.BoolValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.BoolValue - message.kind.boolValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.BoolValue, boolValue: value) + else: + message.kind.boolValue = value setField(message, 4) clearFields(message, [1, 2, 3, 5, 6]) @@ -375,9 +336,9 @@ proc hasstructValue*(message: google_protobuf_Value): bool = proc setstructValue*(message: google_protobuf_Value, value: google_protobuf_Struct) = if message.kind.kind != google_protobuf_Value_kind_Kind.StructValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.StructValue - message.kind.structValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.StructValue, structValue: value) + else: + message.kind.structValue = value setField(message, 5) clearFields(message, [1, 2, 3, 4, 6]) @@ -397,9 +358,9 @@ proc haslistValue*(message: google_protobuf_Value): bool = proc setlistValue*(message: google_protobuf_Value, value: google_protobuf_ListValue) = if message.kind.kind != google_protobuf_Value_kind_Kind.ListValue: - reset(message.kind) - message.kind.kind = google_protobuf_Value_kind_Kind.ListValue - message.kind.listValue = value + message.kind = google_protobuf_Value_kind_OneOf(kind: google_protobuf_Value_kind_Kind.ListValue, listValue: value) + else: + message.kind.listValue = value setField(message, 6) clearFields(message, [1, 2, 3, 4, 5]) @@ -493,3 +454,42 @@ proc newgoogle_protobuf_Value*(data: seq[byte]): google_protobuf_Value = result = readgoogle_protobuf_Value(ss) +proc sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key: string, value: google_protobuf_Value): uint64 = + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfString(key) + result = result + sizeOfTag(2, WireType.LengthDelimited) + result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_Value(value)) + +proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, key: string, value: google_protobuf_Value) = + protoWriteString(stream, key, 1) + writeMessage(stream, value, 2) + +proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: Stream, tbl: TableRef[string, google_protobuf_Value]) = + var + key: string + gotKey = false + value: google_protobuf_Value + gotValue = false + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 1: + key = protoReadString(stream) + gotKey = true + of 2: + let + size = readVarint(stream) + data = safeReadStr(stream, int(size)) + pbs = newStringStream(data) + value = readgoogle_protobuf_Value(pbs) + gotValue = true + else: skipField(stream, wireType) + if not gotKey: + raise newException(Exception, "missing key") + if not gotValue: + raise newException(Exception, "missing value") + tbl[key] = value + + diff --git a/nimpb/wkt/wrappers_pb.nim b/nimpb/wkt/wrappers_pb.nim index 01ace8a..2c319a1 100644 --- a/nimpb/wkt/wrappers_pb.nim +++ b/nimpb/wkt/wrappers_pb.nim @@ -37,19 +37,19 @@ type google_protobuf_BytesValueObj* = object of Message value: seq[byte] -proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value -proc newgoogle_protobuf_Int32Value*(data: string): google_protobuf_Int32Value -proc newgoogle_protobuf_Int32Value*(data: seq[byte]): google_protobuf_Int32Value -proc writegoogle_protobuf_Int32Value*(stream: Stream, message: google_protobuf_Int32Value) -proc readgoogle_protobuf_Int32Value*(stream: Stream): google_protobuf_Int32Value -proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64 +proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue +proc newgoogle_protobuf_BoolValue*(data: string): google_protobuf_BoolValue +proc newgoogle_protobuf_BoolValue*(data: seq[byte]): google_protobuf_BoolValue +proc writegoogle_protobuf_BoolValue*(stream: Stream, message: google_protobuf_BoolValue) +proc readgoogle_protobuf_BoolValue*(stream: Stream): google_protobuf_BoolValue +proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64 -proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value -proc newgoogle_protobuf_Int64Value*(data: string): google_protobuf_Int64Value -proc newgoogle_protobuf_Int64Value*(data: seq[byte]): google_protobuf_Int64Value -proc writegoogle_protobuf_Int64Value*(stream: Stream, message: google_protobuf_Int64Value) -proc readgoogle_protobuf_Int64Value*(stream: Stream): google_protobuf_Int64Value -proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64 +proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value +proc newgoogle_protobuf_UInt64Value*(data: string): google_protobuf_UInt64Value +proc newgoogle_protobuf_UInt64Value*(data: seq[byte]): google_protobuf_UInt64Value +proc writegoogle_protobuf_UInt64Value*(stream: Stream, message: google_protobuf_UInt64Value) +proc readgoogle_protobuf_UInt64Value*(stream: Stream): google_protobuf_UInt64Value +proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64 proc newgoogle_protobuf_DoubleValue*(): google_protobuf_DoubleValue proc newgoogle_protobuf_DoubleValue*(data: string): google_protobuf_DoubleValue @@ -58,19 +58,19 @@ proc writegoogle_protobuf_DoubleValue*(stream: Stream, message: google_protobuf_ proc readgoogle_protobuf_DoubleValue*(stream: Stream): google_protobuf_DoubleValue proc sizeOfgoogle_protobuf_DoubleValue*(message: google_protobuf_DoubleValue): uint64 -proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue -proc newgoogle_protobuf_StringValue*(data: string): google_protobuf_StringValue -proc newgoogle_protobuf_StringValue*(data: seq[byte]): google_protobuf_StringValue -proc writegoogle_protobuf_StringValue*(stream: Stream, message: google_protobuf_StringValue) -proc readgoogle_protobuf_StringValue*(stream: Stream): google_protobuf_StringValue -proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64 +proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue +proc newgoogle_protobuf_FloatValue*(data: string): google_protobuf_FloatValue +proc newgoogle_protobuf_FloatValue*(data: seq[byte]): google_protobuf_FloatValue +proc writegoogle_protobuf_FloatValue*(stream: Stream, message: google_protobuf_FloatValue) +proc readgoogle_protobuf_FloatValue*(stream: Stream): google_protobuf_FloatValue +proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64 -proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue -proc newgoogle_protobuf_BoolValue*(data: string): google_protobuf_BoolValue -proc newgoogle_protobuf_BoolValue*(data: seq[byte]): google_protobuf_BoolValue -proc writegoogle_protobuf_BoolValue*(stream: Stream, message: google_protobuf_BoolValue) -proc readgoogle_protobuf_BoolValue*(stream: Stream): google_protobuf_BoolValue -proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64 +proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value +proc newgoogle_protobuf_Int64Value*(data: string): google_protobuf_Int64Value +proc newgoogle_protobuf_Int64Value*(data: seq[byte]): google_protobuf_Int64Value +proc writegoogle_protobuf_Int64Value*(stream: Stream, message: google_protobuf_Int64Value) +proc readgoogle_protobuf_Int64Value*(stream: Stream): google_protobuf_Int64Value +proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64 proc newgoogle_protobuf_BytesValue*(): google_protobuf_BytesValue proc newgoogle_protobuf_BytesValue*(data: string): google_protobuf_BytesValue @@ -79,20 +79,6 @@ proc writegoogle_protobuf_BytesValue*(stream: Stream, message: google_protobuf_B proc readgoogle_protobuf_BytesValue*(stream: Stream): google_protobuf_BytesValue proc sizeOfgoogle_protobuf_BytesValue*(message: google_protobuf_BytesValue): uint64 -proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue -proc newgoogle_protobuf_FloatValue*(data: string): google_protobuf_FloatValue -proc newgoogle_protobuf_FloatValue*(data: seq[byte]): google_protobuf_FloatValue -proc writegoogle_protobuf_FloatValue*(stream: Stream, message: google_protobuf_FloatValue) -proc readgoogle_protobuf_FloatValue*(stream: Stream): google_protobuf_FloatValue -proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64 - -proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value -proc newgoogle_protobuf_UInt64Value*(data: string): google_protobuf_UInt64Value -proc newgoogle_protobuf_UInt64Value*(data: seq[byte]): google_protobuf_UInt64Value -proc writegoogle_protobuf_UInt64Value*(stream: Stream, message: google_protobuf_UInt64Value) -proc readgoogle_protobuf_UInt64Value*(stream: Stream): google_protobuf_UInt64Value -proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64 - proc newgoogle_protobuf_UInt32Value*(): google_protobuf_UInt32Value proc newgoogle_protobuf_UInt32Value*(data: string): google_protobuf_UInt32Value proc newgoogle_protobuf_UInt32Value*(data: seq[byte]): google_protobuf_UInt32Value @@ -100,46 +86,60 @@ proc writegoogle_protobuf_UInt32Value*(stream: Stream, message: google_protobuf_ proc readgoogle_protobuf_UInt32Value*(stream: Stream): google_protobuf_UInt32Value proc sizeOfgoogle_protobuf_UInt32Value*(message: google_protobuf_UInt32Value): uint64 -proc fullyQualifiedName*(T: typedesc[google_protobuf_Int32Value]): string = "google.protobuf.Int32Value" +proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue +proc newgoogle_protobuf_StringValue*(data: string): google_protobuf_StringValue +proc newgoogle_protobuf_StringValue*(data: seq[byte]): google_protobuf_StringValue +proc writegoogle_protobuf_StringValue*(stream: Stream, message: google_protobuf_StringValue) +proc readgoogle_protobuf_StringValue*(stream: Stream): google_protobuf_StringValue +proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64 -proc readgoogle_protobuf_Int32ValueImpl(stream: Stream): Message = readgoogle_protobuf_Int32Value(stream) -proc writegoogle_protobuf_Int32ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_Int32Value(stream, google_protobuf_Int32Value(msg)) +proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value +proc newgoogle_protobuf_Int32Value*(data: string): google_protobuf_Int32Value +proc newgoogle_protobuf_Int32Value*(data: seq[byte]): google_protobuf_Int32Value +proc writegoogle_protobuf_Int32Value*(stream: Stream, message: google_protobuf_Int32Value) +proc readgoogle_protobuf_Int32Value*(stream: Stream): google_protobuf_Int32Value +proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64 -proc google_protobuf_Int32ValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_Int32ValueImpl - result.writeImpl = writegoogle_protobuf_Int32ValueImpl +proc fullyQualifiedName*(T: typedesc[google_protobuf_BoolValue]): string = "google.protobuf.BoolValue" -proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value = +proc readgoogle_protobuf_BoolValueImpl(stream: Stream): Message = readgoogle_protobuf_BoolValue(stream) +proc writegoogle_protobuf_BoolValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_BoolValue(stream, google_protobuf_BoolValue(msg)) + +proc google_protobuf_BoolValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_BoolValueImpl + result.writeImpl = writegoogle_protobuf_BoolValueImpl + +proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue = new(result) initMessage(result[]) - result.procs = google_protobuf_Int32ValueProcs() - result.value = 0 + result.procs = google_protobuf_BoolValueProcs() + result.value = false -proc clearvalue*(message: google_protobuf_Int32Value) = - message.value = 0 +proc clearvalue*(message: google_protobuf_BoolValue) = + message.value = false -proc setvalue*(message: google_protobuf_Int32Value, value: int32) = +proc setvalue*(message: google_protobuf_BoolValue, value: bool) = message.value = value -proc value*(message: google_protobuf_Int32Value): int32 {.inline.} = +proc value*(message: google_protobuf_BoolValue): bool {.inline.} = message.value -proc `value=`*(message: google_protobuf_Int32Value, value: int32) {.inline.} = +proc `value=`*(message: google_protobuf_BoolValue, value: bool) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64 = - if message.value != 0: +proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64 = + if message.value != false: result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfInt32(message.value) + result = result + sizeOfBool(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_Int32Value*(stream: Stream, message: google_protobuf_Int32Value) = - if message.value != 0: - protoWriteInt32(stream, message.value, 1) +proc writegoogle_protobuf_BoolValue*(stream: Stream, message: google_protobuf_BoolValue) = + if message.value != false: + protoWriteBool(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_Int32Value*(stream: Stream): google_protobuf_Int32Value = - result = newgoogle_protobuf_Int32Value() +proc readgoogle_protobuf_BoolValue*(stream: Stream): google_protobuf_BoolValue = + result = newgoogle_protobuf_BoolValue() while not atEnd(stream): let tag = readTag(stream) @@ -149,66 +149,66 @@ proc readgoogle_protobuf_Int32Value*(stream: Stream): google_protobuf_Int32Value raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.Varint) - setvalue(result, protoReadInt32(stream)) + setvalue(result, protoReadBool(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_Int32Value): string = +proc serialize*(message: google_protobuf_BoolValue): string = let ss = newStringStream() - writegoogle_protobuf_Int32Value(ss, message) + writegoogle_protobuf_BoolValue(ss, message) result = ss.data -proc newgoogle_protobuf_Int32Value*(data: string): google_protobuf_Int32Value = +proc newgoogle_protobuf_BoolValue*(data: string): google_protobuf_BoolValue = let ss = newStringStream(data) - result = readgoogle_protobuf_Int32Value(ss) + result = readgoogle_protobuf_BoolValue(ss) -proc newgoogle_protobuf_Int32Value*(data: seq[byte]): google_protobuf_Int32Value = +proc newgoogle_protobuf_BoolValue*(data: seq[byte]): google_protobuf_BoolValue = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_Int32Value(ss) + result = readgoogle_protobuf_BoolValue(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_Int64Value]): string = "google.protobuf.Int64Value" +proc fullyQualifiedName*(T: typedesc[google_protobuf_UInt64Value]): string = "google.protobuf.UInt64Value" -proc readgoogle_protobuf_Int64ValueImpl(stream: Stream): Message = readgoogle_protobuf_Int64Value(stream) -proc writegoogle_protobuf_Int64ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_Int64Value(stream, google_protobuf_Int64Value(msg)) +proc readgoogle_protobuf_UInt64ValueImpl(stream: Stream): Message = readgoogle_protobuf_UInt64Value(stream) +proc writegoogle_protobuf_UInt64ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UInt64Value(stream, google_protobuf_UInt64Value(msg)) -proc google_protobuf_Int64ValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_Int64ValueImpl - result.writeImpl = writegoogle_protobuf_Int64ValueImpl +proc google_protobuf_UInt64ValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_UInt64ValueImpl + result.writeImpl = writegoogle_protobuf_UInt64ValueImpl -proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value = +proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value = new(result) initMessage(result[]) - result.procs = google_protobuf_Int64ValueProcs() + result.procs = google_protobuf_UInt64ValueProcs() result.value = 0 -proc clearvalue*(message: google_protobuf_Int64Value) = +proc clearvalue*(message: google_protobuf_UInt64Value) = message.value = 0 -proc setvalue*(message: google_protobuf_Int64Value, value: int64) = +proc setvalue*(message: google_protobuf_UInt64Value, value: uint64) = message.value = value -proc value*(message: google_protobuf_Int64Value): int64 {.inline.} = +proc value*(message: google_protobuf_UInt64Value): uint64 {.inline.} = message.value -proc `value=`*(message: google_protobuf_Int64Value, value: int64) {.inline.} = +proc `value=`*(message: google_protobuf_UInt64Value, value: uint64) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64 = +proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64 = if message.value != 0: result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfInt64(message.value) + result = result + sizeOfUInt64(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_Int64Value*(stream: Stream, message: google_protobuf_Int64Value) = +proc writegoogle_protobuf_UInt64Value*(stream: Stream, message: google_protobuf_UInt64Value) = if message.value != 0: - protoWriteInt64(stream, message.value, 1) + protoWriteUInt64(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_Int64Value*(stream: Stream): google_protobuf_Int64Value = - result = newgoogle_protobuf_Int64Value() +proc readgoogle_protobuf_UInt64Value*(stream: Stream): google_protobuf_UInt64Value = + result = newgoogle_protobuf_UInt64Value() while not atEnd(stream): let tag = readTag(stream) @@ -218,24 +218,24 @@ proc readgoogle_protobuf_Int64Value*(stream: Stream): google_protobuf_Int64Value raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.Varint) - setvalue(result, protoReadInt64(stream)) + setvalue(result, protoReadUInt64(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_Int64Value): string = +proc serialize*(message: google_protobuf_UInt64Value): string = let ss = newStringStream() - writegoogle_protobuf_Int64Value(ss, message) + writegoogle_protobuf_UInt64Value(ss, message) result = ss.data -proc newgoogle_protobuf_Int64Value*(data: string): google_protobuf_Int64Value = +proc newgoogle_protobuf_UInt64Value*(data: string): google_protobuf_UInt64Value = let ss = newStringStream(data) - result = readgoogle_protobuf_Int64Value(ss) + result = readgoogle_protobuf_UInt64Value(ss) -proc newgoogle_protobuf_Int64Value*(data: seq[byte]): google_protobuf_Int64Value = +proc newgoogle_protobuf_UInt64Value*(data: seq[byte]): google_protobuf_UInt64Value = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_Int64Value(ss) + result = readgoogle_protobuf_UInt64Value(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_DoubleValue]): string = "google.protobuf.DoubleValue" @@ -307,46 +307,46 @@ proc newgoogle_protobuf_DoubleValue*(data: seq[byte]): google_protobuf_DoubleVal result = readgoogle_protobuf_DoubleValue(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_StringValue]): string = "google.protobuf.StringValue" +proc fullyQualifiedName*(T: typedesc[google_protobuf_FloatValue]): string = "google.protobuf.FloatValue" -proc readgoogle_protobuf_StringValueImpl(stream: Stream): Message = readgoogle_protobuf_StringValue(stream) -proc writegoogle_protobuf_StringValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_StringValue(stream, google_protobuf_StringValue(msg)) +proc readgoogle_protobuf_FloatValueImpl(stream: Stream): Message = readgoogle_protobuf_FloatValue(stream) +proc writegoogle_protobuf_FloatValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FloatValue(stream, google_protobuf_FloatValue(msg)) -proc google_protobuf_StringValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_StringValueImpl - result.writeImpl = writegoogle_protobuf_StringValueImpl +proc google_protobuf_FloatValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_FloatValueImpl + result.writeImpl = writegoogle_protobuf_FloatValueImpl -proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue = +proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue = new(result) initMessage(result[]) - result.procs = google_protobuf_StringValueProcs() - result.value = "" + result.procs = google_protobuf_FloatValueProcs() + result.value = 0 -proc clearvalue*(message: google_protobuf_StringValue) = - message.value = "" +proc clearvalue*(message: google_protobuf_FloatValue) = + message.value = 0 -proc setvalue*(message: google_protobuf_StringValue, value: string) = +proc setvalue*(message: google_protobuf_FloatValue, value: float32) = message.value = value -proc value*(message: google_protobuf_StringValue): string {.inline.} = +proc value*(message: google_protobuf_FloatValue): float32 {.inline.} = message.value -proc `value=`*(message: google_protobuf_StringValue, value: string) {.inline.} = +proc `value=`*(message: google_protobuf_FloatValue, value: float32) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64 = - if len(message.value) > 0: - result = result + sizeOfTag(1, WireType.LengthDelimited) - result = result + sizeOfString(message.value) +proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64 = + if message.value != 0: + result = result + sizeOfTag(1, WireType.Fixed32) + result = result + sizeOfFloat(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_StringValue*(stream: Stream, message: google_protobuf_StringValue) = - if len(message.value) > 0: - protoWriteString(stream, message.value, 1) +proc writegoogle_protobuf_FloatValue*(stream: Stream, message: google_protobuf_FloatValue) = + if message.value != 0: + protoWriteFloat(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_StringValue*(stream: Stream): google_protobuf_StringValue = - result = newgoogle_protobuf_StringValue() +proc readgoogle_protobuf_FloatValue*(stream: Stream): google_protobuf_FloatValue = + result = newgoogle_protobuf_FloatValue() while not atEnd(stream): let tag = readTag(stream) @@ -355,67 +355,67 @@ proc readgoogle_protobuf_StringValue*(stream: Stream): google_protobuf_StringVal of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.LengthDelimited) - setvalue(result, protoReadString(stream)) + expectWireType(wireType, WireType.Fixed32) + setvalue(result, protoReadFloat(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_StringValue): string = +proc serialize*(message: google_protobuf_FloatValue): string = let ss = newStringStream() - writegoogle_protobuf_StringValue(ss, message) + writegoogle_protobuf_FloatValue(ss, message) result = ss.data -proc newgoogle_protobuf_StringValue*(data: string): google_protobuf_StringValue = +proc newgoogle_protobuf_FloatValue*(data: string): google_protobuf_FloatValue = let ss = newStringStream(data) - result = readgoogle_protobuf_StringValue(ss) + result = readgoogle_protobuf_FloatValue(ss) -proc newgoogle_protobuf_StringValue*(data: seq[byte]): google_protobuf_StringValue = +proc newgoogle_protobuf_FloatValue*(data: seq[byte]): google_protobuf_FloatValue = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_StringValue(ss) + result = readgoogle_protobuf_FloatValue(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_BoolValue]): string = "google.protobuf.BoolValue" +proc fullyQualifiedName*(T: typedesc[google_protobuf_Int64Value]): string = "google.protobuf.Int64Value" -proc readgoogle_protobuf_BoolValueImpl(stream: Stream): Message = readgoogle_protobuf_BoolValue(stream) -proc writegoogle_protobuf_BoolValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_BoolValue(stream, google_protobuf_BoolValue(msg)) +proc readgoogle_protobuf_Int64ValueImpl(stream: Stream): Message = readgoogle_protobuf_Int64Value(stream) +proc writegoogle_protobuf_Int64ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_Int64Value(stream, google_protobuf_Int64Value(msg)) -proc google_protobuf_BoolValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_BoolValueImpl - result.writeImpl = writegoogle_protobuf_BoolValueImpl +proc google_protobuf_Int64ValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_Int64ValueImpl + result.writeImpl = writegoogle_protobuf_Int64ValueImpl -proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue = +proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value = new(result) initMessage(result[]) - result.procs = google_protobuf_BoolValueProcs() - result.value = false + result.procs = google_protobuf_Int64ValueProcs() + result.value = 0 -proc clearvalue*(message: google_protobuf_BoolValue) = - message.value = false +proc clearvalue*(message: google_protobuf_Int64Value) = + message.value = 0 -proc setvalue*(message: google_protobuf_BoolValue, value: bool) = +proc setvalue*(message: google_protobuf_Int64Value, value: int64) = message.value = value -proc value*(message: google_protobuf_BoolValue): bool {.inline.} = +proc value*(message: google_protobuf_Int64Value): int64 {.inline.} = message.value -proc `value=`*(message: google_protobuf_BoolValue, value: bool) {.inline.} = +proc `value=`*(message: google_protobuf_Int64Value, value: int64) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64 = - if message.value != false: +proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64 = + if message.value != 0: result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfBool(message.value) + result = result + sizeOfInt64(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_BoolValue*(stream: Stream, message: google_protobuf_BoolValue) = - if message.value != false: - protoWriteBool(stream, message.value, 1) +proc writegoogle_protobuf_Int64Value*(stream: Stream, message: google_protobuf_Int64Value) = + if message.value != 0: + protoWriteInt64(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_BoolValue*(stream: Stream): google_protobuf_BoolValue = - result = newgoogle_protobuf_BoolValue() +proc readgoogle_protobuf_Int64Value*(stream: Stream): google_protobuf_Int64Value = + result = newgoogle_protobuf_Int64Value() while not atEnd(stream): let tag = readTag(stream) @@ -425,24 +425,24 @@ proc readgoogle_protobuf_BoolValue*(stream: Stream): google_protobuf_BoolValue = raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.Varint) - setvalue(result, protoReadBool(stream)) + setvalue(result, protoReadInt64(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_BoolValue): string = +proc serialize*(message: google_protobuf_Int64Value): string = let ss = newStringStream() - writegoogle_protobuf_BoolValue(ss, message) + writegoogle_protobuf_Int64Value(ss, message) result = ss.data -proc newgoogle_protobuf_BoolValue*(data: string): google_protobuf_BoolValue = +proc newgoogle_protobuf_Int64Value*(data: string): google_protobuf_Int64Value = let ss = newStringStream(data) - result = readgoogle_protobuf_BoolValue(ss) + result = readgoogle_protobuf_Int64Value(ss) -proc newgoogle_protobuf_BoolValue*(data: seq[byte]): google_protobuf_BoolValue = +proc newgoogle_protobuf_Int64Value*(data: seq[byte]): google_protobuf_Int64Value = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_BoolValue(ss) + result = readgoogle_protobuf_Int64Value(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_BytesValue]): string = "google.protobuf.BytesValue" @@ -514,46 +514,46 @@ proc newgoogle_protobuf_BytesValue*(data: seq[byte]): google_protobuf_BytesValue result = readgoogle_protobuf_BytesValue(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_FloatValue]): string = "google.protobuf.FloatValue" +proc fullyQualifiedName*(T: typedesc[google_protobuf_UInt32Value]): string = "google.protobuf.UInt32Value" -proc readgoogle_protobuf_FloatValueImpl(stream: Stream): Message = readgoogle_protobuf_FloatValue(stream) -proc writegoogle_protobuf_FloatValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_FloatValue(stream, google_protobuf_FloatValue(msg)) +proc readgoogle_protobuf_UInt32ValueImpl(stream: Stream): Message = readgoogle_protobuf_UInt32Value(stream) +proc writegoogle_protobuf_UInt32ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UInt32Value(stream, google_protobuf_UInt32Value(msg)) -proc google_protobuf_FloatValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_FloatValueImpl - result.writeImpl = writegoogle_protobuf_FloatValueImpl +proc google_protobuf_UInt32ValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_UInt32ValueImpl + result.writeImpl = writegoogle_protobuf_UInt32ValueImpl -proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue = +proc newgoogle_protobuf_UInt32Value*(): google_protobuf_UInt32Value = new(result) initMessage(result[]) - result.procs = google_protobuf_FloatValueProcs() + result.procs = google_protobuf_UInt32ValueProcs() result.value = 0 -proc clearvalue*(message: google_protobuf_FloatValue) = +proc clearvalue*(message: google_protobuf_UInt32Value) = message.value = 0 -proc setvalue*(message: google_protobuf_FloatValue, value: float32) = +proc setvalue*(message: google_protobuf_UInt32Value, value: uint32) = message.value = value -proc value*(message: google_protobuf_FloatValue): float32 {.inline.} = +proc value*(message: google_protobuf_UInt32Value): uint32 {.inline.} = message.value -proc `value=`*(message: google_protobuf_FloatValue, value: float32) {.inline.} = +proc `value=`*(message: google_protobuf_UInt32Value, value: uint32) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64 = +proc sizeOfgoogle_protobuf_UInt32Value*(message: google_protobuf_UInt32Value): uint64 = if message.value != 0: - result = result + sizeOfTag(1, WireType.Fixed32) - result = result + sizeOfFloat(message.value) + result = result + sizeOfTag(1, WireType.Varint) + result = result + sizeOfUInt32(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_FloatValue*(stream: Stream, message: google_protobuf_FloatValue) = +proc writegoogle_protobuf_UInt32Value*(stream: Stream, message: google_protobuf_UInt32Value) = if message.value != 0: - protoWriteFloat(stream, message.value, 1) + protoWriteUInt32(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_FloatValue*(stream: Stream): google_protobuf_FloatValue = - result = newgoogle_protobuf_FloatValue() +proc readgoogle_protobuf_UInt32Value*(stream: Stream): google_protobuf_UInt32Value = + result = newgoogle_protobuf_UInt32Value() while not atEnd(stream): let tag = readTag(stream) @@ -562,67 +562,67 @@ proc readgoogle_protobuf_FloatValue*(stream: Stream): google_protobuf_FloatValue of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.Fixed32) - setvalue(result, protoReadFloat(stream)) + expectWireType(wireType, WireType.Varint) + setvalue(result, protoReadUInt32(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_FloatValue): string = +proc serialize*(message: google_protobuf_UInt32Value): string = let ss = newStringStream() - writegoogle_protobuf_FloatValue(ss, message) + writegoogle_protobuf_UInt32Value(ss, message) result = ss.data -proc newgoogle_protobuf_FloatValue*(data: string): google_protobuf_FloatValue = +proc newgoogle_protobuf_UInt32Value*(data: string): google_protobuf_UInt32Value = let ss = newStringStream(data) - result = readgoogle_protobuf_FloatValue(ss) + result = readgoogle_protobuf_UInt32Value(ss) -proc newgoogle_protobuf_FloatValue*(data: seq[byte]): google_protobuf_FloatValue = +proc newgoogle_protobuf_UInt32Value*(data: seq[byte]): google_protobuf_UInt32Value = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_FloatValue(ss) + result = readgoogle_protobuf_UInt32Value(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_UInt64Value]): string = "google.protobuf.UInt64Value" +proc fullyQualifiedName*(T: typedesc[google_protobuf_StringValue]): string = "google.protobuf.StringValue" -proc readgoogle_protobuf_UInt64ValueImpl(stream: Stream): Message = readgoogle_protobuf_UInt64Value(stream) -proc writegoogle_protobuf_UInt64ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UInt64Value(stream, google_protobuf_UInt64Value(msg)) +proc readgoogle_protobuf_StringValueImpl(stream: Stream): Message = readgoogle_protobuf_StringValue(stream) +proc writegoogle_protobuf_StringValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_StringValue(stream, google_protobuf_StringValue(msg)) -proc google_protobuf_UInt64ValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_UInt64ValueImpl - result.writeImpl = writegoogle_protobuf_UInt64ValueImpl +proc google_protobuf_StringValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_StringValueImpl + result.writeImpl = writegoogle_protobuf_StringValueImpl -proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value = +proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue = new(result) initMessage(result[]) - result.procs = google_protobuf_UInt64ValueProcs() - result.value = 0 + result.procs = google_protobuf_StringValueProcs() + result.value = "" -proc clearvalue*(message: google_protobuf_UInt64Value) = - message.value = 0 +proc clearvalue*(message: google_protobuf_StringValue) = + message.value = "" -proc setvalue*(message: google_protobuf_UInt64Value, value: uint64) = +proc setvalue*(message: google_protobuf_StringValue, value: string) = message.value = value -proc value*(message: google_protobuf_UInt64Value): uint64 {.inline.} = +proc value*(message: google_protobuf_StringValue): string {.inline.} = message.value -proc `value=`*(message: google_protobuf_UInt64Value, value: uint64) {.inline.} = +proc `value=`*(message: google_protobuf_StringValue, value: string) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64 = - if message.value != 0: - result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfUInt64(message.value) +proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64 = + if len(message.value) > 0: + result = result + sizeOfTag(1, WireType.LengthDelimited) + result = result + sizeOfString(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_UInt64Value*(stream: Stream, message: google_protobuf_UInt64Value) = - if message.value != 0: - protoWriteUInt64(stream, message.value, 1) +proc writegoogle_protobuf_StringValue*(stream: Stream, message: google_protobuf_StringValue) = + if len(message.value) > 0: + protoWriteString(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_UInt64Value*(stream: Stream): google_protobuf_UInt64Value = - result = newgoogle_protobuf_UInt64Value() +proc readgoogle_protobuf_StringValue*(stream: Stream): google_protobuf_StringValue = + result = newgoogle_protobuf_StringValue() while not atEnd(stream): let tag = readTag(stream) @@ -631,67 +631,67 @@ proc readgoogle_protobuf_UInt64Value*(stream: Stream): google_protobuf_UInt64Val of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.Varint) - setvalue(result, protoReadUInt64(stream)) + expectWireType(wireType, WireType.LengthDelimited) + setvalue(result, protoReadString(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_UInt64Value): string = +proc serialize*(message: google_protobuf_StringValue): string = let ss = newStringStream() - writegoogle_protobuf_UInt64Value(ss, message) + writegoogle_protobuf_StringValue(ss, message) result = ss.data -proc newgoogle_protobuf_UInt64Value*(data: string): google_protobuf_UInt64Value = +proc newgoogle_protobuf_StringValue*(data: string): google_protobuf_StringValue = let ss = newStringStream(data) - result = readgoogle_protobuf_UInt64Value(ss) + result = readgoogle_protobuf_StringValue(ss) -proc newgoogle_protobuf_UInt64Value*(data: seq[byte]): google_protobuf_UInt64Value = +proc newgoogle_protobuf_StringValue*(data: seq[byte]): google_protobuf_StringValue = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_UInt64Value(ss) + result = readgoogle_protobuf_StringValue(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_UInt32Value]): string = "google.protobuf.UInt32Value" +proc fullyQualifiedName*(T: typedesc[google_protobuf_Int32Value]): string = "google.protobuf.Int32Value" -proc readgoogle_protobuf_UInt32ValueImpl(stream: Stream): Message = readgoogle_protobuf_UInt32Value(stream) -proc writegoogle_protobuf_UInt32ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_UInt32Value(stream, google_protobuf_UInt32Value(msg)) +proc readgoogle_protobuf_Int32ValueImpl(stream: Stream): Message = readgoogle_protobuf_Int32Value(stream) +proc writegoogle_protobuf_Int32ValueImpl(stream: Stream, msg: Message) = writegoogle_protobuf_Int32Value(stream, google_protobuf_Int32Value(msg)) -proc google_protobuf_UInt32ValueProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_UInt32ValueImpl - result.writeImpl = writegoogle_protobuf_UInt32ValueImpl +proc google_protobuf_Int32ValueProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_Int32ValueImpl + result.writeImpl = writegoogle_protobuf_Int32ValueImpl -proc newgoogle_protobuf_UInt32Value*(): google_protobuf_UInt32Value = +proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value = new(result) initMessage(result[]) - result.procs = google_protobuf_UInt32ValueProcs() + result.procs = google_protobuf_Int32ValueProcs() result.value = 0 -proc clearvalue*(message: google_protobuf_UInt32Value) = +proc clearvalue*(message: google_protobuf_Int32Value) = message.value = 0 -proc setvalue*(message: google_protobuf_UInt32Value, value: uint32) = +proc setvalue*(message: google_protobuf_Int32Value, value: int32) = message.value = value -proc value*(message: google_protobuf_UInt32Value): uint32 {.inline.} = +proc value*(message: google_protobuf_Int32Value): int32 {.inline.} = message.value -proc `value=`*(message: google_protobuf_UInt32Value, value: uint32) {.inline.} = +proc `value=`*(message: google_protobuf_Int32Value, value: int32) {.inline.} = setvalue(message, value) -proc sizeOfgoogle_protobuf_UInt32Value*(message: google_protobuf_UInt32Value): uint64 = +proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64 = if message.value != 0: result = result + sizeOfTag(1, WireType.Varint) - result = result + sizeOfUInt32(message.value) + result = result + sizeOfInt32(message.value) result = result + sizeOfUnknownFields(message) -proc writegoogle_protobuf_UInt32Value*(stream: Stream, message: google_protobuf_UInt32Value) = +proc writegoogle_protobuf_Int32Value*(stream: Stream, message: google_protobuf_Int32Value) = if message.value != 0: - protoWriteUInt32(stream, message.value, 1) + protoWriteInt32(stream, message.value, 1) writeUnknownFields(stream, message) -proc readgoogle_protobuf_UInt32Value*(stream: Stream): google_protobuf_UInt32Value = - result = newgoogle_protobuf_UInt32Value() +proc readgoogle_protobuf_Int32Value*(stream: Stream): google_protobuf_Int32Value = + result = newgoogle_protobuf_Int32Value() while not atEnd(stream): let tag = readTag(stream) @@ -701,23 +701,23 @@ proc readgoogle_protobuf_UInt32Value*(stream: Stream): google_protobuf_UInt32Val raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: expectWireType(wireType, WireType.Varint) - setvalue(result, protoReadUInt32(stream)) + setvalue(result, protoReadInt32(stream)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_UInt32Value): string = +proc serialize*(message: google_protobuf_Int32Value): string = let ss = newStringStream() - writegoogle_protobuf_UInt32Value(ss, message) + writegoogle_protobuf_Int32Value(ss, message) result = ss.data -proc newgoogle_protobuf_UInt32Value*(data: string): google_protobuf_UInt32Value = +proc newgoogle_protobuf_Int32Value*(data: string): google_protobuf_Int32Value = let ss = newStringStream(data) - result = readgoogle_protobuf_UInt32Value(ss) + result = readgoogle_protobuf_Int32Value(ss) -proc newgoogle_protobuf_UInt32Value*(data: seq[byte]): google_protobuf_UInt32Value = +proc newgoogle_protobuf_Int32Value*(data: seq[byte]): google_protobuf_Int32Value = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_UInt32Value(ss) + result = readgoogle_protobuf_Int32Value(ss) diff --git a/tests/conformance/failures.txt b/tests/conformance/failures.txt index 5e8f520..d82560e 100644 --- a/tests/conformance/failures.txt +++ b/tests/conformance/failures.txt @@ -1,18 +1,54 @@ +[libprotobuf ERROR google/protobuf/wire_format_lite.cc:629] String field 'conformance.ConformanceResponse.json_payload' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. CONFORMANCE TEST BEGIN ==================================== ERROR, test=Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.DOUBLE.JsonOutput: Output was not equivalent to reference message: modified: optional_double: 2.2250738585072014e-308 -> 2.2250738585072009e-308 . request=protobuf_payload: "a\232\231\231\231\231\231\271?a\377\377\377\377\377\377\357\177a\000\000\000\000\000\000\020\000" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalDouble\":2.225073858507201e-308}" ERROR, test=Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.JsonOutput: JSON output we received from test was unparseable. request=protobuf_payload: "\321\002\232\231\231\231\231\231\271?\321\002\377\377\377\377\377\377\357\177\321\002\000\000\000\000\000\000\020\000" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"repeatedDouble\":[0.1,1.797693134862316e+308,2.225073858507201e-308]}" -WARNING, test=Recommended.FieldMaskPathsDontRoundTrip.JsonOutput: Should have failed to serialize, but didn't. request=protobuf_payload: "\372\022\010\n\006fooBar" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalFieldMask\":\"fooBar\"}" -WARNING, test=Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput: Should have failed to serialize, but didn't. request=protobuf_payload: "\372\022\013\n\tfoo_3_bar" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalFieldMask\":\"foo_3_bar\"}" -WARNING, test=Recommended.FieldMaskTooManyUnderscore.JsonOutput: Should have failed to serialize, but didn't. request=protobuf_payload: "\372\022\n\n\010foo__bar" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalFieldMask\":\"foo__bar\"}" +WARNING, test=Recommended.Proto3.JsonInput.TrailingCommaInAnObject: Should have failed to parse, but didn't. request=json_payload: "{\"fieldname1\":1,}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"fieldname1\":1}" +WARNING, test=Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpace: Should have failed to parse, but didn't. request=json_payload: "{\"fieldname1\":1 ,}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"fieldname1\":1}" +WARNING, test=Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpaceCommaSpace: Should have failed to parse, but didn't. request=json_payload: "{\"fieldname1\":1 , }" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"fieldname1\":1}" +WARNING, test=Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithNewlines: Should have failed to parse, but didn't. request=json_payload: "{\n \"fieldname1\":1,\n }" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"fieldname1\":1}" +WARNING, test=Recommended.Proto3.JsonInput.JsonWithComments: Should have failed to parse, but didn't. request=json_payload: "{\n // This is a comment.\n \"fieldname1\": 1\n }" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"fieldname1\":1}" +ERROR, test=Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput: Failed to parse input or produce output. request=json_payload: "{\"optionalUint64\": 18446744073709549568}" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=parse_error: "JsonParsingError: Parsed integer outside of valid range\n/home/oswjk/dev/nimpb/tests/conformance/conformance_nim.nim(64) conformance_nim\n" +ERROR, test=Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput: Failed to parse input or produce output. request=json_payload: "{\"optionalUint64\": 18446744073709549568}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=parse_error: "JsonParsingError: Parsed integer outside of valid range\n/home/oswjk/dev/nimpb/tests/conformance/conformance_nim.nim(64) conformance_nim\n" +ERROR, test=Required.Proto3.JsonInput.Int32FieldLeadingZero: Should have failed to parse, but didn't. request=json_payload: "{\"optionalInt32\": 01}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalInt32\":1}" +ERROR, test=Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero: Should have failed to parse, but didn't. request=json_payload: "{\"optionalInt32\": -01}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalInt32\":-1}" +WARNING, test=Recommended.Proto3.JsonInput.StringFieldUppercaseEscapeLetter: Should have failed to parse, but didn't. request=json_payload: "{\"optionalString\": \"\\U8C37\\U6b4C\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalString\":\"\\\\U8C37\\\\U6b4C\"}" +WARNING, test=Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate: Should have failed to parse, but didn't. request=json_payload: "{\"optionalString\": \"\\uDC00\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=runtime_error: "response proto could not be parsed." +WARNING, test=Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput: Failed to parse input or produce output. request=json_payload: "{\"optionalBytes\": \"-_\"}" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=runtime_error: "AssertionError: /home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/pure/base64.nim(186, 10) `i == s.len` \n/home/oswjk/dev/nimpb/tests/conformance/conformance_nim.nim(66) conformance_nim\n/home/oswjk/dev/nimpb/tests/conformance/test_messages_proto3_pb.nim(4810) parseprotobuf_test_messages_proto3_TestAllTypesProto3\n/home/oswjk/dev/nimpb/nimpb/json.nim(132) parseBytes\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/pure/base64.nim(186) decode\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/assertions.nim(27) failedAssertImpl\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/assertions.nim(20) raiseAssert\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/fatal.nim(39) sysFatal\n" +WARNING, test=Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput: Failed to parse input or produce output. request=json_payload: "{\"optionalBytes\": \"-_\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=runtime_error: "AssertionError: /home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/pure/base64.nim(186, 10) `i == s.len` \n/home/oswjk/dev/nimpb/tests/conformance/conformance_nim.nim(66) conformance_nim\n/home/oswjk/dev/nimpb/tests/conformance/test_messages_proto3_pb.nim(4810) parseprotobuf_test_messages_proto3_TestAllTypesProto3\n/home/oswjk/dev/nimpb/nimpb/json.nim(132) parseBytes\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/pure/base64.nim(186) decode\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/assertions.nim(27) failedAssertImpl\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/assertions.nim(20) raiseAssert\n/home/oswjk/.choosenim/toolchains/nim-1.0.0/lib/system/fatal.nim(39) sysFatal\n" +WARNING, test=Recommended.Proto3.JsonInput.RepeatedFieldTrailingComma: Should have failed to parse, but didn't. request=json_payload: "{\"repeatedInt32\": [1, 2, 3, 4,]}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"repeatedInt32\":[1,2,3,4]}" +WARNING, test=Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithSpace: Should have failed to parse, but didn't. request=json_payload: "{\"repeatedInt32\": [1, 2, 3, 4 ,]}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"repeatedInt32\":[1,2,3,4]}" +WARNING, test=Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithSpaceCommaSpace: Should have failed to parse, but didn't. request=json_payload: "{\"repeatedInt32\": [1, 2, 3, 4 , ]}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"repeatedInt32\":[1,2,3,4]}" +WARNING, test=Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithNewlines: Should have failed to parse, but didn't. request=json_payload: "{\"repeatedInt32\": [\n 1,\n 2,\n 3,\n 4,\n]}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"repeatedInt32\":[1,2,3,4]}" +WARNING, test=Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator: Expected JSON payload but got type 6. request=json_payload: "{\"optionalDuration\": \"1.000000000s\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=serialize_error: "ValueError: different sign for seconds and nanos\n/home/oswjk/dev/nimpb/tests/conformance/conformance_nim.nim(72) conformance_nim\n/home/oswjk/dev/nimpb/tests/conformance/test_messages_proto3_pb.nim(4683) toJson\n/home/oswjk/dev/nimpb/nimpb/wkt/duration.nim(19) toJson\n" +WARNING, test=Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalDuration\": \"1.010000000s\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalDuration\":\"1.01s\"}" +WARNING, test=Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalDuration\": \"1.000010000s\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalDuration\":\"1.00001s\"}" +WARNING, test=Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalDuration\": \"1.000000010s\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalDuration\":\"1.00000001s\"}" +WARNING, test=Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalTimestamp\": \"1970-01-01T00:00:00.010000000Z\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalTimestamp\":\"1970-01-01T00:00:00.01Z\"}" +WARNING, test=Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalTimestamp\": \"1970-01-01T00:00:00.000010000Z\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalTimestamp\":\"1970-01-01T00:00:00.00001Z\"}" +WARNING, test=Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator: JSON payload validation failed. request=json_payload: "{\"optionalTimestamp\": \"1970-01-01T00:00:00.000000010Z\"}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{\"optionalTimestamp\":\"1970-01-01T00:00:00.00000001Z\"}" +ERROR, test=Required.Proto3.JsonInput.Struct.ProtobufOutput: Output was not equivalent to reference message: added: 2[0]: "\021\000\000\000\000\000H\223@" +deleted: optional_struct.fields.value.number_value: 1234 +. request=json_payload: "{\n \"optionalStruct\": {\n \"nullValue\": null,\n \"intValue\": 1234,\n \"boolValue\": true,\n \"doubleValue\": 1234.5678,\n \"stringValue\": \"Hello world!\",\n \"listValue\": [1234, \"5678\"],\n \"objectValue\": {\n \"value\": 0\n }\n }\n }" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=protobuf_payload: "\202\023\262\001\n\"\n\tlistValue\022\0252\023\n\t\021\000\000\000\000\000H\223@\n\006\032\0045678\n\035\n\013stringValue\022\016\032\014Hello world!\n\017\n\tboolValue\022\002 \001\n%\n\013objectValue\022\026*\024\n\022\n\005value\022\t\021\000\000\000\000\000\000\000\000\n\017\n\tnullValue\022\002\010\000\n\030\n\013doubleValue\022\t\021\255\372\\mEJ\223@\n\025\n\010intValue\022\t\021\000\000\000\000\000H\223@" +ERROR, test=Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput: Output was not equivalent to reference message: deleted: optional_value: { null_value: NULL_VALUE } +. request=json_payload: "{\"optionalValue\": null}" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=protobuf_payload: "" +ERROR, test=Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput: Output was not equivalent to reference message: deleted: optional_value: { null_value: NULL_VALUE } +. request=json_payload: "{\"optionalValue\": null}" requested_output_format: JSON message_type: "protobuf_test_messages.proto3.TestAllTypesProto3", response=json_payload: "{}" These tests failed. If they can't be fixed right now, you can add them to the failure list so the overall suite can succeed. Add them to the failure list by running: ./update_failure_list.py --add failing_tests.txt + Required.Proto3.JsonInput.Int32FieldLeadingZero + Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero + Required.Proto3.JsonInput.Struct.ProtobufOutput + Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput + Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput + Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput + Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.DOUBLE.JsonOutput Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.JsonOutput -CONFORMANCE SUITE FAILED: 249 successes, 563 skipped, 0 expected failures, 2 unexpected failures. +CONFORMANCE SUITE FAILED: 594 successes, 194 skipped, 0 expected failures, 9 unexpected failures. -- cgit v1.2.3