diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2019-09-24 23:43:09 +0300 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2019-09-24 23:43:09 +0300 |
| commit | fd813d1128611c8f3bdcfe36d63e78acce51a48a (patch) | |
| tree | d0263c1b52d8dcde01d286b5f7b6b8bf617d7125 | |
| parent | 9df08c3c052ff4a2ee880496527864be6b9e8f1a (diff) | |
| download | nimpb-fd813d1128611c8f3bdcfe36d63e78acce51a48a.tar.gz nimpb-fd813d1128611c8f3bdcfe36d63e78acce51a48a.zip | |
Fixes for Nim 1.0
| -rw-r--r-- | nimpb/compiler/generator.nim | 8 | ||||
| -rw-r--r-- | nimpb/nimpb.nim | 20 | ||||
| -rw-r--r-- | nimpb/wkt/descriptor_pb.nim | 3486 | ||||
| -rw-r--r-- | nimpb/wkt/struct_pb.nim | 122 | ||||
| -rw-r--r-- | nimpb/wkt/wrappers_pb.nim | 470 | ||||
| -rw-r--r-- | tests/conformance/failures.txt | 44 |
6 files changed, 2091 insertions, 2059 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,6 +514,175 @@ proc newgoogle_protobuf_UninterpretedOption_NamePart*(data: seq[byte]): google_p result = readgoogle_protobuf_UninterpretedOption_NamePart(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_UninterpretedOption]): string = "google.protobuf.UninterpretedOption" proc readgoogle_protobuf_UninterpretedOptionImpl(stream: Stream): Message = readgoogle_protobuf_UninterpretedOption(stream) @@ -979,426 +1148,6 @@ 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 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 google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl - result.writeImpl = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl - -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 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 - -proc `start=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = - setstart(message, value) - -proc clearfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = - message.fend = 0 - clearFields(message, [2]) - -proc hasfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = - result = hasField(message, 2) - -proc setfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = - message.fend = value - setField(message, 2) - -proc fend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = - message.fend - -proc `fend=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = - setfend(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) - 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) - writeUnknownFields(stream, message) - -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 serialize*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): string = - let - ss = newStringStream() - writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss, message) - result = ss.data - -proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange = - let - ss = newStringStream(data) - result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) - -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 fullyQualifiedName*(T: typedesc[google_protobuf_EnumOptions]): string = "google.protobuf.EnumOptions" - -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_EnumOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumOptionsImpl - result.writeImpl = writegoogle_protobuf_EnumOptionsImpl - -proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions = - new(result) - initMessage(result[]) - result.procs = google_protobuf_EnumOptionsProcs() - result.allowAlias = false - result.deprecated = false - result.uninterpretedOption = @[] - -proc clearallowAlias*(message: google_protobuf_EnumOptions) = - message.allowAlias = false - clearFields(message, [2]) - -proc hasallowAlias*(message: google_protobuf_EnumOptions): bool = - result = hasField(message, 2) - -proc setallowAlias*(message: google_protobuf_EnumOptions, value: bool) = - message.allowAlias = value - setField(message, 2) - -proc allowAlias*(message: google_protobuf_EnumOptions): bool {.inline.} = - message.allowAlias - -proc `allowAlias=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = - setallowAlias(message, value) - -proc cleardeprecated*(message: google_protobuf_EnumOptions) = - message.deprecated = false - clearFields(message, [3]) - -proc hasdeprecated*(message: google_protobuf_EnumOptions): bool = - result = hasField(message, 3) - -proc setdeprecated*(message: google_protobuf_EnumOptions, value: bool) = - message.deprecated = 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 `uninterpretedOption=`*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) - -proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 = - if hasallowAlias(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 + 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) - writeUnknownFields(stream, message) - -proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions = - result = newgoogle_protobuf_EnumOptions() - while not atEnd(stream): - let - tag = readTag(stream) - wireType = wireType(tag) - case fieldNumber(tag) - of 0: - raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 2: - expectWireType(wireType, WireType.Varint) - setallowAlias(result, protoReadBool(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)) - else: readUnknownField(stream, result, tag) - -proc serialize*(message: google_protobuf_EnumOptions): string = - let - ss = newStringStream() - writegoogle_protobuf_EnumOptions(ss, message) - result = ss.data - -proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions = - let - ss = newStringStream(data) - result = readgoogle_protobuf_EnumOptions(ss) - -proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_EnumOptions(ss) - - -proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto]): string = "google.protobuf.EnumDescriptorProto" - -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 google_protobuf_EnumDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_EnumDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_EnumDescriptorProtoImpl - -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, [3]) - -proc hasoptions*(message: google_protobuf_EnumDescriptorProto): bool = - result = hasField(message, 3) - -proc setoptions*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) = - message.options = value - setField(message, 3) - -proc options*(message: google_protobuf_EnumDescriptorProto): google_protobuf_EnumOptions {.inline.} = - message.options - -proc `options=`*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) {.inline.} = - setoptions(message, value) - -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 setreservedName*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) = - message.reservedName = 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 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 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 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 serialize*(message: google_protobuf_EnumDescriptorProto): string = - let - ss = newStringStream() - writegoogle_protobuf_EnumDescriptorProto(ss, message) - result = ss.data - -proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto = - let - ss = newStringStream(data) - result = readgoogle_protobuf_EnumDescriptorProto(ss) - -proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_EnumDescriptorProto(ss) - - proc fullyQualifiedName*(T: typedesc[google_protobuf_ExtensionRangeOptions]): string = "google.protobuf.ExtensionRangeOptions" proc readgoogle_protobuf_ExtensionRangeOptionsImpl(stream: Stream): Message = readgoogle_protobuf_ExtensionRangeOptions(stream) @@ -1477,158 +1226,97 @@ proc newgoogle_protobuf_ExtensionRangeOptions*(data: seq[byte]): google_protobuf result = readgoogle_protobuf_ExtensionRangeOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo_Location]): string = "google.protobuf.SourceCodeInfo.Location" +proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ExtensionRange]): string = "google.protobuf.DescriptorProto.ExtensionRange" -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_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_SourceCodeInfo_LocationProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_SourceCodeInfo_LocationImpl - result.writeImpl = writegoogle_protobuf_SourceCodeInfo_LocationImpl +proc google_protobuf_DescriptorProto_ExtensionRangeProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl + result.writeImpl = writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl -proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange = new(result) initMessage(result[]) - result.procs = google_protobuf_SourceCodeInfo_LocationProcs() - result.path = @[] - result.span = @[] - result.leadingComments = "" - result.trailingComments = "" - result.leadingDetachedComments = @[] + result.procs = google_protobuf_DescriptorProto_ExtensionRangeProcs() + result.start = 0 + result.fend = 0 + result.options = nil -proc clearpath*(message: google_protobuf_SourceCodeInfo_Location) = - message.path = @[] +proc clearstart*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.start = 0 clearFields(message, [1]) -proc haspath*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 1) or (len(message.path) > 0) +proc hasstart*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = + result = hasField(message, 1) -proc setpath*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = - message.path = value +proc setstart*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = + message.start = 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 start*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = + message.start -proc `path=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = - setpath(message, value) +proc `start=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = + setstart(message, value) -proc clearspan*(message: google_protobuf_SourceCodeInfo_Location) = - message.span = @[] +proc clearfend*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.fend = 0 clearFields(message, [2]) -proc hasspan*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 2) or (len(message.span) > 0) +proc hasfend*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = + result = hasField(message, 2) -proc setspan*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = - message.span = value +proc setfend*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = + message.fend = value setField(message, 2) -proc addspan*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = - add(message.span, value) - -proc span*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = - message.span +proc fend*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = + message.fend -proc `span=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) {.inline.} = - setspan(message, value) +proc `fend=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = + setfend(message, value) -proc clearleadingComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.leadingComments = "" +proc clearoptions*(message: google_protobuf_DescriptorProto_ExtensionRange) = + message.options = nil clearFields(message, [3]) -proc hasleadingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = +proc hasoptions*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = result = hasField(message, 3) -proc setleadingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - message.leadingComments = value +proc setoptions*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) = + message.options = value setField(message, 3) -proc leadingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = - message.leadingComments - -proc `leadingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = - setleadingComments(message, value) - -proc cleartrailingComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.trailingComments = "" - clearFields(message, [4]) - -proc hastrailingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 4) - -proc settrailingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - message.trailingComments = value - setField(message, 4) - -proc trailingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = - message.trailingComments - -proc `trailingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = - settrailingComments(message, value) - -proc clearleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location) = - message.leadingDetachedComments = @[] - clearFields(message, [6]) - -proc hasleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): bool = - result = hasField(message, 6) or (len(message.leadingDetachedComments) > 0) - -proc setleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) = - message.leadingDetachedComments = value - setField(message, 6) - -proc addleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = - add(message.leadingDetachedComments, value) - -proc leadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): seq[string] {.inline.} = - message.leadingDetachedComments +proc options*(message: google_protobuf_DescriptorProto_ExtensionRange): google_protobuf_ExtensionRangeOptions {.inline.} = + message.options -proc `leadingDetachedComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) {.inline.} = - setleadingDetachedComments(message, value) +proc `options=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) {.inline.} = + setoptions(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 + 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): +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) + if hasoptions(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 + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ExtensionRangeOptions(message.options)) result = result + sizeOfUnknownFields(message) -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) +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_SourceCodeInfo_Location*(stream: Stream): google_protobuf_SourceCodeInfo_Location = - result = newgoogle_protobuf_SourceCodeInfo_Location() +proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange = + result = newgoogle_protobuf_DescriptorProto_ExtensionRange() while not atEnd(stream): let tag = readTag(stream) @@ -1637,137 +1325,32 @@ proc readgoogle_protobuf_SourceCodeInfo_Location*(stream: Stream): google_protob 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)) + expectWireType(wireType, WireType.Varint) + setstart(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)) + expectWireType(wireType, WireType.Varint) + setfend(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 serialize*(message: google_protobuf_SourceCodeInfo_Location): string = - let - ss = newStringStream() - writegoogle_protobuf_SourceCodeInfo_Location(ss, message) - result = ss.data - -proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location = - let - ss = newStringStream(data) - result = readgoogle_protobuf_SourceCodeInfo_Location(ss) - -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 fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo]): string = "google.protobuf.SourceCodeInfo" - -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_SourceCodeInfoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_SourceCodeInfoImpl - result.writeImpl = writegoogle_protobuf_SourceCodeInfoImpl - -proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo = - new(result) - initMessage(result[]) - result.procs = google_protobuf_SourceCodeInfoProcs() - result.location = @[] - -proc clearlocation*(message: google_protobuf_SourceCodeInfo) = - message.location = @[] - clearFields(message, [1]) - -proc haslocation*(message: google_protobuf_SourceCodeInfo): bool = - result = hasField(message, 1) or (len(message.location) > 0) - -proc setlocation*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) = - message.location = value - setField(message, 1) - -proc addlocation*(message: google_protobuf_SourceCodeInfo, value: google_protobuf_SourceCodeInfo_Location) = - add(message.location, value) - -proc location*(message: google_protobuf_SourceCodeInfo): seq[google_protobuf_SourceCodeInfo_Location] {.inline.} = - message.location - -proc `location=`*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) {.inline.} = - setlocation(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 writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) = - for value in message.location: - writeMessage(stream, value, 1) - writeUnknownFields(stream, message) - -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)) + setoptions(result, newgoogle_protobuf_ExtensionRangeOptions(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_SourceCodeInfo): string = +proc serialize*(message: google_protobuf_DescriptorProto_ExtensionRange): string = let ss = newStringStream() - writegoogle_protobuf_SourceCodeInfo(ss, message) + writegoogle_protobuf_DescriptorProto_ExtensionRange(ss, message) result = ss.data -proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange = let ss = newStringStream(data) - result = readgoogle_protobuf_SourceCodeInfo(ss) + result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) -proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo = +proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_SourceCodeInfo(ss) + result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_FieldOptions]): string = "google.protobuf.FieldOptions" @@ -2313,97 +1896,100 @@ proc newgoogle_protobuf_FieldDescriptorProto*(data: seq[byte]): google_protobuf_ result = readgoogle_protobuf_FieldDescriptorProto(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ExtensionRange]): string = "google.protobuf.DescriptorProto.ExtensionRange" +proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodOptions]): string = "google.protobuf.MethodOptions" -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_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_DescriptorProto_ExtensionRangeProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_DescriptorProto_ExtensionRangeImpl - result.writeImpl = writegoogle_protobuf_DescriptorProto_ExtensionRangeImpl +proc google_protobuf_MethodOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MethodOptionsImpl + result.writeImpl = writegoogle_protobuf_MethodOptionsImpl -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions = new(result) initMessage(result[]) - result.procs = google_protobuf_DescriptorProto_ExtensionRangeProcs() - result.start = 0 - result.fend = 0 - result.options = nil + result.procs = google_protobuf_MethodOptionsProcs() + result.deprecated = false + result.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN + result.uninterpretedOption = @[] -proc clearstart*(message: google_protobuf_DescriptorProto_ExtensionRange) = - message.start = 0 - clearFields(message, [1]) +proc cleardeprecated*(message: google_protobuf_MethodOptions) = + message.deprecated = false + clearFields(message, [33]) -proc hasstart*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 1) +proc hasdeprecated*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 33) -proc setstart*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = - message.start = value - setField(message, 1) +proc setdeprecated*(message: google_protobuf_MethodOptions, value: bool) = + message.deprecated = value + setField(message, 33) -proc start*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = - message.start +proc deprecated*(message: google_protobuf_MethodOptions): bool {.inline.} = + message.deprecated -proc `start=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = - setstart(message, value) +proc `deprecated=`*(message: google_protobuf_MethodOptions, value: bool) {.inline.} = + setdeprecated(message, value) -proc clearfend*(message: google_protobuf_DescriptorProto_ExtensionRange) = - message.fend = 0 - clearFields(message, [2]) +proc clearidempotencyLevel*(message: google_protobuf_MethodOptions) = + message.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN + clearFields(message, [34]) -proc hasfend*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 2) +proc hasidempotencyLevel*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 34) -proc setfend*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) = - message.fend = value - setField(message, 2) +proc setidempotencyLevel*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) = + message.idempotencyLevel = value + setField(message, 34) -proc fend*(message: google_protobuf_DescriptorProto_ExtensionRange): int32 {.inline.} = - message.fend +proc idempotencyLevel*(message: google_protobuf_MethodOptions): google_protobuf_MethodOptions_IdempotencyLevel {.inline.} = + message.idempotencyLevel -proc `fend=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: int32) {.inline.} = - setfend(message, value) +proc `idempotencyLevel=`*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) {.inline.} = + setidempotencyLevel(message, value) -proc clearoptions*(message: google_protobuf_DescriptorProto_ExtensionRange) = - message.options = nil - clearFields(message, [3]) +proc clearuninterpretedOption*(message: google_protobuf_MethodOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) -proc hasoptions*(message: google_protobuf_DescriptorProto_ExtensionRange): bool = - result = hasField(message, 3) +proc hasuninterpretedOption*(message: google_protobuf_MethodOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) -proc setoptions*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) = - message.options = value - setField(message, 3) +proc setuninterpretedOption*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) -proc options*(message: google_protobuf_DescriptorProto_ExtensionRange): google_protobuf_ExtensionRangeOptions {.inline.} = - message.options +proc adduninterpretedOption*(message: google_protobuf_MethodOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) -proc `options=`*(message: google_protobuf_DescriptorProto_ExtensionRange, value: google_protobuf_ExtensionRangeOptions) {.inline.} = - setoptions(message, value) +proc uninterpretedOption*(message: google_protobuf_MethodOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption -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) - if hasoptions(message): - result = result + sizeOfTag(3, WireType.LengthDelimited) - result = result + sizeOfLengthDelimited(sizeOfgoogle_protobuf_ExtensionRangeOptions(message.options)) +proc `uninterpretedOption=`*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) + +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 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) +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 readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google_protobuf_DescriptorProto_ExtensionRange = - result = newgoogle_protobuf_DescriptorProto_ExtensionRange() +proc readgoogle_protobuf_MethodOptions*(stream: Stream): google_protobuf_MethodOptions = + result = newgoogle_protobuf_MethodOptions() while not atEnd(stream): let tag = readTag(stream) @@ -2411,175 +1997,195 @@ proc readgoogle_protobuf_DescriptorProto_ExtensionRange*(stream: Stream): google case fieldNumber(tag) of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") - of 1: + of 33: expectWireType(wireType, WireType.Varint) - setstart(result, protoReadInt32(stream)) - of 2: + setdeprecated(result, protoReadBool(stream)) + of 34: expectWireType(wireType, WireType.Varint) - setfend(result, protoReadInt32(stream)) - of 3: + setidempotencyLevel(result, protoReadEnum[google_protobuf_MethodOptions_IdempotencyLevel](stream)) + of 999: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - setoptions(result, newgoogle_protobuf_ExtensionRangeOptions(data)) + adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) else: readUnknownField(stream, result, tag) -proc serialize*(message: google_protobuf_DescriptorProto_ExtensionRange): string = +proc serialize*(message: google_protobuf_MethodOptions): string = let ss = newStringStream() - writegoogle_protobuf_DescriptorProto_ExtensionRange(ss, message) + writegoogle_protobuf_MethodOptions(ss, message) result = ss.data -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: string): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions = let ss = newStringStream(data) - result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) + result = readgoogle_protobuf_MethodOptions(ss) -proc newgoogle_protobuf_DescriptorProto_ExtensionRange*(data: seq[byte]): google_protobuf_DescriptorProto_ExtensionRange = +proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_DescriptorProto_ExtensionRange(ss) + result = readgoogle_protobuf_MethodOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_MessageOptions]): string = "google.protobuf.MessageOptions" +proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodDescriptorProto]): string = "google.protobuf.MethodDescriptorProto" -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_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_MessageOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MessageOptionsImpl - result.writeImpl = writegoogle_protobuf_MessageOptionsImpl +proc google_protobuf_MethodDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MethodDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_MethodDescriptorProtoImpl -proc newgoogle_protobuf_MessageOptions*(): google_protobuf_MessageOptions = +proc newgoogle_protobuf_MethodDescriptorProto*(): google_protobuf_MethodDescriptorProto = new(result) initMessage(result[]) - result.procs = google_protobuf_MessageOptionsProcs() - result.messageSetWireFormat = false - result.noStandardDescriptorAccessor = false - result.deprecated = false - result.mapEntry = false - result.uninterpretedOption = @[] + result.procs = google_protobuf_MethodDescriptorProtoProcs() + result.name = "" + result.inputType = "" + result.outputType = "" + result.options = nil + result.clientStreaming = false + result.serverStreaming = false -proc clearmessageSetWireFormat*(message: google_protobuf_MessageOptions) = - message.messageSetWireFormat = false +proc clearname*(message: google_protobuf_MethodDescriptorProto) = + message.name = "" clearFields(message, [1]) -proc hasmessageSetWireFormat*(message: google_protobuf_MessageOptions): bool = +proc hasname*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 1) -proc setmessageSetWireFormat*(message: google_protobuf_MessageOptions, value: bool) = - message.messageSetWireFormat = value +proc setname*(message: google_protobuf_MethodDescriptorProto, value: string) = + message.name = value setField(message, 1) -proc messageSetWireFormat*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.messageSetWireFormat +proc name*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = + message.name -proc `messageSetWireFormat=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setmessageSetWireFormat(message, value) +proc `name=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = + setname(message, value) -proc clearnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions) = - message.noStandardDescriptorAccessor = false +proc clearinputType*(message: google_protobuf_MethodDescriptorProto) = + message.inputType = "" clearFields(message, [2]) -proc hasnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool = +proc hasinputType*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 2) -proc setnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions, value: bool) = - message.noStandardDescriptorAccessor = value +proc setinputType*(message: google_protobuf_MethodDescriptorProto, value: string) = + message.inputType = value setField(message, 2) -proc noStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.noStandardDescriptorAccessor +proc inputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = + message.inputType -proc `noStandardDescriptorAccessor=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setnoStandardDescriptorAccessor(message, value) +proc `inputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = + setinputType(message, value) -proc cleardeprecated*(message: google_protobuf_MessageOptions) = - message.deprecated = false +proc clearoutputType*(message: google_protobuf_MethodDescriptorProto) = + message.outputType = "" clearFields(message, [3]) -proc hasdeprecated*(message: google_protobuf_MessageOptions): bool = +proc hasoutputType*(message: google_protobuf_MethodDescriptorProto): bool = result = hasField(message, 3) -proc setdeprecated*(message: google_protobuf_MessageOptions, value: bool) = - message.deprecated = value +proc setoutputType*(message: google_protobuf_MethodDescriptorProto, value: string) = + message.outputType = value setField(message, 3) -proc deprecated*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.deprecated +proc outputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = + message.outputType -proc `deprecated=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setdeprecated(message, value) +proc `outputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = + setoutputType(message, value) -proc clearmapEntry*(message: google_protobuf_MessageOptions) = - message.mapEntry = false - clearFields(message, [7]) +proc clearoptions*(message: google_protobuf_MethodDescriptorProto) = + message.options = nil + clearFields(message, [4]) -proc hasmapEntry*(message: google_protobuf_MessageOptions): bool = - result = hasField(message, 7) +proc hasoptions*(message: google_protobuf_MethodDescriptorProto): bool = + result = hasField(message, 4) -proc setmapEntry*(message: google_protobuf_MessageOptions, value: bool) = - message.mapEntry = value - setField(message, 7) +proc setoptions*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) = + message.options = value + setField(message, 4) -proc mapEntry*(message: google_protobuf_MessageOptions): bool {.inline.} = - message.mapEntry +proc options*(message: google_protobuf_MethodDescriptorProto): google_protobuf_MethodOptions {.inline.} = + message.options -proc `mapEntry=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = - setmapEntry(message, value) +proc `options=`*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) {.inline.} = + setoptions(message, value) -proc clearuninterpretedOption*(message: google_protobuf_MessageOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) +proc clearclientStreaming*(message: google_protobuf_MethodDescriptorProto) = + message.clientStreaming = false + clearFields(message, [5]) -proc hasuninterpretedOption*(message: google_protobuf_MessageOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) +proc hasclientStreaming*(message: google_protobuf_MethodDescriptorProto): bool = + result = hasField(message, 5) -proc setuninterpretedOption*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) +proc setclientStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = + message.clientStreaming = value + setField(message, 5) -proc adduninterpretedOption*(message: google_protobuf_MessageOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) +proc clientStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = + message.clientStreaming -proc uninterpretedOption*(message: google_protobuf_MessageOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption +proc `clientStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = + setclientStreaming(message, value) -proc `uninterpretedOption=`*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) +proc clearserverStreaming*(message: google_protobuf_MethodDescriptorProto) = + message.serverStreaming = false + clearFields(message, [6]) -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)) +proc hasserverStreaming*(message: google_protobuf_MethodDescriptorProto): bool = + result = hasField(message, 6) + +proc setserverStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = + message.serverStreaming = value + setField(message, 6) + +proc serverStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = + message.serverStreaming + +proc `serverStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = + setserverStreaming(message, value) + +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 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) +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 readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_MessageOptions = - result = newgoogle_protobuf_MessageOptions() +proc readgoogle_protobuf_MethodDescriptorProto*(stream: Stream): google_protobuf_MethodDescriptorProto = + result = newgoogle_protobuf_MethodDescriptorProto() while not atEnd(stream): let tag = readTag(stream) @@ -2588,38 +2194,41 @@ proc readgoogle_protobuf_MessageOptions*(stream: Stream): google_protobuf_Messag of 0: raise newException(InvalidFieldNumberError, "Invalid field number: 0") of 1: - expectWireType(wireType, WireType.Varint) - setmessageSetWireFormat(result, protoReadBool(stream)) + expectWireType(wireType, WireType.LengthDelimited) + setname(result, protoReadString(stream)) of 2: - expectWireType(wireType, WireType.Varint) - setnoStandardDescriptorAccessor(result, protoReadBool(stream)) + expectWireType(wireType, WireType.LengthDelimited) + setinputType(result, protoReadString(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) + setoutputType(result, protoReadString(stream)) + of 4: expectWireType(wireType, WireType.LengthDelimited) let data = readLengthDelimited(stream) - adduninterpretedOption(result, newgoogle_protobuf_UninterpretedOption(data)) + 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 serialize*(message: google_protobuf_MessageOptions): string = +proc serialize*(message: google_protobuf_MethodDescriptorProto): string = let ss = newStringStream() - writegoogle_protobuf_MessageOptions(ss, message) + writegoogle_protobuf_MethodDescriptorProto(ss, message) result = ss.data -proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions = +proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto = let ss = newStringStream(data) - result = readgoogle_protobuf_MessageOptions(ss) + result = readgoogle_protobuf_MethodDescriptorProto(ss) -proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions = +proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto = let ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MessageOptions(ss) + result = readgoogle_protobuf_MethodDescriptorProto(ss) proc fullyQualifiedName*(T: typedesc[google_protobuf_OneofOptions]): string = "google.protobuf.OneofOptions" @@ -2801,6 +2410,351 @@ proc newgoogle_protobuf_OneofDescriptorProto*(data: seq[byte]): google_protobuf_ result = readgoogle_protobuf_OneofDescriptorProto(ss) +proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumOptions]): string = "google.protobuf.EnumOptions" + +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_EnumOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumOptionsImpl + result.writeImpl = writegoogle_protobuf_EnumOptionsImpl + +proc newgoogle_protobuf_EnumOptions*(): google_protobuf_EnumOptions = + new(result) + initMessage(result[]) + result.procs = google_protobuf_EnumOptionsProcs() + result.allowAlias = false + result.deprecated = false + result.uninterpretedOption = @[] + +proc clearallowAlias*(message: google_protobuf_EnumOptions) = + message.allowAlias = false + clearFields(message, [2]) + +proc hasallowAlias*(message: google_protobuf_EnumOptions): bool = + result = hasField(message, 2) + +proc setallowAlias*(message: google_protobuf_EnumOptions, value: bool) = + message.allowAlias = value + setField(message, 2) + +proc allowAlias*(message: google_protobuf_EnumOptions): bool {.inline.} = + message.allowAlias + +proc `allowAlias=`*(message: google_protobuf_EnumOptions, value: bool) {.inline.} = + setallowAlias(message, value) + +proc cleardeprecated*(message: google_protobuf_EnumOptions) = + message.deprecated = false + clearFields(message, [3]) + +proc hasdeprecated*(message: google_protobuf_EnumOptions): bool = + result = hasField(message, 3) + +proc setdeprecated*(message: google_protobuf_EnumOptions, value: bool) = + message.deprecated = 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 `uninterpretedOption=`*(message: google_protobuf_EnumOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) + +proc sizeOfgoogle_protobuf_EnumOptions*(message: google_protobuf_EnumOptions): uint64 = + if hasallowAlias(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 + 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) + writeUnknownFields(stream, message) + +proc readgoogle_protobuf_EnumOptions*(stream: Stream): google_protobuf_EnumOptions = + result = newgoogle_protobuf_EnumOptions() + while not atEnd(stream): + let + tag = readTag(stream) + wireType = wireType(tag) + case fieldNumber(tag) + of 0: + raise newException(InvalidFieldNumberError, "Invalid field number: 0") + of 2: + expectWireType(wireType, WireType.Varint) + setallowAlias(result, protoReadBool(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)) + else: readUnknownField(stream, result, tag) + +proc serialize*(message: google_protobuf_EnumOptions): string = + let + ss = newStringStream() + writegoogle_protobuf_EnumOptions(ss, message) + result = ss.data + +proc newgoogle_protobuf_EnumOptions*(data: string): google_protobuf_EnumOptions = + let + ss = newStringStream(data) + result = readgoogle_protobuf_EnumOptions(ss) + +proc newgoogle_protobuf_EnumOptions*(data: seq[byte]): google_protobuf_EnumOptions = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_EnumOptions(ss) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo_Location]): string = "google.protobuf.SourceCodeInfo.Location" + +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_SourceCodeInfo_LocationProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_SourceCodeInfo_LocationImpl + result.writeImpl = writegoogle_protobuf_SourceCodeInfo_LocationImpl + +proc newgoogle_protobuf_SourceCodeInfo_Location*(): google_protobuf_SourceCodeInfo_Location = + 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]) + +proc hasspan*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 2) or (len(message.span) > 0) + +proc setspan*(message: google_protobuf_SourceCodeInfo_Location, value: seq[int32]) = + message.span = value + setField(message, 2) + +proc addspan*(message: google_protobuf_SourceCodeInfo_Location, value: int32) = + add(message.span, value) + +proc span*(message: google_protobuf_SourceCodeInfo_Location): seq[int32] {.inline.} = + message.span + +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 hasleadingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 3) + +proc setleadingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + message.leadingComments = value + setField(message, 3) + +proc leadingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = + message.leadingComments + +proc `leadingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = + setleadingComments(message, value) + +proc cleartrailingComments*(message: google_protobuf_SourceCodeInfo_Location) = + message.trailingComments = "" + clearFields(message, [4]) + +proc hastrailingComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 4) + +proc settrailingComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + message.trailingComments = value + setField(message, 4) + +proc trailingComments*(message: google_protobuf_SourceCodeInfo_Location): string {.inline.} = + message.trailingComments + +proc `trailingComments=`*(message: google_protobuf_SourceCodeInfo_Location, value: string) {.inline.} = + settrailingComments(message, value) + +proc clearleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location) = + message.leadingDetachedComments = @[] + clearFields(message, [6]) + +proc hasleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): bool = + result = hasField(message, 6) or (len(message.leadingDetachedComments) > 0) + +proc setleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: seq[string]) = + message.leadingDetachedComments = value + setField(message, 6) + +proc addleadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location, value: string) = + add(message.leadingDetachedComments, value) + +proc leadingDetachedComments*(message: google_protobuf_SourceCodeInfo_Location): seq[string] {.inline.} = + message.leadingDetachedComments + +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 + 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 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_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 serialize*(message: google_protobuf_SourceCodeInfo_Location): string = + let + ss = newStringStream() + writegoogle_protobuf_SourceCodeInfo_Location(ss, message) + result = ss.data + +proc newgoogle_protobuf_SourceCodeInfo_Location*(data: string): google_protobuf_SourceCodeInfo_Location = + let + ss = newStringStream(data) + result = readgoogle_protobuf_SourceCodeInfo_Location(ss) + +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 fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto_ReservedRange]): string = "google.protobuf.DescriptorProto.ReservedRange" proc readgoogle_protobuf_DescriptorProto_ReservedRangeImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto_ReservedRange(stream) @@ -2901,6 +2855,634 @@ proc newgoogle_protobuf_DescriptorProto_ReservedRange*(data: seq[byte]): google_ result = readgoogle_protobuf_DescriptorProto_ReservedRange(ss) +proc fullyQualifiedName*(T: typedesc[google_protobuf_SourceCodeInfo]): string = "google.protobuf.SourceCodeInfo" + +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_SourceCodeInfoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_SourceCodeInfoImpl + result.writeImpl = writegoogle_protobuf_SourceCodeInfoImpl + +proc newgoogle_protobuf_SourceCodeInfo*(): google_protobuf_SourceCodeInfo = + new(result) + initMessage(result[]) + result.procs = google_protobuf_SourceCodeInfoProcs() + result.location = @[] + +proc clearlocation*(message: google_protobuf_SourceCodeInfo) = + message.location = @[] + clearFields(message, [1]) + +proc haslocation*(message: google_protobuf_SourceCodeInfo): bool = + result = hasField(message, 1) or (len(message.location) > 0) + +proc setlocation*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) = + message.location = value + setField(message, 1) + +proc addlocation*(message: google_protobuf_SourceCodeInfo, value: google_protobuf_SourceCodeInfo_Location) = + add(message.location, value) + +proc location*(message: google_protobuf_SourceCodeInfo): seq[google_protobuf_SourceCodeInfo_Location] {.inline.} = + message.location + +proc `location=`*(message: google_protobuf_SourceCodeInfo, value: seq[google_protobuf_SourceCodeInfo_Location]) {.inline.} = + setlocation(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 writegoogle_protobuf_SourceCodeInfo*(stream: Stream, message: google_protobuf_SourceCodeInfo) = + for value in message.location: + writeMessage(stream, value, 1) + writeUnknownFields(stream, message) + +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 serialize*(message: google_protobuf_SourceCodeInfo): string = + let + ss = newStringStream() + writegoogle_protobuf_SourceCodeInfo(ss, message) + result = ss.data + +proc newgoogle_protobuf_SourceCodeInfo*(data: string): google_protobuf_SourceCodeInfo = + let + ss = newStringStream(data) + result = readgoogle_protobuf_SourceCodeInfo(ss) + +proc newgoogle_protobuf_SourceCodeInfo*(data: seq[byte]): google_protobuf_SourceCodeInfo = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_SourceCodeInfo(ss) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto_EnumReservedRange]): string = "google.protobuf.EnumDescriptorProto.EnumReservedRange" + +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 google_protobuf_EnumDescriptorProto_EnumReservedRangeProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl + result.writeImpl = writegoogle_protobuf_EnumDescriptorProto_EnumReservedRangeImpl + +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 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 + +proc `start=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = + setstart(message, value) + +proc clearfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange) = + message.fend = 0 + clearFields(message, [2]) + +proc hasfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): bool = + result = hasField(message, 2) + +proc setfend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) = + message.fend = value + setField(message, 2) + +proc fend*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): int32 {.inline.} = + message.fend + +proc `fend=`*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange, value: int32) {.inline.} = + setfend(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) + 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) + writeUnknownFields(stream, message) + +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 serialize*(message: google_protobuf_EnumDescriptorProto_EnumReservedRange): string = + let + ss = newStringStream() + writegoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss, message) + result = ss.data + +proc newgoogle_protobuf_EnumDescriptorProto_EnumReservedRange*(data: string): google_protobuf_EnumDescriptorProto_EnumReservedRange = + let + ss = newStringStream(data) + result = readgoogle_protobuf_EnumDescriptorProto_EnumReservedRange(ss) + +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 fullyQualifiedName*(T: typedesc[google_protobuf_EnumDescriptorProto]): string = "google.protobuf.EnumDescriptorProto" + +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 google_protobuf_EnumDescriptorProtoProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_EnumDescriptorProtoImpl + result.writeImpl = writegoogle_protobuf_EnumDescriptorProtoImpl + +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, [3]) + +proc hasoptions*(message: google_protobuf_EnumDescriptorProto): bool = + result = hasField(message, 3) + +proc setoptions*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) = + message.options = value + setField(message, 3) + +proc options*(message: google_protobuf_EnumDescriptorProto): google_protobuf_EnumOptions {.inline.} = + message.options + +proc `options=`*(message: google_protobuf_EnumDescriptorProto, value: google_protobuf_EnumOptions) {.inline.} = + setoptions(message, value) + +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 setreservedName*(message: google_protobuf_EnumDescriptorProto, value: seq[string]) = + message.reservedName = 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 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 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 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 serialize*(message: google_protobuf_EnumDescriptorProto): string = + let + ss = newStringStream() + writegoogle_protobuf_EnumDescriptorProto(ss, message) + result = ss.data + +proc newgoogle_protobuf_EnumDescriptorProto*(data: string): google_protobuf_EnumDescriptorProto = + let + ss = newStringStream(data) + result = readgoogle_protobuf_EnumDescriptorProto(ss) + +proc newgoogle_protobuf_EnumDescriptorProto*(data: seq[byte]): google_protobuf_EnumDescriptorProto = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_EnumDescriptorProto(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) + + +proc fullyQualifiedName*(T: typedesc[google_protobuf_MessageOptions]): string = "google.protobuf.MessageOptions" + +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 google_protobuf_MessageOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_MessageOptionsImpl + result.writeImpl = writegoogle_protobuf_MessageOptionsImpl + +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 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 + clearFields(message, [2]) + +proc hasnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 2) + +proc setnoStandardDescriptorAccessor*(message: google_protobuf_MessageOptions, value: bool) = + message.noStandardDescriptorAccessor = value + setField(message, 2) + +proc noStandardDescriptorAccessor*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.noStandardDescriptorAccessor + +proc `noStandardDescriptorAccessor=`*(message: google_protobuf_MessageOptions, value: bool) {.inline.} = + setnoStandardDescriptorAccessor(message, value) + +proc cleardeprecated*(message: google_protobuf_MessageOptions) = + message.deprecated = false + clearFields(message, [3]) + +proc hasdeprecated*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 3) + +proc setdeprecated*(message: google_protobuf_MessageOptions, value: bool) = + message.deprecated = value + setField(message, 3) + +proc deprecated*(message: google_protobuf_MessageOptions): bool {.inline.} = + message.deprecated + +proc `deprecated=`*(message: google_protobuf_MessageOptions, 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) = + message.uninterpretedOption = @[] + clearFields(message, [999]) + +proc hasuninterpretedOption*(message: google_protobuf_MessageOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) + +proc setuninterpretedOption*(message: google_protobuf_MessageOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) + +proc adduninterpretedOption*(message: google_protobuf_MessageOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) + +proc uninterpretedOption*(message: google_protobuf_MessageOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption + +proc `uninterpretedOption=`*(message: google_protobuf_MessageOptions, 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): + 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 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 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 serialize*(message: google_protobuf_MessageOptions): string = + let + ss = newStringStream() + writegoogle_protobuf_MessageOptions(ss, message) + result = ss.data + +proc newgoogle_protobuf_MessageOptions*(data: string): google_protobuf_MessageOptions = + let + ss = newStringStream(data) + result = readgoogle_protobuf_MessageOptions(ss) + +proc newgoogle_protobuf_MessageOptions*(data: seq[byte]): google_protobuf_MessageOptions = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_MessageOptions(ss) + + proc fullyQualifiedName*(T: typedesc[google_protobuf_DescriptorProto]): string = "google.protobuf.DescriptorProto" proc readgoogle_protobuf_DescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_DescriptorProto(stream) @@ -3241,6 +3823,241 @@ proc newgoogle_protobuf_DescriptorProto*(data: seq[byte]): google_protobuf_Descr result = readgoogle_protobuf_DescriptorProto(ss) +proc fullyQualifiedName*(T: typedesc[google_protobuf_ServiceOptions]): string = "google.protobuf.ServiceOptions" + +proc readgoogle_protobuf_ServiceOptionsImpl(stream: Stream): Message = readgoogle_protobuf_ServiceOptions(stream) +proc writegoogle_protobuf_ServiceOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ServiceOptions(stream, google_protobuf_ServiceOptions(msg)) + +proc google_protobuf_ServiceOptionsProcs*(): MessageProcs = + result.readImpl = readgoogle_protobuf_ServiceOptionsImpl + result.writeImpl = writegoogle_protobuf_ServiceOptionsImpl + +proc newgoogle_protobuf_ServiceOptions*(): google_protobuf_ServiceOptions = + new(result) + initMessage(result[]) + result.procs = google_protobuf_ServiceOptionsProcs() + result.deprecated = false + result.uninterpretedOption = @[] + +proc cleardeprecated*(message: google_protobuf_ServiceOptions) = + message.deprecated = false + clearFields(message, [33]) + +proc hasdeprecated*(message: google_protobuf_ServiceOptions): bool = + result = hasField(message, 33) + +proc setdeprecated*(message: google_protobuf_ServiceOptions, value: bool) = + message.deprecated = value + setField(message, 33) + +proc deprecated*(message: google_protobuf_ServiceOptions): bool {.inline.} = + message.deprecated + +proc `deprecated=`*(message: google_protobuf_ServiceOptions, value: bool) {.inline.} = + setdeprecated(message, value) + +proc clearuninterpretedOption*(message: google_protobuf_ServiceOptions) = + message.uninterpretedOption = @[] + clearFields(message, [999]) + +proc hasuninterpretedOption*(message: google_protobuf_ServiceOptions): bool = + result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) + +proc setuninterpretedOption*(message: google_protobuf_ServiceOptions, value: seq[google_protobuf_UninterpretedOption]) = + message.uninterpretedOption = value + setField(message, 999) + +proc adduninterpretedOption*(message: google_protobuf_ServiceOptions, value: google_protobuf_UninterpretedOption) = + add(message.uninterpretedOption, value) + +proc uninterpretedOption*(message: google_protobuf_ServiceOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = + message.uninterpretedOption + +proc `uninterpretedOption=`*(message: google_protobuf_ServiceOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = + setuninterpretedOption(message, value) + +proc sizeOfgoogle_protobuf_ServiceOptions*(message: google_protobuf_ServiceOptions): uint64 = + if hasdeprecated(message): + result = result + sizeOfTag(33, 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 + sizeOfUnknownFields(message) + +proc writegoogle_protobuf_ServiceOptions*(stream: Stream, message: google_protobuf_ServiceOptions) = + if hasdeprecated(message): + protoWriteBool(stream, message.deprecated, 33) + for value in message.uninterpretedOption: + writeMessage(stream, value, 999) + writeUnknownFields(stream, message) + +proc readgoogle_protobuf_ServiceOptions*(stream: Stream): google_protobuf_ServiceOptions = + result = newgoogle_protobuf_ServiceOptions() + 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 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_ServiceOptions): string = + let + ss = newStringStream() + writegoogle_protobuf_ServiceOptions(ss, message) + result = ss.data + +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_ServiceDescriptorProto(ss) + +proc newgoogle_protobuf_ServiceDescriptorProto*(data: seq[byte]): google_protobuf_ServiceDescriptorProto = + let + ss = newStringStream(cast[string](data)) + result = readgoogle_protobuf_ServiceDescriptorProto(ss) + + proc fullyQualifiedName*(T: typedesc[google_protobuf_FileOptions]): string = "google.protobuf.FileOptions" proc readgoogle_protobuf_FileOptionsImpl(stream: Stream): Message = readgoogle_protobuf_FileOptions(stream) @@ -3787,576 +4604,6 @@ proc newgoogle_protobuf_FileOptions*(data: seq[byte]): google_protobuf_FileOptio result = readgoogle_protobuf_FileOptions(ss) -proc fullyQualifiedName*(T: typedesc[google_protobuf_ServiceOptions]): string = "google.protobuf.ServiceOptions" - -proc readgoogle_protobuf_ServiceOptionsImpl(stream: Stream): Message = readgoogle_protobuf_ServiceOptions(stream) -proc writegoogle_protobuf_ServiceOptionsImpl(stream: Stream, msg: Message) = writegoogle_protobuf_ServiceOptions(stream, google_protobuf_ServiceOptions(msg)) - -proc google_protobuf_ServiceOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_ServiceOptionsImpl - result.writeImpl = writegoogle_protobuf_ServiceOptionsImpl - -proc newgoogle_protobuf_ServiceOptions*(): google_protobuf_ServiceOptions = - new(result) - initMessage(result[]) - result.procs = google_protobuf_ServiceOptionsProcs() - result.deprecated = false - result.uninterpretedOption = @[] - -proc cleardeprecated*(message: google_protobuf_ServiceOptions) = - message.deprecated = false - clearFields(message, [33]) - -proc hasdeprecated*(message: google_protobuf_ServiceOptions): bool = - result = hasField(message, 33) - -proc setdeprecated*(message: google_protobuf_ServiceOptions, value: bool) = - message.deprecated = value - setField(message, 33) - -proc deprecated*(message: google_protobuf_ServiceOptions): bool {.inline.} = - message.deprecated - -proc `deprecated=`*(message: google_protobuf_ServiceOptions, value: bool) {.inline.} = - setdeprecated(message, value) - -proc clearuninterpretedOption*(message: google_protobuf_ServiceOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) - -proc hasuninterpretedOption*(message: google_protobuf_ServiceOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) - -proc setuninterpretedOption*(message: google_protobuf_ServiceOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) - -proc adduninterpretedOption*(message: google_protobuf_ServiceOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) - -proc uninterpretedOption*(message: google_protobuf_ServiceOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption - -proc `uninterpretedOption=`*(message: google_protobuf_ServiceOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) - -proc sizeOfgoogle_protobuf_ServiceOptions*(message: google_protobuf_ServiceOptions): uint64 = - if hasdeprecated(message): - result = result + sizeOfTag(33, 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 + sizeOfUnknownFields(message) - -proc writegoogle_protobuf_ServiceOptions*(stream: Stream, message: google_protobuf_ServiceOptions) = - if hasdeprecated(message): - protoWriteBool(stream, message.deprecated, 33) - for value in message.uninterpretedOption: - writeMessage(stream, value, 999) - writeUnknownFields(stream, message) - -proc readgoogle_protobuf_ServiceOptions*(stream: Stream): google_protobuf_ServiceOptions = - result = newgoogle_protobuf_ServiceOptions() - 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 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_ServiceOptions): string = - let - ss = newStringStream() - writegoogle_protobuf_ServiceOptions(ss, message) - result = ss.data - -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_MethodOptions]): string = "google.protobuf.MethodOptions" - -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_MethodOptionsProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MethodOptionsImpl - result.writeImpl = writegoogle_protobuf_MethodOptionsImpl - -proc newgoogle_protobuf_MethodOptions*(): google_protobuf_MethodOptions = - new(result) - initMessage(result[]) - result.procs = google_protobuf_MethodOptionsProcs() - result.deprecated = false - result.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN - result.uninterpretedOption = @[] - -proc cleardeprecated*(message: google_protobuf_MethodOptions) = - message.deprecated = false - clearFields(message, [33]) - -proc hasdeprecated*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 33) - -proc setdeprecated*(message: google_protobuf_MethodOptions, value: bool) = - message.deprecated = value - setField(message, 33) - -proc deprecated*(message: google_protobuf_MethodOptions): bool {.inline.} = - message.deprecated - -proc `deprecated=`*(message: google_protobuf_MethodOptions, value: bool) {.inline.} = - setdeprecated(message, value) - -proc clearidempotencyLevel*(message: google_protobuf_MethodOptions) = - message.idempotencyLevel = google_protobuf_MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN - clearFields(message, [34]) - -proc hasidempotencyLevel*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 34) - -proc setidempotencyLevel*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) = - message.idempotencyLevel = value - setField(message, 34) - -proc idempotencyLevel*(message: google_protobuf_MethodOptions): google_protobuf_MethodOptions_IdempotencyLevel {.inline.} = - message.idempotencyLevel - -proc `idempotencyLevel=`*(message: google_protobuf_MethodOptions, value: google_protobuf_MethodOptions_IdempotencyLevel) {.inline.} = - setidempotencyLevel(message, value) - -proc clearuninterpretedOption*(message: google_protobuf_MethodOptions) = - message.uninterpretedOption = @[] - clearFields(message, [999]) - -proc hasuninterpretedOption*(message: google_protobuf_MethodOptions): bool = - result = hasField(message, 999) or (len(message.uninterpretedOption) > 0) - -proc setuninterpretedOption*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) = - message.uninterpretedOption = value - setField(message, 999) - -proc adduninterpretedOption*(message: google_protobuf_MethodOptions, value: google_protobuf_UninterpretedOption) = - add(message.uninterpretedOption, value) - -proc uninterpretedOption*(message: google_protobuf_MethodOptions): seq[google_protobuf_UninterpretedOption] {.inline.} = - message.uninterpretedOption - -proc `uninterpretedOption=`*(message: google_protobuf_MethodOptions, value: seq[google_protobuf_UninterpretedOption]) {.inline.} = - setuninterpretedOption(message, value) - -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 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 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 serialize*(message: google_protobuf_MethodOptions): string = - let - ss = newStringStream() - writegoogle_protobuf_MethodOptions(ss, message) - result = ss.data - -proc newgoogle_protobuf_MethodOptions*(data: string): google_protobuf_MethodOptions = - let - ss = newStringStream(data) - result = readgoogle_protobuf_MethodOptions(ss) - -proc newgoogle_protobuf_MethodOptions*(data: seq[byte]): google_protobuf_MethodOptions = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MethodOptions(ss) - - -proc fullyQualifiedName*(T: typedesc[google_protobuf_MethodDescriptorProto]): string = "google.protobuf.MethodDescriptorProto" - -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_MethodDescriptorProtoProcs*(): MessageProcs = - result.readImpl = readgoogle_protobuf_MethodDescriptorProtoImpl - result.writeImpl = writegoogle_protobuf_MethodDescriptorProtoImpl - -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 clearname*(message: google_protobuf_MethodDescriptorProto) = - message.name = "" - clearFields(message, [1]) - -proc hasname*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 1) - -proc setname*(message: google_protobuf_MethodDescriptorProto, value: string) = - message.name = value - setField(message, 1) - -proc name*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = - message.name - -proc `name=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = - setname(message, value) - -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 hasoutputType*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 3) - -proc setoutputType*(message: google_protobuf_MethodDescriptorProto, value: string) = - message.outputType = value - setField(message, 3) - -proc outputType*(message: google_protobuf_MethodDescriptorProto): string {.inline.} = - message.outputType - -proc `outputType=`*(message: google_protobuf_MethodDescriptorProto, value: string) {.inline.} = - setoutputType(message, value) - -proc clearoptions*(message: google_protobuf_MethodDescriptorProto) = - message.options = nil - clearFields(message, [4]) - -proc hasoptions*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 4) - -proc setoptions*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) = - message.options = value - setField(message, 4) - -proc options*(message: google_protobuf_MethodDescriptorProto): google_protobuf_MethodOptions {.inline.} = - message.options - -proc `options=`*(message: google_protobuf_MethodDescriptorProto, value: google_protobuf_MethodOptions) {.inline.} = - setoptions(message, value) - -proc clearclientStreaming*(message: google_protobuf_MethodDescriptorProto) = - message.clientStreaming = false - clearFields(message, [5]) - -proc hasclientStreaming*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 5) - -proc setclientStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = - message.clientStreaming = value - setField(message, 5) - -proc clientStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = - message.clientStreaming - -proc `clientStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = - setclientStreaming(message, value) - -proc clearserverStreaming*(message: google_protobuf_MethodDescriptorProto) = - message.serverStreaming = false - clearFields(message, [6]) - -proc hasserverStreaming*(message: google_protobuf_MethodDescriptorProto): bool = - result = hasField(message, 6) - -proc setserverStreaming*(message: google_protobuf_MethodDescriptorProto, value: bool) = - message.serverStreaming = value - setField(message, 6) - -proc serverStreaming*(message: google_protobuf_MethodDescriptorProto): bool {.inline.} = - message.serverStreaming - -proc `serverStreaming=`*(message: google_protobuf_MethodDescriptorProto, value: bool) {.inline.} = - setserverStreaming(message, value) - -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 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 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 serialize*(message: google_protobuf_MethodDescriptorProto): string = - let - ss = newStringStream() - writegoogle_protobuf_MethodDescriptorProto(ss, message) - result = ss.data - -proc newgoogle_protobuf_MethodDescriptorProto*(data: string): google_protobuf_MethodDescriptorProto = - let - ss = newStringStream(data) - result = readgoogle_protobuf_MethodDescriptorProto(ss) - -proc newgoogle_protobuf_MethodDescriptorProto*(data: seq[byte]): google_protobuf_MethodDescriptorProto = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_MethodDescriptorProto(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_ServiceDescriptorProto(ss) - -proc newgoogle_protobuf_ServiceDescriptorProto*(data: seq[byte]): google_protobuf_ServiceDescriptorProto = - let - ss = newStringStream(cast[string](data)) - result = readgoogle_protobuf_ServiceDescriptorProto(ss) - - proc fullyQualifiedName*(T: typedesc[google_protobuf_FileDescriptorProto]): string = "google.protobuf.FileDescriptorProto" proc readgoogle_protobuf_FileDescriptorProtoImpl(stream: Stream): Message = readgoogle_protobuf_FileDescriptorProto(stream) @@ -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. |
