aboutsummaryrefslogtreecommitdiff
path: root/src/protobuf
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2018-04-03 21:27:07 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2018-04-03 21:27:07 +0300
commita862f4d7b35b5cb999ea9c7ce11e0f59b6318b74 (patch)
tree0908a40c1e020e6e897618dce06f1759b2b8e798 /src/protobuf
parent3b20e280d04708d505ab5770e8ea09aa6eab5aaf (diff)
downloadnimpb-a862f4d7b35b5cb999ea9c7ce11e0f59b6318b74.tar.gz
nimpb-a862f4d7b35b5cb999ea9c7ce11e0f59b6318b74.zip
Rename library to nimpb
Diffstat (limited to 'src/protobuf')
-rw-r--r--src/protobuf/protobuf.nim517
-rw-r--r--src/protobuf/wkt/any.proto149
-rw-r--r--src/protobuf/wkt/any_pb.nim109
-rw-r--r--src/protobuf/wkt/api.proto210
-rw-r--r--src/protobuf/wkt/api_pb.nim664
-rw-r--r--src/protobuf/wkt/duration.proto117
-rw-r--r--src/protobuf/wkt/duration_pb.nim109
-rw-r--r--src/protobuf/wkt/empty.proto52
-rw-r--r--src/protobuf/wkt/empty_pb.nim43
-rw-r--r--src/protobuf/wkt/field_mask.proto246
-rw-r--r--src/protobuf/wkt/field_mask_pb.nim84
-rw-r--r--src/protobuf/wkt/source_context.proto48
-rw-r--r--src/protobuf/wkt/source_context_pb.nim79
-rw-r--r--src/protobuf/wkt/struct.proto96
-rw-r--r--src/protobuf/wkt/struct_pb.nim629
-rw-r--r--src/protobuf/wkt/timestamp.proto133
-rw-r--r--src/protobuf/wkt/timestamp_pb.nim109
-rw-r--r--src/protobuf/wkt/type.proto187
-rw-r--r--src/protobuf/wkt/type_pb.nim1140
-rw-r--r--src/protobuf/wkt/wrappers.proto118
-rw-r--r--src/protobuf/wkt/wrappers_pb.nim647
21 files changed, 0 insertions, 5486 deletions
diff --git a/src/protobuf/protobuf.nim b/src/protobuf/protobuf.nim
deleted file mode 100644
index d15bfc7..0000000
--- a/src/protobuf/protobuf.nim
+++ /dev/null
@@ -1,517 +0,0 @@
-import endians
-import intsets
-import macros
-import streams
-import strutils
-
-export streams
-
-const
- MaximumVarintBytes = 10
- WireTypeBits = 3
- WireTypeMask = (1 shl WireTypeBits) - 1
-
-type
- ProtobufStreamObj* = object of StreamObj
- stream: Stream
-
- ProtobufStream* = ref ProtobufStreamObj
-
- Tag* = distinct uint32
-
- ParseError* = object of Exception
-
- InvalidFieldNumberError* = object of ParseError
-
- UnexpectedWireTypeError* = object of ParseError
-
- bytes* = distinct string
-
- WireType* {.pure.} = enum
- Varint = 0
- Fixed64 = 1
- LengthDelimited = 2
- StartGroup = 3
- EndGroup = 4
- Fixed32 = 5
-
- FieldType* {.pure.} = enum
- Double = 1
- Float
- Int64
- UInt64
- Int32
- Fixed64
- Fixed32
- Bool
- String
- Group
- Message
- Bytes
- UInt32
- Enum
- SFixed32
- SFixed64
- SInt32
- SInt64
-
-proc wiretype*(ft: FieldType): WireType =
- case ft
- of FieldType.Double: result = WireType.Fixed64
- of FieldType.Float: result = WireType.Fixed32
- of FieldType.Int64: result = WireType.Varint
- of FieldType.UInt64: result = WireType.Varint
- of FieldType.Int32: result = WireType.Varint
- of FieldType.Fixed64: result = WireType.Fixed64
- of FieldType.Fixed32: result = WireType.Fixed32
- of FieldType.Bool: result = WireType.Varint
- of FieldType.String: result = WireType.LengthDelimited
- of FieldType.Group: result = WireType.LengthDelimited # ???
- of FieldType.Message: result = WireType.LengthDelimited
- of FieldType.Bytes: result = WireType.LengthDelimited
- of FieldType.UInt32: result = WireType.Varint
- of FieldType.Enum: result = WireType.Varint
- of FieldType.SFixed32: result = WireType.Fixed32
- of FieldType.SFixed64: result = WireType.Fixed64
- of FieldType.SInt32: result = WireType.Varint
- of FieldType.SInt64: result = WireType.Varint
-
-proc isNumeric*(wiretype: WireType): bool =
- case wiretype
- of WireType.Varint: result = true
- of WireType.Fixed64: result = true
- of WireType.Fixed32: result = true
- else: result = false
-
-proc isNumeric*(ft: FieldType): bool =
- result = isNumeric(wiretype(ft))
-
-proc pbClose(s: Stream) =
- close(ProtobufStream(s).stream)
- ProtobufStream(s).stream = nil
-
-proc pbAtEnd(s: Stream): bool =
- result = atEnd(ProtobufStream(s).stream)
-
-proc pbSetPosition(s: Stream, pos: int) =
- setPosition(ProtobufStream(s).stream, pos)
-
-proc pbGetPosition(s: Stream): int =
- result = getPosition(ProtobufStream(s).stream)
-
-proc pbReadData(s: Stream, buffer: pointer, bufLen: int): int =
- result = readData(ProtobufStream(s).stream, buffer, bufLen)
-
-proc pbPeekData(s: Stream, buffer: pointer, bufLen: int): int =
- result = peekData(ProtobufStream(s).stream, buffer, bufLen)
-
-proc pbWriteData(s: Stream, buffer: pointer, bufLen: int) =
- writeData(ProtobufStream(s).stream, buffer, bufLen)
-
-proc pbFlush(s: Stream) =
- flush(ProtobufStream(s).stream)
-
-proc newProtobufStream*(stream: Stream): ProtobufStream =
- new(result)
-
- result.closeImpl = pbClose
- result.atEndImpl = pbAtEnd
- result.setPositionImpl = pbSetPosition
- result.getPositionImpl = pbGetPosition
- result.readDataImpl = pbReadData
- result.peekDataImpl = pbPeekData
- result.writeDataImpl = pbWriteData
- result.flushImpl = pbFlush
-
- result.stream = stream
-
-proc readByte(stream: ProtobufStream): byte =
- result = readInt8(stream).byte
-
-proc writeByte(stream: ProtobufStream, b: byte) =
- var x: byte
- shallowCopy(x, b)
- writeData(stream, addr(x), sizeof(x))
-
-proc readVarint*(stream: ProtobufStream): uint64 =
- var
- count = 0
-
- result = 0
-
- while true:
- if count == MaximumVarintBytes:
- raise newException(Exception, "invalid varint (<= 10 bytes)")
-
- let b = readByte(stream)
-
- result = result or ((b.uint64 and 0x7f) shl (7 * count))
-
- inc(count)
-
- if (b and 0x80) == 0:
- break
-
-proc writeVarint*(stream: ProtobufStream, n: uint64) =
- var value = n
- while value >= 0x80'u64:
- writeByte(stream, (value or 0x80).byte)
- value = value shr 7
- writeByte(stream, value.byte)
-
-proc zigzagEncode*(n: int32): uint32 =
- {.emit:["result = ((NU32)n << 1) ^ (NU32)(n >> 31);"].}
-
-proc zigzagDecode*(n: uint32): int32 =
- {.emit:["result = (NI32) ((n >> 1) ^ (~(n & 1) + 1));"].}
-
-proc zigzagEncode*(n: int64): uint64 =
- {.emit:["result = ((NU64)n << 1) ^ (NU64)(n >> 63);"].}
-
-proc zigzagDecode*(n: uint64): int64 =
- {.emit:["result = (NI64) ((n >> 1) ^ (~(n & 1) + 1));"].}
-
-template makeTag*(fieldNumber: int, wireType: WireType): Tag =
- ((fieldNumber shl 3).uint32 or wireType.uint32).Tag
-
-template getTagWireType*(tag: Tag): WireType =
- (tag.uint32 and WireTypeMask).WireType
-
-template getTagFieldNumber*(tag: Tag): int =
- (tag.uint32 shr 3).int
-
-proc writeTag*(stream: ProtobufStream, tag: Tag) =
- writeVarint(stream, tag.uint32)
-
-proc writeTag*(stream: ProtobufStream, fieldNumber: int, wireType: WireType) =
- writeTag(stream, makeTag(fieldNumber, wireType))
-
-proc readTag*(stream: ProtobufStream): Tag =
- result = readVarint(stream).Tag
-
-proc writeInt32*(stream: ProtobufStream, n: int32) =
- writeVarint(stream, n.uint64)
-
-proc writeInt32*(stream: ProtobufStream, n: int32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeInt32(stream, n)
-
-proc readInt32*(stream: ProtobufStream): int32 =
- result = readVarint(stream).int32
-
-proc writeSInt32*(stream: ProtobufStream, n: int32) =
- writeVarint(stream, zigzagEncode(n))
-
-proc writeSInt32*(stream: ProtobufStream, n: int32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, zigzagEncode(n))
-
-proc readSInt32*(stream: ProtobufStream): int32 =
- result = zigzagDecode(readVarint(stream).uint32)
-
-proc writeUInt32*(stream: ProtobufStream, n: uint32) =
- writeVarint(stream, n)
-
-proc writeUInt32*(stream: ProtobufStream, n: uint32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, n)
-
-proc readUInt32*(stream: ProtobufStream): uint32 =
- result = readVarint(stream).uint32
-
-proc writeInt64*(stream: ProtobufStream, n: int64) =
- writeVarint(stream, n.uint64)
-
-proc writeInt64*(stream: ProtobufStream, n: int64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, n.uint64)
-
-proc readInt64*(stream: ProtobufStream): int64 =
- result = readVarint(stream).int64
-
-proc writeSInt64*(stream: ProtobufStream, n: int64) =
- writeVarint(stream, zigzagEncode(n))
-
-proc writeSInt64*(stream: ProtobufStream, n: int64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, zigzagEncode(n))
-
-proc readSInt64*(stream: ProtobufStream): int64 =
- result = zigzagDecode(readVarint(stream))
-
-proc writeUInt64*(stream: ProtobufStream, n: uint64) =
- writeVarint(stream, n)
-
-proc writeUInt64*(stream: ProtobufStream, n: uint64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, n)
-
-proc readUInt64*(stream: ProtobufStream): uint64 =
- result = readVarint(stream)
-
-proc writeBool*(stream: ProtobufStream, value: bool) =
- writeVarint(stream, value.uint32)
-
-proc writeBool*(stream: ProtobufStream, n: bool, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Varint)
- writeVarint(stream, n.uint32)
-
-proc readBool*(stream: ProtobufStream): bool =
- result = readVarint(stream).bool
-
-proc writeFixed64*(stream: ProtobufStream, value: uint64) =
- var
- input = value
- output: uint64
-
- littleEndian64(addr(output), addr(input))
-
- write(stream, output)
-
-proc writeFixed64*(stream: ProtobufStream, n: uint64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed64)
- writeFixed64(stream, n)
-
-proc readFixed64*(stream: ProtobufStream): uint64 =
- var tmp: uint64
- if readData(stream, addr(tmp), sizeof(tmp)) != sizeof(tmp):
- raise newException(IOError, "cannot read from stream")
- littleEndian64(addr(result), addr(tmp))
-
-proc writeSFixed64*(stream: ProtobufStream, value: int64) =
- writeFixed64(stream, cast[uint64](value))
-
-proc writeSFixed64*(stream: ProtobufStream, value: int64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed64)
- writeSFixed64(stream, value)
-
-proc readSFixed64*(stream: ProtobufStream): int64 =
- result = cast[int64](readFixed64(stream))
-
-proc writeDouble*(stream: ProtobufStream, value: float64) =
- var
- input = value
- output: float64
-
- littleEndian64(addr(output), addr(input))
-
- write(stream, output)
-
-proc writeDouble*(stream: ProtobufStream, value: float64, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed64)
- writeDouble(stream, value)
-
-proc readDouble*(stream: ProtobufStream): float64 =
- var tmp: uint64
- if readData(stream, addr(tmp), sizeof(tmp)) != sizeof(tmp):
- raise newException(IOError, "cannot read from stream")
- littleEndian64(addr(result), addr(tmp))
-
-proc writeFixed32*(stream: ProtobufStream, value: uint32) =
- var
- input = value
- output: uint32
-
- littleEndian32(addr(output), addr(input))
-
- write(stream, output)
-
-proc writeFixed32*(stream: ProtobufStream, value: uint32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed32)
- writeFixed32(stream, value)
-
-proc readFixed32*(stream: ProtobufStream): uint32 =
- var tmp: uint32
- if readData(stream, addr(tmp), sizeof(tmp)) != sizeof(tmp):
- raise newException(IOError, "cannot read from stream")
- littleEndian32(addr(result), addr(tmp))
-
-proc writeSFixed32*(stream: ProtobufStream, value: int32) =
- writeFixed32(stream, cast[uint32](value))
-
-proc writeSFixed32*(stream: ProtobufStream, value: int32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed32)
- writeSFixed32(stream, value)
-
-proc readSFixed32*(stream: ProtobufStream): int32 =
- result = cast[int32](readFixed32(stream))
-
-proc writeFloat*(stream: ProtobufStream, value: float32) =
- var
- input = value
- output: float32
-
- littleEndian32(addr(output), addr(input))
-
- write(stream, output)
-
-proc writeFloat*(stream: ProtobufStream, value: float32, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.Fixed32)
- writeFloat(stream, value)
-
-proc readFloat*(stream: ProtobufStream): float32 =
- var tmp: float32
- if readData(stream, addr(tmp), sizeof(tmp)) != sizeof(tmp):
- raise newException(IOError, "cannot read from stream")
- littleEndian32(addr(result), addr(tmp))
-
-proc writeString*(stream: ProtobufStream, s: string) =
- writeUInt64(stream, len(s).uint64)
- write(stream, s)
-
-proc writeString*(stream: ProtobufStream, s: string, fieldNumber: int) =
- writeTag(stream, fieldNumber, WireType.LengthDelimited)
- writeString(stream, s)
-
-proc writeBytes*(stream: ProtobufStream, s: bytes) =
- writeString(stream, string(s))
-
-proc writeBytes*(stream: ProtobufStream, s: bytes, fieldNumber: int) =
- writeString(stream, string(s), fieldNumber)
-
-proc safeReadStr*(stream: Stream, size: int): string =
- result = newString(size)
- if readData(stream, addr(result[0]), size) != size:
- raise newException(IOError, "cannot read from stream")
-
-proc readString*(stream: ProtobufStream): string =
- let size = int(readUInt64(stream))
- result = safeReadStr(stream, size)
-
-proc readBytes*(stream: ProtobufStream): bytes =
- bytes(readString(stream))
-
-proc readEnum*[T](stream: ProtobufStream): T =
- result = T(readUInt32(stream))
-
-proc writeEnum*[T](stream: ProtobufStream, value: T) =
- writeUInt32(stream, uint32(value))
-
-proc sizeOfVarint[T](value: T): uint64 =
- var tmp = uint64(value)
- while tmp >= 0x80'u64:
- tmp = tmp shr 7
- inc(result)
- inc(result)
-
-proc packedFieldSize*[T](values: seq[T], fieldtype: FieldType): uint64 =
- case fieldtype
- of FieldType.Fixed64, FieldType.SFixed64, FieldType.Double:
- result = uint64(len(values)) * 8
- of FieldType.Fixed32, FieldType.SFixed32, FieldType.Float:
- result = uint64(len(values)) * 4
- of FieldType.Int64, FieldType.UInt64, FieldType.Int32, FieldType.Bool,
- FieldType.UInt32, FieldType.Enum:
- for value in values:
- result += sizeOfVarint(value)
- of FieldType.SInt32:
- for value in values:
- result += sizeOfVarint(zigzagEncode(int32(value)))
- of FieldType.SInt64:
- for value in values:
- result += sizeOfVarint(zigzagEncode(int64(value)))
- else:
- raise newException(Exception, "invalid fieldtype")
-
-proc sizeOfString*(s: string): uint64 =
- result = sizeOfVarint(len(s).uint64) + len(s).uint64
-
-proc sizeOfBytes*(s: bytes): uint64 =
- result = sizeOfString(string(s))
-
-proc sizeOfDouble*(value: float64): uint64 =
- result = 8
-
-proc sizeOfFloat*(value: float32): uint64 =
- result = 4
-
-proc sizeOfInt64*(value: int64): uint64 =
- result = sizeOfVarint(value)
-
-proc sizeOfUInt64*(value: uint64): uint64 =
- result = sizeOfVarint(value)
-
-proc sizeOfInt32*(value: int32): uint64 =
- result = sizeOfVarint(value)
-
-proc sizeOfFixed64*(value: uint64): uint64 =
- result = 8
-
-proc sizeOfFixed32*(value: uint32): uint64 =
- result = 4
-
-proc sizeOfBool*(value: bool): uint64 =
- result = sizeOfVarint(value)
-
-proc sizeOfUInt32*(value: uint32): uint64 =
- result = sizeOfVarint(value)
-
-proc sizeOfSFixed32*(value: int32): uint64 =
- result = 4
-
-proc sizeOfSFixed64*(value: int64): uint64 =
- result = 8
-
-proc sizeOfSInt32*(value: int32): uint64 =
- result = sizeOfVarint(zigzagEncode(value))
-
-proc sizeOfSInt64*(value: int64): uint64 =
- result = sizeOfVarint(zigzagEncode(value))
-
-proc sizeOfEnum*[T](value: T): uint64 =
- result = sizeOfUInt32(value.uint32)
-
-proc sizeOfLengthDelimited*(size: uint64): uint64 =
- result = size + sizeOfVarint(size)
-
-proc sizeOfTag*(fieldNumber: int, wiretype: WireType): uint64 =
- result = sizeOfUInt32(uint32(makeTag(fieldNumber, wiretype)))
-
-proc skipField*(stream: ProtobufStream, wiretype: WireType) =
- case wiretype
- of WireType.Varint:
- discard readVarint(stream)
- of WireType.Fixed64:
- discard readFixed64(stream)
- of WireType.Fixed32:
- discard readFixed32(stream)
- of WireType.LengthDelimited:
- let size = readVarint(stream)
- discard safeReadStr(stream, int(size))
- else:
- raise newException(Exception, "unsupported wiretype: " & $wiretype)
-
-proc expectWireType*(actual: WireType, expected: varargs[WireType]) =
- for exp in expected:
- if actual == exp:
- return
- let message = "Got wiretype " & $actual & " but expected: " &
- join(expected, ", ")
- raise newException(UnexpectedWireTypeError, message)
-
-macro writeMessage*(stream: ProtobufStream, message: typed, fieldNumber: int): typed =
- ## Write a message to a stream with tag and length.
- let t = getTypeInst(message)
- result = newStmtList(
- newCall(
- ident("writeTag"),
- stream,
- fieldNumber,
- newDotExpr(ident("WireType"), ident("LengthDelimited"))
- ),
- newCall(
- ident("writeVarint"),
- stream,
- newCall(ident("sizeOf" & $t), message)
- ),
- newCall(
- ident("write" & $t),
- stream,
- message
- )
- )
-
-proc excl*(s: var IntSet, values: openArray[int]) =
- ## Exclude multiple values from an IntSet.
- for value in values:
- excl(s, value)
diff --git a/src/protobuf/wkt/any.proto b/src/protobuf/wkt/any.proto
deleted file mode 100644
index c748667..0000000
--- a/src/protobuf/wkt/any.proto
+++ /dev/null
@@ -1,149 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option go_package = "github.com/golang/protobuf/ptypes/any";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "AnyProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// `Any` contains an arbitrary serialized protocol buffer message along with a
-// URL that describes the type of the serialized message.
-//
-// Protobuf library provides support to pack/unpack Any values in the form
-// of utility functions or additional generated methods of the Any type.
-//
-// Example 1: Pack and unpack a message in C++.
-//
-// Foo foo = ...;
-// Any any;
-// any.PackFrom(foo);
-// ...
-// if (any.UnpackTo(&foo)) {
-// ...
-// }
-//
-// Example 2: Pack and unpack a message in Java.
-//
-// Foo foo = ...;
-// Any any = Any.pack(foo);
-// ...
-// if (any.is(Foo.class)) {
-// foo = any.unpack(Foo.class);
-// }
-//
-// Example 3: Pack and unpack a message in Python.
-//
-// foo = Foo(...)
-// any = Any()
-// any.Pack(foo)
-// ...
-// if any.Is(Foo.DESCRIPTOR):
-// any.Unpack(foo)
-// ...
-//
-// Example 4: Pack and unpack a message in Go
-//
-// foo := &pb.Foo{...}
-// any, err := ptypes.MarshalAny(foo)
-// ...
-// foo := &pb.Foo{}
-// if err := ptypes.UnmarshalAny(any, foo); err != nil {
-// ...
-// }
-//
-// The pack methods provided by protobuf library will by default use
-// 'type.googleapis.com/full.type.name' as the type URL and the unpack
-// methods only use the fully qualified type name after the last '/'
-// in the type URL, for example "foo.bar.com/x/y.z" will yield type
-// name "y.z".
-//
-//
-// JSON
-// ====
-// The JSON representation of an `Any` value uses the regular
-// representation of the deserialized, embedded message, with an
-// additional field `@type` which contains the type URL. Example:
-//
-// package google.profile;
-// message Person {
-// string first_name = 1;
-// string last_name = 2;
-// }
-//
-// {
-// "@type": "type.googleapis.com/google.profile.Person",
-// "firstName": <string>,
-// "lastName": <string>
-// }
-//
-// If the embedded message type is well-known and has a custom JSON
-// representation, that representation will be embedded adding a field
-// `value` which holds the custom JSON in addition to the `@type`
-// field. Example (for message [google.protobuf.Duration][]):
-//
-// {
-// "@type": "type.googleapis.com/google.protobuf.Duration",
-// "value": "1.212s"
-// }
-//
-message Any {
- // A URL/resource name whose content describes the type of the
- // serialized protocol buffer message.
- //
- // For URLs which use the scheme `http`, `https`, or no scheme, the
- // following restrictions and interpretations apply:
- //
- // * If no scheme is provided, `https` is assumed.
- // * The last segment of the URL's path must represent the fully
- // qualified name of the type (as in `path/google.protobuf.Duration`).
- // The name should be in a canonical form (e.g., leading "." is
- // not accepted).
- // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
- // value in binary format, or produce an error.
- // * Applications are allowed to cache lookup results based on the
- // URL, or have them precompiled into a binary to avoid any
- // lookup. Therefore, binary compatibility needs to be preserved
- // on changes to types. (Use versioned type names to manage
- // breaking changes.)
- //
- // Schemes other than `http`, `https` (or the empty scheme) might be
- // used with implementation specific semantics.
- //
- string type_url = 1;
-
- // Must be a valid serialized protocol buffer of the above specified type.
- bytes value = 2;
-}
diff --git a/src/protobuf/wkt/any_pb.nim b/src/protobuf/wkt/any_pb.nim
deleted file mode 100644
index 9704ae9..0000000
--- a/src/protobuf/wkt/any_pb.nim
+++ /dev/null
@@ -1,109 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_Any* = ref google_protobuf_AnyObj
- google_protobuf_AnyObj* = object of RootObj
- hasField: IntSet
- type_url: string
- value: bytes
-
-proc newgoogle_protobuf_Any*(): google_protobuf_Any
-proc writegoogle_protobuf_Any*(stream: ProtobufStream, message: google_protobuf_Any)
-proc readgoogle_protobuf_Any*(stream: ProtobufStream): google_protobuf_Any
-proc sizeOfgoogle_protobuf_Any*(message: google_protobuf_Any): uint64
-
-proc newgoogle_protobuf_Any*(): google_protobuf_Any =
- new(result)
- result.hasField = initIntSet()
- result.type_url = ""
- result.value = bytes("")
-
-proc cleartype_url*(message: google_protobuf_Any) =
- message.type_url = ""
- excl(message.hasField, 1)
-
-proc hastype_url*(message: google_protobuf_Any): bool =
- result = contains(message.hasField, 1)
-
-proc settype_url*(message: google_protobuf_Any, value: string) =
- message.type_url = value
- incl(message.hasField, 1)
-
-proc type_url*(message: google_protobuf_Any): string {.inline.} =
- message.type_url
-
-proc `type_url=`*(message: google_protobuf_Any, value: string) {.inline.} =
- settype_url(message, value)
-
-proc clearvalue*(message: google_protobuf_Any) =
- message.value = bytes("")
- excl(message.hasField, 2)
-
-proc hasvalue*(message: google_protobuf_Any): bool =
- result = contains(message.hasField, 2)
-
-proc setvalue*(message: google_protobuf_Any, value: bytes) =
- message.value = value
- incl(message.hasField, 2)
-
-proc value*(message: google_protobuf_Any): bytes {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_Any, value: bytes) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_Any*(message: google_protobuf_Any): uint64 =
- if hastype_url(message):
- let
- sizeOfField = sizeOfString(message.type_url)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasvalue(message):
- let
- sizeOfField = sizeOfBytes(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Any*(stream: ProtobufStream, message: google_protobuf_Any) =
- if hastype_url(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.type_url)
- if hasvalue(message):
- writeTag(stream, 2, WireType.LengthDelimited)
- writeBytes(stream, message.value)
-
-proc readgoogle_protobuf_Any*(stream: ProtobufStream): google_protobuf_Any =
- result = newgoogle_protobuf_Any()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- settype_url(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- setvalue(result, readBytes(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Any): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Any(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Any*(data: string): google_protobuf_Any =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Any(pbs)
-
-
diff --git a/src/protobuf/wkt/api.proto b/src/protobuf/wkt/api.proto
deleted file mode 100644
index f37ee2f..0000000
--- a/src/protobuf/wkt/api.proto
+++ /dev/null
@@ -1,210 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-import "google/protobuf/source_context.proto";
-import "google/protobuf/type.proto";
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "ApiProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-option go_package = "google.golang.org/genproto/protobuf/api;api";
-
-// Api is a light-weight descriptor for an API Interface.
-//
-// Interfaces are also described as "protocol buffer services" in some contexts,
-// such as by the "service" keyword in a .proto file, but they are different
-// from API Services, which represent a concrete implementation of an interface
-// as opposed to simply a description of methods and bindings. They are also
-// sometimes simply referred to as "APIs" in other contexts, such as the name of
-// this message itself. See https://cloud.google.com/apis/design/glossary for
-// detailed terminology.
-message Api {
-
- // The fully qualified name of this interface, including package name
- // followed by the interface's simple name.
- string name = 1;
-
- // The methods of this interface, in unspecified order.
- repeated Method methods = 2;
-
- // Any metadata attached to the interface.
- repeated Option options = 3;
-
- // A version string for this interface. If specified, must have the form
- // `major-version.minor-version`, as in `1.10`. If the minor version is
- // omitted, it defaults to zero. If the entire version field is empty, the
- // major version is derived from the package name, as outlined below. If the
- // field is not empty, the version in the package name will be verified to be
- // consistent with what is provided here.
- //
- // The versioning schema uses [semantic
- // versioning](http://semver.org) where the major version number
- // indicates a breaking change and the minor version an additive,
- // non-breaking change. Both version numbers are signals to users
- // what to expect from different versions, and should be carefully
- // chosen based on the product plan.
- //
- // The major version is also reflected in the package name of the
- // interface, which must end in `v<major-version>`, as in
- // `google.feature.v1`. For major versions 0 and 1, the suffix can
- // be omitted. Zero major versions must only be used for
- // experimental, non-GA interfaces.
- //
- //
- string version = 4;
-
- // Source context for the protocol buffer service represented by this
- // message.
- SourceContext source_context = 5;
-
- // Included interfaces. See [Mixin][].
- repeated Mixin mixins = 6;
-
- // The source syntax of the service.
- Syntax syntax = 7;
-}
-
-// Method represents a method of an API interface.
-message Method {
-
- // The simple name of this method.
- string name = 1;
-
- // A URL of the input message type.
- string request_type_url = 2;
-
- // If true, the request is streamed.
- bool request_streaming = 3;
-
- // The URL of the output message type.
- string response_type_url = 4;
-
- // If true, the response is streamed.
- bool response_streaming = 5;
-
- // Any metadata attached to the method.
- repeated Option options = 6;
-
- // The source syntax of this method.
- Syntax syntax = 7;
-}
-
-// Declares an API Interface to be included in this interface. The including
-// interface must redeclare all the methods from the included interface, but
-// documentation and options are inherited as follows:
-//
-// - If after comment and whitespace stripping, the documentation
-// string of the redeclared method is empty, it will be inherited
-// from the original method.
-//
-// - Each annotation belonging to the service config (http,
-// visibility) which is not set in the redeclared method will be
-// inherited.
-//
-// - If an http annotation is inherited, the path pattern will be
-// modified as follows. Any version prefix will be replaced by the
-// version of the including interface plus the [root][] path if
-// specified.
-//
-// Example of a simple mixin:
-//
-// package google.acl.v1;
-// service AccessControl {
-// // Get the underlying ACL object.
-// rpc GetAcl(GetAclRequest) returns (Acl) {
-// option (google.api.http).get = "/v1/{resource=**}:getAcl";
-// }
-// }
-//
-// package google.storage.v2;
-// service Storage {
-// rpc GetAcl(GetAclRequest) returns (Acl);
-//
-// // Get a data record.
-// rpc GetData(GetDataRequest) returns (Data) {
-// option (google.api.http).get = "/v2/{resource=**}";
-// }
-// }
-//
-// Example of a mixin configuration:
-//
-// apis:
-// - name: google.storage.v2.Storage
-// mixins:
-// - name: google.acl.v1.AccessControl
-//
-// The mixin construct implies that all methods in `AccessControl` are
-// also declared with same name and request/response types in
-// `Storage`. A documentation generator or annotation processor will
-// see the effective `Storage.GetAcl` method after inherting
-// documentation and annotations as follows:
-//
-// service Storage {
-// // Get the underlying ACL object.
-// rpc GetAcl(GetAclRequest) returns (Acl) {
-// option (google.api.http).get = "/v2/{resource=**}:getAcl";
-// }
-// ...
-// }
-//
-// Note how the version in the path pattern changed from `v1` to `v2`.
-//
-// If the `root` field in the mixin is specified, it should be a
-// relative path under which inherited HTTP paths are placed. Example:
-//
-// apis:
-// - name: google.storage.v2.Storage
-// mixins:
-// - name: google.acl.v1.AccessControl
-// root: acls
-//
-// This implies the following inherited HTTP annotation:
-//
-// service Storage {
-// // Get the underlying ACL object.
-// rpc GetAcl(GetAclRequest) returns (Acl) {
-// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
-// }
-// ...
-// }
-message Mixin {
- // The fully qualified name of the interface which is included.
- string name = 1;
-
- // If non-empty specifies a path under which inherited HTTP paths
- // are rooted.
- string root = 2;
-}
diff --git a/src/protobuf/wkt/api_pb.nim b/src/protobuf/wkt/api_pb.nim
deleted file mode 100644
index c6ca312..0000000
--- a/src/protobuf/wkt/api_pb.nim
+++ /dev/null
@@ -1,664 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-import protobuf/wkt/source_context_pb
-import protobuf/wkt/type_pb
-
-type
- google_protobuf_Api* = ref google_protobuf_ApiObj
- google_protobuf_ApiObj* = object of RootObj
- hasField: IntSet
- name: string
- methods: seq[google_protobuf_Method]
- options: seq[google_protobuf_Option]
- version: string
- source_context: google_protobuf_SourceContext
- mixins: seq[google_protobuf_Mixin]
- syntax: google_protobuf_Syntax
- google_protobuf_Method* = ref google_protobuf_MethodObj
- google_protobuf_MethodObj* = object of RootObj
- hasField: IntSet
- name: string
- request_type_url: string
- request_streaming: bool
- response_type_url: string
- response_streaming: bool
- options: seq[google_protobuf_Option]
- syntax: google_protobuf_Syntax
- google_protobuf_Mixin* = ref google_protobuf_MixinObj
- google_protobuf_MixinObj* = object of RootObj
- hasField: IntSet
- name: string
- root: string
-
-proc newgoogle_protobuf_Method*(): google_protobuf_Method
-proc writegoogle_protobuf_Method*(stream: ProtobufStream, message: google_protobuf_Method)
-proc readgoogle_protobuf_Method*(stream: ProtobufStream): google_protobuf_Method
-proc sizeOfgoogle_protobuf_Method*(message: google_protobuf_Method): uint64
-
-proc newgoogle_protobuf_Mixin*(): google_protobuf_Mixin
-proc writegoogle_protobuf_Mixin*(stream: ProtobufStream, message: google_protobuf_Mixin)
-proc readgoogle_protobuf_Mixin*(stream: ProtobufStream): google_protobuf_Mixin
-proc sizeOfgoogle_protobuf_Mixin*(message: google_protobuf_Mixin): uint64
-
-proc newgoogle_protobuf_Api*(): google_protobuf_Api
-proc writegoogle_protobuf_Api*(stream: ProtobufStream, message: google_protobuf_Api)
-proc readgoogle_protobuf_Api*(stream: ProtobufStream): google_protobuf_Api
-proc sizeOfgoogle_protobuf_Api*(message: google_protobuf_Api): uint64
-
-proc newgoogle_protobuf_Method*(): google_protobuf_Method =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.request_type_url = ""
- result.request_streaming = false
- result.response_type_url = ""
- result.response_streaming = false
- result.options = @[]
- result.syntax = google_protobuf_Syntax(0)
-
-proc clearname*(message: google_protobuf_Method) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Method, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Method): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Method, value: string) {.inline.} =
- setname(message, value)
-
-proc clearrequest_type_url*(message: google_protobuf_Method) =
- message.request_type_url = ""
- excl(message.hasField, 2)
-
-proc hasrequest_type_url*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 2)
-
-proc setrequest_type_url*(message: google_protobuf_Method, value: string) =
- message.request_type_url = value
- incl(message.hasField, 2)
-
-proc request_type_url*(message: google_protobuf_Method): string {.inline.} =
- message.request_type_url
-
-proc `request_type_url=`*(message: google_protobuf_Method, value: string) {.inline.} =
- setrequest_type_url(message, value)
-
-proc clearrequest_streaming*(message: google_protobuf_Method) =
- message.request_streaming = false
- excl(message.hasField, 3)
-
-proc hasrequest_streaming*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 3)
-
-proc setrequest_streaming*(message: google_protobuf_Method, value: bool) =
- message.request_streaming = value
- incl(message.hasField, 3)
-
-proc request_streaming*(message: google_protobuf_Method): bool {.inline.} =
- message.request_streaming
-
-proc `request_streaming=`*(message: google_protobuf_Method, value: bool) {.inline.} =
- setrequest_streaming(message, value)
-
-proc clearresponse_type_url*(message: google_protobuf_Method) =
- message.response_type_url = ""
- excl(message.hasField, 4)
-
-proc hasresponse_type_url*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 4)
-
-proc setresponse_type_url*(message: google_protobuf_Method, value: string) =
- message.response_type_url = value
- incl(message.hasField, 4)
-
-proc response_type_url*(message: google_protobuf_Method): string {.inline.} =
- message.response_type_url
-
-proc `response_type_url=`*(message: google_protobuf_Method, value: string) {.inline.} =
- setresponse_type_url(message, value)
-
-proc clearresponse_streaming*(message: google_protobuf_Method) =
- message.response_streaming = false
- excl(message.hasField, 5)
-
-proc hasresponse_streaming*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 5)
-
-proc setresponse_streaming*(message: google_protobuf_Method, value: bool) =
- message.response_streaming = value
- incl(message.hasField, 5)
-
-proc response_streaming*(message: google_protobuf_Method): bool {.inline.} =
- message.response_streaming
-
-proc `response_streaming=`*(message: google_protobuf_Method, value: bool) {.inline.} =
- setresponse_streaming(message, value)
-
-proc clearoptions*(message: google_protobuf_Method) =
- message.options = @[]
- excl(message.hasField, 6)
-
-proc hasoptions*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 6)
-
-proc setoptions*(message: google_protobuf_Method, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 6)
-
-proc addoptions*(message: google_protobuf_Method, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 6)
-
-proc options*(message: google_protobuf_Method): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_Method, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc clearsyntax*(message: google_protobuf_Method) =
- message.syntax = google_protobuf_Syntax(0)
- excl(message.hasField, 7)
-
-proc hassyntax*(message: google_protobuf_Method): bool =
- result = contains(message.hasField, 7)
-
-proc setsyntax*(message: google_protobuf_Method, value: google_protobuf_Syntax) =
- message.syntax = value
- incl(message.hasField, 7)
-
-proc syntax*(message: google_protobuf_Method): google_protobuf_Syntax {.inline.} =
- message.syntax
-
-proc `syntax=`*(message: google_protobuf_Method, value: google_protobuf_Syntax) {.inline.} =
- setsyntax(message, value)
-
-proc sizeOfgoogle_protobuf_Method*(message: google_protobuf_Method): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasrequest_type_url(message):
- let
- sizeOfField = sizeOfString(message.request_type_url)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasrequest_streaming(message):
- let
- sizeOfField = sizeOfBool(message.request_streaming)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasresponse_type_url(message):
- let
- sizeOfField = sizeOfString(message.response_type_url)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasresponse_streaming(message):
- let
- sizeOfField = sizeOfBool(message.response_streaming)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(5, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(6, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hassyntax(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Syntax(message.syntax)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(7, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Method*(stream: ProtobufStream, message: google_protobuf_Method) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- if hasrequest_type_url(message):
- writeTag(stream, 2, WireType.LengthDelimited)
- writeString(stream, message.request_type_url)
- if hasrequest_streaming(message):
- writeTag(stream, 3, WireType.Varint)
- writeBool(stream, message.request_streaming)
- if hasresponse_type_url(message):
- writeTag(stream, 4, WireType.LengthDelimited)
- writeString(stream, message.response_type_url)
- if hasresponse_streaming(message):
- writeTag(stream, 5, WireType.Varint)
- writeBool(stream, message.response_streaming)
- for value in message.options:
- writeTag(stream, 6, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
- if hassyntax(message):
- writeTag(stream, 7, WireType.Varint)
- writegoogle_protobuf_Syntax(stream, message.syntax)
-
-proc readgoogle_protobuf_Method*(stream: ProtobufStream): google_protobuf_Method =
- result = newgoogle_protobuf_Method()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- setrequest_type_url(result, readString(stream))
- of 3:
- expectWireType(wireType, WireType.Varint)
- setrequest_streaming(result, readBool(stream))
- of 4:
- expectWireType(wireType, WireType.LengthDelimited)
- setresponse_type_url(result, readString(stream))
- of 5:
- expectWireType(wireType, WireType.Varint)
- setresponse_streaming(result, readBool(stream))
- of 6:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- of 7:
- expectWireType(wireType, WireType.Varint)
- setsyntax(result, readgoogle_protobuf_Syntax(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Method): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Method(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Method*(data: string): google_protobuf_Method =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Method(pbs)
-
-
-proc newgoogle_protobuf_Mixin*(): google_protobuf_Mixin =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.root = ""
-
-proc clearname*(message: google_protobuf_Mixin) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Mixin): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Mixin, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Mixin): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Mixin, value: string) {.inline.} =
- setname(message, value)
-
-proc clearroot*(message: google_protobuf_Mixin) =
- message.root = ""
- excl(message.hasField, 2)
-
-proc hasroot*(message: google_protobuf_Mixin): bool =
- result = contains(message.hasField, 2)
-
-proc setroot*(message: google_protobuf_Mixin, value: string) =
- message.root = value
- incl(message.hasField, 2)
-
-proc root*(message: google_protobuf_Mixin): string {.inline.} =
- message.root
-
-proc `root=`*(message: google_protobuf_Mixin, value: string) {.inline.} =
- setroot(message, value)
-
-proc sizeOfgoogle_protobuf_Mixin*(message: google_protobuf_Mixin): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasroot(message):
- let
- sizeOfField = sizeOfString(message.root)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Mixin*(stream: ProtobufStream, message: google_protobuf_Mixin) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- if hasroot(message):
- writeTag(stream, 2, WireType.LengthDelimited)
- writeString(stream, message.root)
-
-proc readgoogle_protobuf_Mixin*(stream: ProtobufStream): google_protobuf_Mixin =
- result = newgoogle_protobuf_Mixin()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- setroot(result, readString(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Mixin): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Mixin(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Mixin*(data: string): google_protobuf_Mixin =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Mixin(pbs)
-
-
-proc newgoogle_protobuf_Api*(): google_protobuf_Api =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.methods = @[]
- result.options = @[]
- result.version = ""
- result.source_context = nil
- result.mixins = @[]
- result.syntax = google_protobuf_Syntax(0)
-
-proc clearname*(message: google_protobuf_Api) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Api, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Api): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Api, value: string) {.inline.} =
- setname(message, value)
-
-proc clearmethods*(message: google_protobuf_Api) =
- message.methods = @[]
- excl(message.hasField, 2)
-
-proc hasmethods*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 2)
-
-proc setmethods*(message: google_protobuf_Api, value: seq[google_protobuf_Method]) =
- message.methods = value
- incl(message.hasField, 2)
-
-proc addmethods*(message: google_protobuf_Api, value: google_protobuf_Method) =
- add(message.methods, value)
- incl(message.hasField, 2)
-
-proc methods*(message: google_protobuf_Api): seq[google_protobuf_Method] {.inline.} =
- message.methods
-
-proc `methods=`*(message: google_protobuf_Api, value: seq[google_protobuf_Method]) {.inline.} =
- setmethods(message, value)
-
-proc clearoptions*(message: google_protobuf_Api) =
- message.options = @[]
- excl(message.hasField, 3)
-
-proc hasoptions*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 3)
-
-proc setoptions*(message: google_protobuf_Api, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 3)
-
-proc addoptions*(message: google_protobuf_Api, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 3)
-
-proc options*(message: google_protobuf_Api): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_Api, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc clearversion*(message: google_protobuf_Api) =
- message.version = ""
- excl(message.hasField, 4)
-
-proc hasversion*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 4)
-
-proc setversion*(message: google_protobuf_Api, value: string) =
- message.version = value
- incl(message.hasField, 4)
-
-proc version*(message: google_protobuf_Api): string {.inline.} =
- message.version
-
-proc `version=`*(message: google_protobuf_Api, value: string) {.inline.} =
- setversion(message, value)
-
-proc clearsource_context*(message: google_protobuf_Api) =
- message.source_context = nil
- excl(message.hasField, 5)
-
-proc hassource_context*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 5)
-
-proc setsource_context*(message: google_protobuf_Api, value: google_protobuf_SourceContext) =
- message.source_context = value
- incl(message.hasField, 5)
-
-proc source_context*(message: google_protobuf_Api): google_protobuf_SourceContext {.inline.} =
- message.source_context
-
-proc `source_context=`*(message: google_protobuf_Api, value: google_protobuf_SourceContext) {.inline.} =
- setsource_context(message, value)
-
-proc clearmixins*(message: google_protobuf_Api) =
- message.mixins = @[]
- excl(message.hasField, 6)
-
-proc hasmixins*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 6)
-
-proc setmixins*(message: google_protobuf_Api, value: seq[google_protobuf_Mixin]) =
- message.mixins = value
- incl(message.hasField, 6)
-
-proc addmixins*(message: google_protobuf_Api, value: google_protobuf_Mixin) =
- add(message.mixins, value)
- incl(message.hasField, 6)
-
-proc mixins*(message: google_protobuf_Api): seq[google_protobuf_Mixin] {.inline.} =
- message.mixins
-
-proc `mixins=`*(message: google_protobuf_Api, value: seq[google_protobuf_Mixin]) {.inline.} =
- setmixins(message, value)
-
-proc clearsyntax*(message: google_protobuf_Api) =
- message.syntax = google_protobuf_Syntax(0)
- excl(message.hasField, 7)
-
-proc hassyntax*(message: google_protobuf_Api): bool =
- result = contains(message.hasField, 7)
-
-proc setsyntax*(message: google_protobuf_Api, value: google_protobuf_Syntax) =
- message.syntax = value
- incl(message.hasField, 7)
-
-proc syntax*(message: google_protobuf_Api): google_protobuf_Syntax {.inline.} =
- message.syntax
-
-proc `syntax=`*(message: google_protobuf_Api, value: google_protobuf_Syntax) {.inline.} =
- setsyntax(message, value)
-
-proc sizeOfgoogle_protobuf_Api*(message: google_protobuf_Api): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- for value in message.methods:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Method(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hasversion(message):
- let
- sizeOfField = sizeOfString(message.version)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hassource_context(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_SourceContext(message.source_context)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(5, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
- for value in message.mixins:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Mixin(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(6, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hassyntax(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Syntax(message.syntax)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(7, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Api*(stream: ProtobufStream, message: google_protobuf_Api) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- for value in message.methods:
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Method(value))
- writegoogle_protobuf_Method(stream, value)
- for value in message.options:
- writeTag(stream, 3, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
- if hasversion(message):
- writeTag(stream, 4, WireType.LengthDelimited)
- writeString(stream, message.version)
- if hassource_context(message):
- writeTag(stream, 5, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_SourceContext(message.source_context))
- writegoogle_protobuf_SourceContext(stream, message.source_context)
- for value in message.mixins:
- writeTag(stream, 6, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Mixin(value))
- writegoogle_protobuf_Mixin(stream, value)
- if hassyntax(message):
- writeTag(stream, 7, WireType.Varint)
- writegoogle_protobuf_Syntax(stream, message.syntax)
-
-proc readgoogle_protobuf_Api*(stream: ProtobufStream): google_protobuf_Api =
- result = newgoogle_protobuf_Api()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addmethods(result, readgoogle_protobuf_Method(pbs))
- of 3:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- of 4:
- expectWireType(wireType, WireType.LengthDelimited)
- setversion(result, readString(stream))
- of 5:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setsource_context(result, readgoogle_protobuf_SourceContext(pbs))
- of 6:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addmixins(result, readgoogle_protobuf_Mixin(pbs))
- of 7:
- expectWireType(wireType, WireType.Varint)
- setsyntax(result, readgoogle_protobuf_Syntax(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Api): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Api(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Api*(data: string): google_protobuf_Api =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Api(pbs)
-
-
diff --git a/src/protobuf/wkt/duration.proto b/src/protobuf/wkt/duration.proto
deleted file mode 100644
index 975fce4..0000000
--- a/src/protobuf/wkt/duration.proto
+++ /dev/null
@@ -1,117 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/duration";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "DurationProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// A Duration represents a signed, fixed-length span of time represented
-// as a count of seconds and fractions of seconds at nanosecond
-// resolution. It is independent of any calendar and concepts like "day"
-// or "month". It is related to Timestamp in that the difference between
-// two Timestamp values is a Duration and it can be added or subtracted
-// from a Timestamp. Range is approximately +-10,000 years.
-//
-// # Examples
-//
-// Example 1: Compute Duration from two Timestamps in pseudo code.
-//
-// Timestamp start = ...;
-// Timestamp end = ...;
-// Duration duration = ...;
-//
-// duration.seconds = end.seconds - start.seconds;
-// duration.nanos = end.nanos - start.nanos;
-//
-// if (duration.seconds < 0 && duration.nanos > 0) {
-// duration.seconds += 1;
-// duration.nanos -= 1000000000;
-// } else if (durations.seconds > 0 && duration.nanos < 0) {
-// duration.seconds -= 1;
-// duration.nanos += 1000000000;
-// }
-//
-// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
-//
-// Timestamp start = ...;
-// Duration duration = ...;
-// Timestamp end = ...;
-//
-// end.seconds = start.seconds + duration.seconds;
-// end.nanos = start.nanos + duration.nanos;
-//
-// if (end.nanos < 0) {
-// end.seconds -= 1;
-// end.nanos += 1000000000;
-// } else if (end.nanos >= 1000000000) {
-// end.seconds += 1;
-// end.nanos -= 1000000000;
-// }
-//
-// Example 3: Compute Duration from datetime.timedelta in Python.
-//
-// td = datetime.timedelta(days=3, minutes=10)
-// duration = Duration()
-// duration.FromTimedelta(td)
-//
-// # JSON Mapping
-//
-// In JSON format, the Duration type is encoded as a string rather than an
-// object, where the string ends in the suffix "s" (indicating seconds) and
-// is preceded by the number of seconds, with nanoseconds expressed as
-// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
-// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
-// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
-// microsecond should be expressed in JSON format as "3.000001s".
-//
-//
-message Duration {
-
- // Signed seconds of the span of time. Must be from -315,576,000,000
- // to +315,576,000,000 inclusive. Note: these bounds are computed from:
- // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- int64 seconds = 1;
-
- // Signed fractions of a second at nanosecond resolution of the span
- // of time. Durations less than one second are represented with a 0
- // `seconds` field and a positive or negative `nanos` field. For durations
- // of one second or more, a non-zero value for the `nanos` field must be
- // of the same sign as the `seconds` field. Must be from -999,999,999
- // to +999,999,999 inclusive.
- int32 nanos = 2;
-}
diff --git a/src/protobuf/wkt/duration_pb.nim b/src/protobuf/wkt/duration_pb.nim
deleted file mode 100644
index 1c72ec4..0000000
--- a/src/protobuf/wkt/duration_pb.nim
+++ /dev/null
@@ -1,109 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_Duration* = ref google_protobuf_DurationObj
- google_protobuf_DurationObj* = object of RootObj
- hasField: IntSet
- seconds: int64
- nanos: int32
-
-proc newgoogle_protobuf_Duration*(): google_protobuf_Duration
-proc writegoogle_protobuf_Duration*(stream: ProtobufStream, message: google_protobuf_Duration)
-proc readgoogle_protobuf_Duration*(stream: ProtobufStream): google_protobuf_Duration
-proc sizeOfgoogle_protobuf_Duration*(message: google_protobuf_Duration): uint64
-
-proc newgoogle_protobuf_Duration*(): google_protobuf_Duration =
- new(result)
- result.hasField = initIntSet()
- result.seconds = 0
- result.nanos = 0
-
-proc clearseconds*(message: google_protobuf_Duration) =
- message.seconds = 0
- excl(message.hasField, 1)
-
-proc hasseconds*(message: google_protobuf_Duration): bool =
- result = contains(message.hasField, 1)
-
-proc setseconds*(message: google_protobuf_Duration, value: int64) =
- message.seconds = value
- incl(message.hasField, 1)
-
-proc seconds*(message: google_protobuf_Duration): int64 {.inline.} =
- message.seconds
-
-proc `seconds=`*(message: google_protobuf_Duration, value: int64) {.inline.} =
- setseconds(message, value)
-
-proc clearnanos*(message: google_protobuf_Duration) =
- message.nanos = 0
- excl(message.hasField, 2)
-
-proc hasnanos*(message: google_protobuf_Duration): bool =
- result = contains(message.hasField, 2)
-
-proc setnanos*(message: google_protobuf_Duration, value: int32) =
- message.nanos = value
- incl(message.hasField, 2)
-
-proc nanos*(message: google_protobuf_Duration): int32 {.inline.} =
- message.nanos
-
-proc `nanos=`*(message: google_protobuf_Duration, value: int32) {.inline.} =
- setnanos(message, value)
-
-proc sizeOfgoogle_protobuf_Duration*(message: google_protobuf_Duration): uint64 =
- if hasseconds(message):
- let
- sizeOfField = sizeOfInt64(message.seconds)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasnanos(message):
- let
- sizeOfField = sizeOfInt32(message.nanos)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Duration*(stream: ProtobufStream, message: google_protobuf_Duration) =
- if hasseconds(message):
- writeTag(stream, 1, WireType.Varint)
- writeInt64(stream, message.seconds)
- if hasnanos(message):
- writeTag(stream, 2, WireType.Varint)
- writeInt32(stream, message.nanos)
-
-proc readgoogle_protobuf_Duration*(stream: ProtobufStream): google_protobuf_Duration =
- result = newgoogle_protobuf_Duration()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setseconds(result, readInt64(stream))
- of 2:
- expectWireType(wireType, WireType.Varint)
- setnanos(result, readInt32(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Duration): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Duration(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Duration*(data: string): google_protobuf_Duration =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Duration(pbs)
-
-
diff --git a/src/protobuf/wkt/empty.proto b/src/protobuf/wkt/empty.proto
deleted file mode 100644
index 03cacd2..0000000
--- a/src/protobuf/wkt/empty.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option go_package = "github.com/golang/protobuf/ptypes/empty";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "EmptyProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-option cc_enable_arenas = true;
-
-// A generic empty message that you can re-use to avoid defining duplicated
-// empty messages in your APIs. A typical example is to use it as the request
-// or the response type of an API method. For instance:
-//
-// service Foo {
-// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
-// }
-//
-// The JSON representation for `Empty` is empty JSON object `{}`.
-message Empty {}
diff --git a/src/protobuf/wkt/empty_pb.nim b/src/protobuf/wkt/empty_pb.nim
deleted file mode 100644
index 83885f4..0000000
--- a/src/protobuf/wkt/empty_pb.nim
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_Empty* = ref google_protobuf_EmptyObj
- google_protobuf_EmptyObj* = object of RootObj
- hasField: IntSet
-
-proc newgoogle_protobuf_Empty*(): google_protobuf_Empty
-proc writegoogle_protobuf_Empty*(stream: ProtobufStream, message: google_protobuf_Empty)
-proc readgoogle_protobuf_Empty*(stream: ProtobufStream): google_protobuf_Empty
-proc sizeOfgoogle_protobuf_Empty*(message: google_protobuf_Empty): uint64
-
-proc newgoogle_protobuf_Empty*(): google_protobuf_Empty =
- new(result)
- result.hasField = initIntSet()
-
-proc sizeOfgoogle_protobuf_Empty*(message: google_protobuf_Empty): uint64 =
- result = 0
-
-proc writegoogle_protobuf_Empty*(stream: ProtobufStream, message: google_protobuf_Empty) =
- discard
-
-proc readgoogle_protobuf_Empty*(stream: ProtobufStream): google_protobuf_Empty =
- result = newgoogle_protobuf_Empty()
-
-proc serialize*(message: google_protobuf_Empty): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Empty(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Empty*(data: string): google_protobuf_Empty =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Empty(pbs)
-
-
diff --git a/src/protobuf/wkt/field_mask.proto b/src/protobuf/wkt/field_mask.proto
deleted file mode 100644
index c68d247..0000000
--- a/src/protobuf/wkt/field_mask.proto
+++ /dev/null
@@ -1,246 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "FieldMaskProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
-
-// `FieldMask` represents a set of symbolic field paths, for example:
-//
-// paths: "f.a"
-// paths: "f.b.d"
-//
-// Here `f` represents a field in some root message, `a` and `b`
-// fields in the message found in `f`, and `d` a field found in the
-// message in `f.b`.
-//
-// Field masks are used to specify a subset of fields that should be
-// returned by a get operation or modified by an update operation.
-// Field masks also have a custom JSON encoding (see below).
-//
-// # Field Masks in Projections
-//
-// When used in the context of a projection, a response message or
-// sub-message is filtered by the API to only contain those fields as
-// specified in the mask. For example, if the mask in the previous
-// example is applied to a response message as follows:
-//
-// f {
-// a : 22
-// b {
-// d : 1
-// x : 2
-// }
-// y : 13
-// }
-// z: 8
-//
-// The result will not contain specific values for fields x,y and z
-// (their value will be set to the default, and omitted in proto text
-// output):
-//
-//
-// f {
-// a : 22
-// b {
-// d : 1
-// }
-// }
-//
-// A repeated field is not allowed except at the last position of a
-// paths string.
-//
-// If a FieldMask object is not present in a get operation, the
-// operation applies to all fields (as if a FieldMask of all fields
-// had been specified).
-//
-// Note that a field mask does not necessarily apply to the
-// top-level response message. In case of a REST get operation, the
-// field mask applies directly to the response, but in case of a REST
-// list operation, the mask instead applies to each individual message
-// in the returned resource list. In case of a REST custom method,
-// other definitions may be used. Where the mask applies will be
-// clearly documented together with its declaration in the API. In
-// any case, the effect on the returned resource/resources is required
-// behavior for APIs.
-//
-// # Field Masks in Update Operations
-//
-// A field mask in update operations specifies which fields of the
-// targeted resource are going to be updated. The API is required
-// to only change the values of the fields as specified in the mask
-// and leave the others untouched. If a resource is passed in to
-// describe the updated values, the API ignores the values of all
-// fields not covered by the mask.
-//
-// If a repeated field is specified for an update operation, the existing
-// repeated values in the target resource will be overwritten by the new values.
-// Note that a repeated field is only allowed in the last position of a `paths`
-// string.
-//
-// If a sub-message is specified in the last position of the field mask for an
-// update operation, then the existing sub-message in the target resource is
-// overwritten. Given the target message:
-//
-// f {
-// b {
-// d : 1
-// x : 2
-// }
-// c : 1
-// }
-//
-// And an update message:
-//
-// f {
-// b {
-// d : 10
-// }
-// }
-//
-// then if the field mask is:
-//
-// paths: "f.b"
-//
-// then the result will be:
-//
-// f {
-// b {
-// d : 10
-// }
-// c : 1
-// }
-//
-// However, if the update mask was:
-//
-// paths: "f.b.d"
-//
-// then the result would be:
-//
-// f {
-// b {
-// d : 10
-// x : 2
-// }
-// c : 1
-// }
-//
-// In order to reset a field's value to the default, the field must
-// be in the mask and set to the default value in the provided resource.
-// Hence, in order to reset all fields of a resource, provide a default
-// instance of the resource and set all fields in the mask, or do
-// not provide a mask as described below.
-//
-// If a field mask is not present on update, the operation applies to
-// all fields (as if a field mask of all fields has been specified).
-// Note that in the presence of schema evolution, this may mean that
-// fields the client does not know and has therefore not filled into
-// the request will be reset to their default. If this is unwanted
-// behavior, a specific service may require a client to always specify
-// a field mask, producing an error if not.
-//
-// As with get operations, the location of the resource which
-// describes the updated values in the request message depends on the
-// operation kind. In any case, the effect of the field mask is
-// required to be honored by the API.
-//
-// ## Considerations for HTTP REST
-//
-// The HTTP kind of an update operation which uses a field mask must
-// be set to PATCH instead of PUT in order to satisfy HTTP semantics
-// (PUT must only be used for full updates).
-//
-// # JSON Encoding of Field Masks
-//
-// In JSON, a field mask is encoded as a single string where paths are
-// separated by a comma. Fields name in each path are converted
-// to/from lower-camel naming conventions.
-//
-// As an example, consider the following message declarations:
-//
-// message Profile {
-// User user = 1;
-// Photo photo = 2;
-// }
-// message User {
-// string display_name = 1;
-// string address = 2;
-// }
-//
-// In proto a field mask for `Profile` may look as such:
-//
-// mask {
-// paths: "user.display_name"
-// paths: "photo"
-// }
-//
-// In JSON, the same mask is represented as below:
-//
-// {
-// mask: "user.displayName,photo"
-// }
-//
-// # Field Masks and Oneof Fields
-//
-// Field masks treat fields in oneofs just as regular fields. Consider the
-// following message:
-//
-// message SampleMessage {
-// oneof test_oneof {
-// string name = 4;
-// SubMessage sub_message = 9;
-// }
-// }
-//
-// The field mask can be:
-//
-// mask {
-// paths: "name"
-// }
-//
-// Or:
-//
-// mask {
-// paths: "sub_message"
-// }
-//
-// Note that oneof type names ("test_oneof" in this case) cannot be used in
-// paths.
-message FieldMask {
- // The set of field mask paths.
- repeated string paths = 1;
-}
diff --git a/src/protobuf/wkt/field_mask_pb.nim b/src/protobuf/wkt/field_mask_pb.nim
deleted file mode 100644
index cb38f30..0000000
--- a/src/protobuf/wkt/field_mask_pb.nim
+++ /dev/null
@@ -1,84 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_FieldMask* = ref google_protobuf_FieldMaskObj
- google_protobuf_FieldMaskObj* = object of RootObj
- hasField: IntSet
- paths: seq[string]
-
-proc newgoogle_protobuf_FieldMask*(): google_protobuf_FieldMask
-proc writegoogle_protobuf_FieldMask*(stream: ProtobufStream, message: google_protobuf_FieldMask)
-proc readgoogle_protobuf_FieldMask*(stream: ProtobufStream): google_protobuf_FieldMask
-proc sizeOfgoogle_protobuf_FieldMask*(message: google_protobuf_FieldMask): uint64
-
-proc newgoogle_protobuf_FieldMask*(): google_protobuf_FieldMask =
- new(result)
- result.hasField = initIntSet()
- result.paths = @[]
-
-proc clearpaths*(message: google_protobuf_FieldMask) =
- message.paths = @[]
- excl(message.hasField, 1)
-
-proc haspaths*(message: google_protobuf_FieldMask): bool =
- result = contains(message.hasField, 1)
-
-proc setpaths*(message: google_protobuf_FieldMask, value: seq[string]) =
- message.paths = value
- incl(message.hasField, 1)
-
-proc addpaths*(message: google_protobuf_FieldMask, value: string) =
- add(message.paths, value)
- incl(message.hasField, 1)
-
-proc paths*(message: google_protobuf_FieldMask): seq[string] {.inline.} =
- message.paths
-
-proc `paths=`*(message: google_protobuf_FieldMask, value: seq[string]) {.inline.} =
- setpaths(message, value)
-
-proc sizeOfgoogle_protobuf_FieldMask*(message: google_protobuf_FieldMask): uint64 =
- for value in message.paths:
- let
- sizeOfValue = sizeOfString(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
-
-proc writegoogle_protobuf_FieldMask*(stream: ProtobufStream, message: google_protobuf_FieldMask) =
- for value in message.paths:
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, value)
-
-proc readgoogle_protobuf_FieldMask*(stream: ProtobufStream): google_protobuf_FieldMask =
- result = newgoogle_protobuf_FieldMask()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- addpaths(result, readString(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_FieldMask): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_FieldMask(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_FieldMask*(data: string): google_protobuf_FieldMask =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_FieldMask(pbs)
-
-
diff --git a/src/protobuf/wkt/source_context.proto b/src/protobuf/wkt/source_context.proto
deleted file mode 100644
index f3b2c96..0000000
--- a/src/protobuf/wkt/source_context.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "SourceContextProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-option go_package = "google.golang.org/genproto/protobuf/source_context;source_context";
-
-// `SourceContext` represents information about the source of a
-// protobuf element, like the file in which it is defined.
-message SourceContext {
- // The path-qualified name of the .proto file that contained the associated
- // protobuf element. For example: `"google/protobuf/source_context.proto"`.
- string file_name = 1;
-}
diff --git a/src/protobuf/wkt/source_context_pb.nim b/src/protobuf/wkt/source_context_pb.nim
deleted file mode 100644
index 1fa135b..0000000
--- a/src/protobuf/wkt/source_context_pb.nim
+++ /dev/null
@@ -1,79 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_SourceContext* = ref google_protobuf_SourceContextObj
- google_protobuf_SourceContextObj* = object of RootObj
- hasField: IntSet
- file_name: string
-
-proc newgoogle_protobuf_SourceContext*(): google_protobuf_SourceContext
-proc writegoogle_protobuf_SourceContext*(stream: ProtobufStream, message: google_protobuf_SourceContext)
-proc readgoogle_protobuf_SourceContext*(stream: ProtobufStream): google_protobuf_SourceContext
-proc sizeOfgoogle_protobuf_SourceContext*(message: google_protobuf_SourceContext): uint64
-
-proc newgoogle_protobuf_SourceContext*(): google_protobuf_SourceContext =
- new(result)
- result.hasField = initIntSet()
- result.file_name = ""
-
-proc clearfile_name*(message: google_protobuf_SourceContext) =
- message.file_name = ""
- excl(message.hasField, 1)
-
-proc hasfile_name*(message: google_protobuf_SourceContext): bool =
- result = contains(message.hasField, 1)
-
-proc setfile_name*(message: google_protobuf_SourceContext, value: string) =
- message.file_name = value
- incl(message.hasField, 1)
-
-proc file_name*(message: google_protobuf_SourceContext): string {.inline.} =
- message.file_name
-
-proc `file_name=`*(message: google_protobuf_SourceContext, value: string) {.inline.} =
- setfile_name(message, value)
-
-proc sizeOfgoogle_protobuf_SourceContext*(message: google_protobuf_SourceContext): uint64 =
- if hasfile_name(message):
- let
- sizeOfField = sizeOfString(message.file_name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_SourceContext*(stream: ProtobufStream, message: google_protobuf_SourceContext) =
- if hasfile_name(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.file_name)
-
-proc readgoogle_protobuf_SourceContext*(stream: ProtobufStream): google_protobuf_SourceContext =
- result = newgoogle_protobuf_SourceContext()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setfile_name(result, readString(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_SourceContext): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_SourceContext(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_SourceContext*(data: string): google_protobuf_SourceContext =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_SourceContext(pbs)
-
-
diff --git a/src/protobuf/wkt/struct.proto b/src/protobuf/wkt/struct.proto
deleted file mode 100644
index 7d7808e..0000000
--- a/src/protobuf/wkt/struct.proto
+++ /dev/null
@@ -1,96 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "StructProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-
-// `Struct` represents a structured data value, consisting of fields
-// which map to dynamically typed values. In some languages, `Struct`
-// might be supported by a native representation. For example, in
-// scripting languages like JS a struct is represented as an
-// object. The details of that representation are described together
-// with the proto support for the language.
-//
-// The JSON representation for `Struct` is JSON object.
-message Struct {
- // Unordered map of dynamically typed values.
- map<string, Value> fields = 1;
-}
-
-// `Value` represents a dynamically typed value which can be either
-// null, a number, a string, a boolean, a recursive struct value, or a
-// list of values. A producer of value is expected to set one of that
-// variants, absence of any variant indicates an error.
-//
-// The JSON representation for `Value` is JSON value.
-message Value {
- // The kind of value.
- oneof kind {
- // Represents a null value.
- NullValue null_value = 1;
- // Represents a double value.
- double number_value = 2;
- // Represents a string value.
- string string_value = 3;
- // Represents a boolean value.
- bool bool_value = 4;
- // Represents a structured value.
- Struct struct_value = 5;
- // Represents a repeated `Value`.
- ListValue list_value = 6;
- }
-}
-
-// `NullValue` is a singleton enumeration to represent the null value for the
-// `Value` type union.
-//
-// The JSON representation for `NullValue` is JSON `null`.
-enum NullValue {
- // Null value.
- NULL_VALUE = 0;
-}
-
-// `ListValue` is a wrapper around a repeated field of values.
-//
-// The JSON representation for `ListValue` is JSON array.
-message ListValue {
- // Repeated field of dynamically typed values.
- repeated Value values = 1;
-}
diff --git a/src/protobuf/wkt/struct_pb.nim b/src/protobuf/wkt/struct_pb.nim
deleted file mode 100644
index bf3f07d..0000000
--- a/src/protobuf/wkt/struct_pb.nim
+++ /dev/null
@@ -1,629 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-import tables
-export tables
-
-import protobuf/protobuf
-
-type
- google_protobuf_NullValue* {.pure.} = enum
- NULL_VALUE = 0
- google_protobuf_Struct* = ref google_protobuf_StructObj
- google_protobuf_StructObj* = object of RootObj
- hasField: IntSet
- fields: TableRef[string, google_protobuf_Value]
- google_protobuf_Struct_FieldsEntry* = ref google_protobuf_Struct_FieldsEntryObj
- google_protobuf_Struct_FieldsEntryObj* = object of RootObj
- hasField: IntSet
- key: string
- value: google_protobuf_Value
- google_protobuf_Value* = ref google_protobuf_ValueObj
- google_protobuf_ValueObj* = object of RootObj
- hasField: IntSet
- kind: google_protobuf_Value_kind_OneOf
-
- google_protobuf_Value_kind_OneOf* {.union.} = object
- null_value: google_protobuf_NullValue
- number_value: float64
- string_value: string
- bool_value: bool
- struct_value: google_protobuf_Struct
- list_value: google_protobuf_ListValue
- google_protobuf_ListValue* = ref google_protobuf_ListValueObj
- google_protobuf_ListValueObj* = object of RootObj
- hasField: IntSet
- values: seq[google_protobuf_Value]
-
-proc readgoogle_protobuf_NullValue*(stream: ProtobufStream): google_protobuf_NullValue =
- google_protobuf_NullValue(readUInt32(stream))
-
-proc writegoogle_protobuf_NullValue*(stream: ProtobufStream, value: google_protobuf_NullValue) =
- writeUInt32(stream, uint32(value))
-
-proc sizeOfgoogle_protobuf_NullValue*(value: google_protobuf_NullValue): uint64 =
- sizeOfUInt32(uint32(value))
-
-proc newgoogle_protobuf_Struct_FieldsEntry*(): google_protobuf_Struct_FieldsEntry
-proc writegoogle_protobuf_Struct_FieldsEntry*(stream: ProtobufStream, message: google_protobuf_Struct_FieldsEntry)
-proc readgoogle_protobuf_Struct_FieldsEntry*(stream: ProtobufStream): google_protobuf_Struct_FieldsEntry
-proc sizeOfgoogle_protobuf_Struct_FieldsEntry*(message: google_protobuf_Struct_FieldsEntry): uint64
-proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: ProtobufStream, key: string, value: google_protobuf_Value)
-proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: ProtobufStream, 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 writegoogle_protobuf_Struct*(stream: ProtobufStream, message: google_protobuf_Struct)
-proc readgoogle_protobuf_Struct*(stream: ProtobufStream): google_protobuf_Struct
-proc sizeOfgoogle_protobuf_Struct*(message: google_protobuf_Struct): uint64
-
-proc newgoogle_protobuf_ListValue*(): google_protobuf_ListValue
-proc writegoogle_protobuf_ListValue*(stream: ProtobufStream, message: google_protobuf_ListValue)
-proc readgoogle_protobuf_ListValue*(stream: ProtobufStream): google_protobuf_ListValue
-proc sizeOfgoogle_protobuf_ListValue*(message: google_protobuf_ListValue): uint64
-
-proc newgoogle_protobuf_Value*(): google_protobuf_Value
-proc writegoogle_protobuf_Value*(stream: ProtobufStream, message: google_protobuf_Value)
-proc readgoogle_protobuf_Value*(stream: ProtobufStream): google_protobuf_Value
-proc sizeOfgoogle_protobuf_Value*(message: google_protobuf_Value): uint64
-
-proc newgoogle_protobuf_Struct_FieldsEntry*(): google_protobuf_Struct_FieldsEntry =
- new(result)
- result.hasField = initIntSet()
- result.key = ""
- result.value = nil
-
-proc clearkey*(message: google_protobuf_Struct_FieldsEntry) =
- message.key = ""
- excl(message.hasField, 1)
-
-proc haskey*(message: google_protobuf_Struct_FieldsEntry): bool =
- result = contains(message.hasField, 1)
-
-proc setkey*(message: google_protobuf_Struct_FieldsEntry, value: string) =
- message.key = value
- incl(message.hasField, 1)
-
-proc key*(message: google_protobuf_Struct_FieldsEntry): string {.inline.} =
- message.key
-
-proc `key=`*(message: google_protobuf_Struct_FieldsEntry, value: string) {.inline.} =
- setkey(message, value)
-
-proc clearvalue*(message: google_protobuf_Struct_FieldsEntry) =
- message.value = nil
- excl(message.hasField, 2)
-
-proc hasvalue*(message: google_protobuf_Struct_FieldsEntry): bool =
- result = contains(message.hasField, 2)
-
-proc setvalue*(message: google_protobuf_Struct_FieldsEntry, value: google_protobuf_Value) =
- message.value = value
- incl(message.hasField, 2)
-
-proc value*(message: google_protobuf_Struct_FieldsEntry): google_protobuf_Value {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_Struct_FieldsEntry, value: google_protobuf_Value) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key: string, value: google_protobuf_Value): uint64 =
- result = result + sizeOfString(key)
- result = result + sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- let valueSize = sizeOfgoogle_protobuf_Value(value)
- result = result + valueSize
- result = result + sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfUInt64(valueSize)
-
-proc writegoogle_protobuf_Struct_FieldsEntryKV(stream: ProtobufStream, key: string, value: google_protobuf_Value) =
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, key)
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Value(value))
- writegoogle_protobuf_Value(stream, value)
-
-proc readgoogle_protobuf_Struct_FieldsEntryKV(stream: ProtobufStream, 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 = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 1:
- key = readString(stream)
- gotKey = true
- of 2:
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- value = readgoogle_protobuf_Value(pbs)
- gotValue = true
- else: skipField(stream, wireType)
- if not gotKey:
- raise newException(Exception, "missing key (google_protobuf_Struct_FieldsEntry)")
- if not gotValue:
- raise newException(Exception, "missing value (google_protobuf_Struct_FieldsEntry)")
- tbl[key] = value
-
-proc sizeOfgoogle_protobuf_Struct_FieldsEntry*(message: google_protobuf_Struct_FieldsEntry): uint64 =
- if haskey(message):
- let
- sizeOfField = sizeOfString(message.key)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasvalue(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Value(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
-
-proc writegoogle_protobuf_Struct_FieldsEntry*(stream: ProtobufStream, message: google_protobuf_Struct_FieldsEntry) =
- if haskey(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.key)
- if hasvalue(message):
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Value(message.value))
- writegoogle_protobuf_Value(stream, message.value)
-
-proc readgoogle_protobuf_Struct_FieldsEntry*(stream: ProtobufStream): google_protobuf_Struct_FieldsEntry =
- result = newgoogle_protobuf_Struct_FieldsEntry()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setkey(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setvalue(result, readgoogle_protobuf_Value(pbs))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Struct_FieldsEntry): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Struct_FieldsEntry(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Struct_FieldsEntry*(data: string): google_protobuf_Struct_FieldsEntry =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Struct_FieldsEntry(pbs)
-
-
-proc newgoogle_protobuf_Struct*(): google_protobuf_Struct =
- new(result)
- result.hasField = initIntSet()
- result.fields = newTable[string, google_protobuf_Value]()
-
-proc clearfields*(message: google_protobuf_Struct) =
- message.fields = newTable[string, google_protobuf_Value]()
- excl(message.hasField, 1)
-
-proc hasfields*(message: google_protobuf_Struct): bool =
- result = contains(message.hasField, 1)
-
-proc setfields*(message: google_protobuf_Struct, value: TableRef[string, google_protobuf_Value]) =
- message.fields = value
- incl(message.hasField, 1)
-
-proc fields*(message: google_protobuf_Struct): TableRef[string, google_protobuf_Value] {.inline.} =
- message.fields
-
-proc `fields=`*(message: google_protobuf_Struct, value: TableRef[string, google_protobuf_Value]) {.inline.} =
- setfields(message, value)
-
-proc sizeOfgoogle_protobuf_Struct*(message: google_protobuf_Struct): uint64 =
- if hasfields(message):
- var sizeOfKV = 0'u64
- for key, value in message.fields:
- sizeOfKV = sizeOfKV + sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key, value)
- let sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfKV + sizeOfTag + sizeOfUInt64(sizeOfKV)
-
-proc writegoogle_protobuf_Struct*(stream: ProtobufStream, message: google_protobuf_Struct) =
- for key, value in message.fields:
- writeTag(stream, 1, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Struct_FieldsEntryKV(key, value))
- writegoogle_protobuf_Struct_FieldsEntryKV(stream, key, value)
-
-proc readgoogle_protobuf_Struct*(stream: ProtobufStream): google_protobuf_Struct =
- result = newgoogle_protobuf_Struct()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- readgoogle_protobuf_Struct_FieldsEntryKV(pbs, result.fields)
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Struct): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Struct(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Struct*(data: string): google_protobuf_Struct =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Struct(pbs)
-
-
-proc newgoogle_protobuf_ListValue*(): google_protobuf_ListValue =
- new(result)
- result.hasField = initIntSet()
- result.values = @[]
-
-proc clearvalues*(message: google_protobuf_ListValue) =
- message.values = @[]
- excl(message.hasField, 1)
-
-proc hasvalues*(message: google_protobuf_ListValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalues*(message: google_protobuf_ListValue, value: seq[google_protobuf_Value]) =
- message.values = value
- incl(message.hasField, 1)
-
-proc addvalues*(message: google_protobuf_ListValue, value: google_protobuf_Value) =
- add(message.values, value)
- incl(message.hasField, 1)
-
-proc values*(message: google_protobuf_ListValue): seq[google_protobuf_Value] {.inline.} =
- message.values
-
-proc `values=`*(message: google_protobuf_ListValue, value: seq[google_protobuf_Value]) {.inline.} =
- setvalues(message, value)
-
-proc sizeOfgoogle_protobuf_ListValue*(message: google_protobuf_ListValue): uint64 =
- for value in message.values:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Value(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
-
-proc writegoogle_protobuf_ListValue*(stream: ProtobufStream, message: google_protobuf_ListValue) =
- for value in message.values:
- writeTag(stream, 1, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Value(value))
- writegoogle_protobuf_Value(stream, value)
-
-proc readgoogle_protobuf_ListValue*(stream: ProtobufStream): google_protobuf_ListValue =
- result = newgoogle_protobuf_ListValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addvalues(result, readgoogle_protobuf_Value(pbs))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_ListValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_ListValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_ListValue*(data: string): google_protobuf_ListValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_ListValue(pbs)
-
-
-proc newgoogle_protobuf_Value*(): google_protobuf_Value =
- new(result)
- result.hasField = initIntSet()
- result.kind.null_value = google_protobuf_NullValue(0)
- result.kind.number_value = 0
- result.kind.string_value = ""
- result.kind.bool_value = false
- result.kind.struct_value = nil
- result.kind.list_value = nil
-
-proc clearnull_value*(message: google_protobuf_Value) =
- message.kind.null_value = google_protobuf_NullValue(0)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc hasnull_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 1)
-
-proc setnull_value*(message: google_protobuf_Value, value: google_protobuf_NullValue) =
- message.kind.null_value = value
- incl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc null_value*(message: google_protobuf_Value): google_protobuf_NullValue {.inline.} =
- message.kind.null_value
-
-proc `null_value=`*(message: google_protobuf_Value, value: google_protobuf_NullValue) {.inline.} =
- setnull_value(message, value)
-
-proc clearnumber_value*(message: google_protobuf_Value) =
- message.kind.number_value = 0
- excl(message.hasField, 2)
- excl(message.hasField, 1)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc hasnumber_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 2)
-
-proc setnumber_value*(message: google_protobuf_Value, value: float64) =
- message.kind.number_value = value
- incl(message.hasField, 2)
- excl(message.hasField, 1)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc number_value*(message: google_protobuf_Value): float64 {.inline.} =
- message.kind.number_value
-
-proc `number_value=`*(message: google_protobuf_Value, value: float64) {.inline.} =
- setnumber_value(message, value)
-
-proc clearstring_value*(message: google_protobuf_Value) =
- message.kind.string_value = ""
- excl(message.hasField, 3)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc hasstring_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 3)
-
-proc setstring_value*(message: google_protobuf_Value, value: string) =
- message.kind.string_value = value
- incl(message.hasField, 3)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc string_value*(message: google_protobuf_Value): string {.inline.} =
- message.kind.string_value
-
-proc `string_value=`*(message: google_protobuf_Value, value: string) {.inline.} =
- setstring_value(message, value)
-
-proc clearbool_value*(message: google_protobuf_Value) =
- message.kind.bool_value = false
- excl(message.hasField, 4)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc hasbool_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 4)
-
-proc setbool_value*(message: google_protobuf_Value, value: bool) =
- message.kind.bool_value = value
- incl(message.hasField, 4)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 5)
- excl(message.hasField, 6)
-
-proc bool_value*(message: google_protobuf_Value): bool {.inline.} =
- message.kind.bool_value
-
-proc `bool_value=`*(message: google_protobuf_Value, value: bool) {.inline.} =
- setbool_value(message, value)
-
-proc clearstruct_value*(message: google_protobuf_Value) =
- message.kind.struct_value = nil
- excl(message.hasField, 5)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 6)
-
-proc hasstruct_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 5)
-
-proc setstruct_value*(message: google_protobuf_Value, value: google_protobuf_Struct) =
- message.kind.struct_value = value
- incl(message.hasField, 5)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 6)
-
-proc struct_value*(message: google_protobuf_Value): google_protobuf_Struct {.inline.} =
- message.kind.struct_value
-
-proc `struct_value=`*(message: google_protobuf_Value, value: google_protobuf_Struct) {.inline.} =
- setstruct_value(message, value)
-
-proc clearlist_value*(message: google_protobuf_Value) =
- message.kind.list_value = nil
- excl(message.hasField, 6)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
-
-proc haslist_value*(message: google_protobuf_Value): bool =
- result = contains(message.hasField, 6)
-
-proc setlist_value*(message: google_protobuf_Value, value: google_protobuf_ListValue) =
- message.kind.list_value = value
- incl(message.hasField, 6)
- excl(message.hasField, 1)
- excl(message.hasField, 2)
- excl(message.hasField, 3)
- excl(message.hasField, 4)
- excl(message.hasField, 5)
-
-proc list_value*(message: google_protobuf_Value): google_protobuf_ListValue {.inline.} =
- message.kind.list_value
-
-proc `list_value=`*(message: google_protobuf_Value, value: google_protobuf_ListValue) {.inline.} =
- setlist_value(message, value)
-
-proc sizeOfgoogle_protobuf_Value*(message: google_protobuf_Value): uint64 =
- if hasnull_value(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_NullValue(message.kind.null_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasnumber_value(message):
- let
- sizeOfField = sizeOfDouble(message.kind.number_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.Fixed64)))
- result = result + sizeOfField + sizeOfTag
- if hasstring_value(message):
- let
- sizeOfField = sizeOfString(message.kind.string_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasbool_value(message):
- let
- sizeOfField = sizeOfBool(message.kind.bool_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasstruct_value(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Struct(message.kind.struct_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(5, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
- if haslist_value(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_ListValue(message.kind.list_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(6, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
-
-proc writegoogle_protobuf_Value*(stream: ProtobufStream, message: google_protobuf_Value) =
- if hasnull_value(message):
- writeTag(stream, 1, WireType.Varint)
- writegoogle_protobuf_NullValue(stream, message.kind.null_value)
- if hasnumber_value(message):
- writeTag(stream, 2, WireType.Fixed64)
- writeDouble(stream, message.kind.number_value)
- if hasstring_value(message):
- writeTag(stream, 3, WireType.LengthDelimited)
- writeString(stream, message.kind.string_value)
- if hasbool_value(message):
- writeTag(stream, 4, WireType.Varint)
- writeBool(stream, message.kind.bool_value)
- if hasstruct_value(message):
- writeTag(stream, 5, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Struct(message.kind.struct_value))
- writegoogle_protobuf_Struct(stream, message.kind.struct_value)
- if haslist_value(message):
- writeTag(stream, 6, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_ListValue(message.kind.list_value))
- writegoogle_protobuf_ListValue(stream, message.kind.list_value)
-
-proc readgoogle_protobuf_Value*(stream: ProtobufStream): google_protobuf_Value =
- result = newgoogle_protobuf_Value()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setnull_value(result, readgoogle_protobuf_NullValue(stream))
- of 2:
- expectWireType(wireType, WireType.Fixed64)
- setnumber_value(result, readDouble(stream))
- of 3:
- expectWireType(wireType, WireType.LengthDelimited)
- setstring_value(result, readString(stream))
- of 4:
- expectWireType(wireType, WireType.Varint)
- setbool_value(result, readBool(stream))
- of 5:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setstruct_value(result, readgoogle_protobuf_Struct(pbs))
- of 6:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setlist_value(result, readgoogle_protobuf_ListValue(pbs))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Value): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Value(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Value*(data: string): google_protobuf_Value =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Value(pbs)
-
-
diff --git a/src/protobuf/wkt/timestamp.proto b/src/protobuf/wkt/timestamp.proto
deleted file mode 100644
index b7cbd17..0000000
--- a/src/protobuf/wkt/timestamp.proto
+++ /dev/null
@@ -1,133 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/timestamp";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "TimestampProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// A Timestamp represents a point in time independent of any time zone
-// or calendar, represented as seconds and fractions of seconds at
-// nanosecond resolution in UTC Epoch time. It is encoded using the
-// Proleptic Gregorian Calendar which extends the Gregorian calendar
-// backwards to year one. It is encoded assuming all minutes are 60
-// seconds long, i.e. leap seconds are "smeared" so that no leap second
-// table is needed for interpretation. Range is from
-// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
-// By restricting to that range, we ensure that we can convert to
-// and from RFC 3339 date strings.
-// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
-//
-// # Examples
-//
-// Example 1: Compute Timestamp from POSIX `time()`.
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(time(NULL));
-// timestamp.set_nanos(0);
-//
-// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
-//
-// struct timeval tv;
-// gettimeofday(&tv, NULL);
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(tv.tv_sec);
-// timestamp.set_nanos(tv.tv_usec * 1000);
-//
-// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
-//
-// FILETIME ft;
-// GetSystemTimeAsFileTime(&ft);
-// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-//
-// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
-// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
-// Timestamp timestamp;
-// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
-// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
-//
-// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
-//
-// long millis = System.currentTimeMillis();
-//
-// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
-// .setNanos((int) ((millis % 1000) * 1000000)).build();
-//
-//
-// Example 5: Compute Timestamp from current time in Python.
-//
-// timestamp = Timestamp()
-// timestamp.GetCurrentTime()
-//
-// # JSON Mapping
-//
-// In JSON format, the Timestamp type is encoded as a string in the
-// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
-// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
-// where {year} is always expressed using four digits while {month}, {day},
-// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
-// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
-// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
-// is required, though only UTC (as indicated by "Z") is presently supported.
-//
-// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
-// 01:30 UTC on January 15, 2017.
-//
-// In JavaScript, one can convert a Date object to this format using the
-// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
-// method. In Python, a standard `datetime.datetime` object can be converted
-// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
-// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
-// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
-// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())
-// to obtain a formatter capable of generating timestamps in this format.
-//
-//
-message Timestamp {
-
- // Represents seconds of UTC time since Unix epoch
- // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- // 9999-12-31T23:59:59Z inclusive.
- int64 seconds = 1;
-
- // Non-negative fractions of a second at nanosecond resolution. Negative
- // second values with fractions must still have non-negative nanos values
- // that count forward in time. Must be from 0 to 999,999,999
- // inclusive.
- int32 nanos = 2;
-}
diff --git a/src/protobuf/wkt/timestamp_pb.nim b/src/protobuf/wkt/timestamp_pb.nim
deleted file mode 100644
index 958a894..0000000
--- a/src/protobuf/wkt/timestamp_pb.nim
+++ /dev/null
@@ -1,109 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_Timestamp* = ref google_protobuf_TimestampObj
- google_protobuf_TimestampObj* = object of RootObj
- hasField: IntSet
- seconds: int64
- nanos: int32
-
-proc newgoogle_protobuf_Timestamp*(): google_protobuf_Timestamp
-proc writegoogle_protobuf_Timestamp*(stream: ProtobufStream, message: google_protobuf_Timestamp)
-proc readgoogle_protobuf_Timestamp*(stream: ProtobufStream): google_protobuf_Timestamp
-proc sizeOfgoogle_protobuf_Timestamp*(message: google_protobuf_Timestamp): uint64
-
-proc newgoogle_protobuf_Timestamp*(): google_protobuf_Timestamp =
- new(result)
- result.hasField = initIntSet()
- result.seconds = 0
- result.nanos = 0
-
-proc clearseconds*(message: google_protobuf_Timestamp) =
- message.seconds = 0
- excl(message.hasField, 1)
-
-proc hasseconds*(message: google_protobuf_Timestamp): bool =
- result = contains(message.hasField, 1)
-
-proc setseconds*(message: google_protobuf_Timestamp, value: int64) =
- message.seconds = value
- incl(message.hasField, 1)
-
-proc seconds*(message: google_protobuf_Timestamp): int64 {.inline.} =
- message.seconds
-
-proc `seconds=`*(message: google_protobuf_Timestamp, value: int64) {.inline.} =
- setseconds(message, value)
-
-proc clearnanos*(message: google_protobuf_Timestamp) =
- message.nanos = 0
- excl(message.hasField, 2)
-
-proc hasnanos*(message: google_protobuf_Timestamp): bool =
- result = contains(message.hasField, 2)
-
-proc setnanos*(message: google_protobuf_Timestamp, value: int32) =
- message.nanos = value
- incl(message.hasField, 2)
-
-proc nanos*(message: google_protobuf_Timestamp): int32 {.inline.} =
- message.nanos
-
-proc `nanos=`*(message: google_protobuf_Timestamp, value: int32) {.inline.} =
- setnanos(message, value)
-
-proc sizeOfgoogle_protobuf_Timestamp*(message: google_protobuf_Timestamp): uint64 =
- if hasseconds(message):
- let
- sizeOfField = sizeOfInt64(message.seconds)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasnanos(message):
- let
- sizeOfField = sizeOfInt32(message.nanos)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Timestamp*(stream: ProtobufStream, message: google_protobuf_Timestamp) =
- if hasseconds(message):
- writeTag(stream, 1, WireType.Varint)
- writeInt64(stream, message.seconds)
- if hasnanos(message):
- writeTag(stream, 2, WireType.Varint)
- writeInt32(stream, message.nanos)
-
-proc readgoogle_protobuf_Timestamp*(stream: ProtobufStream): google_protobuf_Timestamp =
- result = newgoogle_protobuf_Timestamp()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setseconds(result, readInt64(stream))
- of 2:
- expectWireType(wireType, WireType.Varint)
- setnanos(result, readInt32(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Timestamp): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Timestamp(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Timestamp*(data: string): google_protobuf_Timestamp =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Timestamp(pbs)
-
-
diff --git a/src/protobuf/wkt/type.proto b/src/protobuf/wkt/type.proto
deleted file mode 100644
index 624c15e..0000000
--- a/src/protobuf/wkt/type.proto
+++ /dev/null
@@ -1,187 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-import "google/protobuf/any.proto";
-import "google/protobuf/source_context.proto";
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option java_package = "com.google.protobuf";
-option java_outer_classname = "TypeProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";
-
-// A protocol buffer message type.
-message Type {
- // The fully qualified message name.
- string name = 1;
- // The list of fields.
- repeated Field fields = 2;
- // The list of types appearing in `oneof` definitions in this type.
- repeated string oneofs = 3;
- // The protocol buffer options.
- repeated Option options = 4;
- // The source context.
- SourceContext source_context = 5;
- // The source syntax.
- Syntax syntax = 6;
-}
-
-// A single field of a message type.
-message Field {
- // Basic field types.
- enum Kind {
- // Field type unknown.
- TYPE_UNKNOWN = 0;
- // Field type double.
- TYPE_DOUBLE = 1;
- // Field type float.
- TYPE_FLOAT = 2;
- // Field type int64.
- TYPE_INT64 = 3;
- // Field type uint64.
- TYPE_UINT64 = 4;
- // Field type int32.
- TYPE_INT32 = 5;
- // Field type fixed64.
- TYPE_FIXED64 = 6;
- // Field type fixed32.
- TYPE_FIXED32 = 7;
- // Field type bool.
- TYPE_BOOL = 8;
- // Field type string.
- TYPE_STRING = 9;
- // Field type group. Proto2 syntax only, and deprecated.
- TYPE_GROUP = 10;
- // Field type message.
- TYPE_MESSAGE = 11;
- // Field type bytes.
- TYPE_BYTES = 12;
- // Field type uint32.
- TYPE_UINT32 = 13;
- // Field type enum.
- TYPE_ENUM = 14;
- // Field type sfixed32.
- TYPE_SFIXED32 = 15;
- // Field type sfixed64.
- TYPE_SFIXED64 = 16;
- // Field type sint32.
- TYPE_SINT32 = 17;
- // Field type sint64.
- TYPE_SINT64 = 18;
- };
-
- // Whether a field is optional, required, or repeated.
- enum Cardinality {
- // For fields with unknown cardinality.
- CARDINALITY_UNKNOWN = 0;
- // For optional fields.
- CARDINALITY_OPTIONAL = 1;
- // For required fields. Proto2 syntax only.
- CARDINALITY_REQUIRED = 2;
- // For repeated fields.
- CARDINALITY_REPEATED = 3;
- };
-
- // The field type.
- Kind kind = 1;
- // The field cardinality.
- Cardinality cardinality = 2;
- // The field number.
- int32 number = 3;
- // The field name.
- string name = 4;
- // The field type URL, without the scheme, for message or enumeration
- // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
- string type_url = 6;
- // The index of the field type in `Type.oneofs`, for message or enumeration
- // types. The first type has index 1; zero means the type is not in the list.
- int32 oneof_index = 7;
- // Whether to use alternative packed wire representation.
- bool packed = 8;
- // The protocol buffer options.
- repeated Option options = 9;
- // The field JSON name.
- string json_name = 10;
- // The string value of the default value of this field. Proto2 syntax only.
- string default_value = 11;
-}
-
-// Enum type definition.
-message Enum {
- // Enum type name.
- string name = 1;
- // Enum value definitions.
- repeated EnumValue enumvalue = 2;
- // Protocol buffer options.
- repeated Option options = 3;
- // The source context.
- SourceContext source_context = 4;
- // The source syntax.
- Syntax syntax = 5;
-}
-
-// Enum value definition.
-message EnumValue {
- // Enum value name.
- string name = 1;
- // Enum value number.
- int32 number = 2;
- // Protocol buffer options.
- repeated Option options = 3;
-}
-
-// A protocol buffer option, which can be attached to a message, field,
-// enumeration, etc.
-message Option {
- // The option's name. For protobuf built-in options (options defined in
- // descriptor.proto), this is the short name. For example, `"map_entry"`.
- // For custom options, it should be the fully-qualified name. For example,
- // `"google.api.http"`.
- string name = 1;
- // The option's value packed in an Any message. If the value is a primitive,
- // the corresponding wrapper type defined in google/protobuf/wrappers.proto
- // should be used. If the value is an enum, it should be stored as an int32
- // value using the google.protobuf.Int32Value type.
- Any value = 2;
-}
-
-// The syntax in which a protocol buffer element is defined.
-enum Syntax {
- // Syntax `proto2`.
- SYNTAX_PROTO2 = 0;
- // Syntax `proto3`.
- SYNTAX_PROTO3 = 1;
-}
diff --git a/src/protobuf/wkt/type_pb.nim b/src/protobuf/wkt/type_pb.nim
deleted file mode 100644
index ca25cd0..0000000
--- a/src/protobuf/wkt/type_pb.nim
+++ /dev/null
@@ -1,1140 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-import protobuf/wkt/any_pb
-import protobuf/wkt/source_context_pb
-
-type
- google_protobuf_Syntax* {.pure.} = enum
- SYNTAX_PROTO2 = 0
- SYNTAX_PROTO3 = 1
- google_protobuf_Field_Kind* {.pure.} = enum
- TYPE_UNKNOWN = 0
- TYPE_DOUBLE = 1
- TYPE_FLOAT = 2
- TYPE_INT64 = 3
- TYPE_UINT64 = 4
- TYPE_INT32 = 5
- TYPE_FIXED64 = 6
- TYPE_FIXED32 = 7
- TYPE_BOOL = 8
- TYPE_STRING = 9
- TYPE_GROUP = 10
- TYPE_MESSAGE = 11
- TYPE_BYTES = 12
- TYPE_UINT32 = 13
- TYPE_ENUM = 14
- TYPE_SFIXED32 = 15
- TYPE_SFIXED64 = 16
- TYPE_SINT32 = 17
- TYPE_SINT64 = 18
- google_protobuf_Field_Cardinality* {.pure.} = enum
- CARDINALITY_UNKNOWN = 0
- CARDINALITY_OPTIONAL = 1
- CARDINALITY_REQUIRED = 2
- CARDINALITY_REPEATED = 3
- google_protobuf_Type* = ref google_protobuf_TypeObj
- google_protobuf_TypeObj* = object of RootObj
- hasField: IntSet
- name: string
- fields: seq[google_protobuf_Field]
- oneofs: seq[string]
- options: seq[google_protobuf_Option]
- source_context: google_protobuf_SourceContext
- syntax: google_protobuf_Syntax
- google_protobuf_Field* = ref google_protobuf_FieldObj
- google_protobuf_FieldObj* = object of RootObj
- hasField: IntSet
- kind: google_protobuf_Field_Kind
- cardinality: google_protobuf_Field_Cardinality
- number: int32
- name: string
- type_url: string
- oneof_index: int32
- packed: bool
- options: seq[google_protobuf_Option]
- json_name: string
- default_value: string
- google_protobuf_Enum* = ref google_protobuf_EnumObj
- google_protobuf_EnumObj* = object of RootObj
- hasField: IntSet
- name: string
- enumvalue: seq[google_protobuf_EnumValue]
- options: seq[google_protobuf_Option]
- source_context: google_protobuf_SourceContext
- syntax: google_protobuf_Syntax
- google_protobuf_EnumValue* = ref google_protobuf_EnumValueObj
- google_protobuf_EnumValueObj* = object of RootObj
- hasField: IntSet
- name: string
- number: int32
- options: seq[google_protobuf_Option]
- google_protobuf_Option* = ref google_protobuf_OptionObj
- google_protobuf_OptionObj* = object of RootObj
- hasField: IntSet
- name: string
- value: google_protobuf_Any
-
-proc readgoogle_protobuf_Syntax*(stream: ProtobufStream): google_protobuf_Syntax =
- google_protobuf_Syntax(readUInt32(stream))
-
-proc writegoogle_protobuf_Syntax*(stream: ProtobufStream, value: google_protobuf_Syntax) =
- writeUInt32(stream, uint32(value))
-
-proc sizeOfgoogle_protobuf_Syntax*(value: google_protobuf_Syntax): uint64 =
- sizeOfUInt32(uint32(value))
-
-proc readgoogle_protobuf_Field_Kind*(stream: ProtobufStream): google_protobuf_Field_Kind =
- google_protobuf_Field_Kind(readUInt32(stream))
-
-proc writegoogle_protobuf_Field_Kind*(stream: ProtobufStream, value: google_protobuf_Field_Kind) =
- writeUInt32(stream, uint32(value))
-
-proc sizeOfgoogle_protobuf_Field_Kind*(value: google_protobuf_Field_Kind): uint64 =
- sizeOfUInt32(uint32(value))
-
-proc readgoogle_protobuf_Field_Cardinality*(stream: ProtobufStream): google_protobuf_Field_Cardinality =
- google_protobuf_Field_Cardinality(readUInt32(stream))
-
-proc writegoogle_protobuf_Field_Cardinality*(stream: ProtobufStream, value: google_protobuf_Field_Cardinality) =
- writeUInt32(stream, uint32(value))
-
-proc sizeOfgoogle_protobuf_Field_Cardinality*(value: google_protobuf_Field_Cardinality): uint64 =
- sizeOfUInt32(uint32(value))
-
-proc newgoogle_protobuf_Option*(): google_protobuf_Option
-proc writegoogle_protobuf_Option*(stream: ProtobufStream, message: google_protobuf_Option)
-proc readgoogle_protobuf_Option*(stream: ProtobufStream): google_protobuf_Option
-proc sizeOfgoogle_protobuf_Option*(message: google_protobuf_Option): uint64
-
-proc newgoogle_protobuf_Field*(): google_protobuf_Field
-proc writegoogle_protobuf_Field*(stream: ProtobufStream, message: google_protobuf_Field)
-proc readgoogle_protobuf_Field*(stream: ProtobufStream): google_protobuf_Field
-proc sizeOfgoogle_protobuf_Field*(message: google_protobuf_Field): uint64
-
-proc newgoogle_protobuf_Type*(): google_protobuf_Type
-proc writegoogle_protobuf_Type*(stream: ProtobufStream, message: google_protobuf_Type)
-proc readgoogle_protobuf_Type*(stream: ProtobufStream): google_protobuf_Type
-proc sizeOfgoogle_protobuf_Type*(message: google_protobuf_Type): uint64
-
-proc newgoogle_protobuf_EnumValue*(): google_protobuf_EnumValue
-proc writegoogle_protobuf_EnumValue*(stream: ProtobufStream, message: google_protobuf_EnumValue)
-proc readgoogle_protobuf_EnumValue*(stream: ProtobufStream): google_protobuf_EnumValue
-proc sizeOfgoogle_protobuf_EnumValue*(message: google_protobuf_EnumValue): uint64
-
-proc newgoogle_protobuf_Enum*(): google_protobuf_Enum
-proc writegoogle_protobuf_Enum*(stream: ProtobufStream, message: google_protobuf_Enum)
-proc readgoogle_protobuf_Enum*(stream: ProtobufStream): google_protobuf_Enum
-proc sizeOfgoogle_protobuf_Enum*(message: google_protobuf_Enum): uint64
-
-proc newgoogle_protobuf_Option*(): google_protobuf_Option =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.value = nil
-
-proc clearname*(message: google_protobuf_Option) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Option): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Option, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Option): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Option, value: string) {.inline.} =
- setname(message, value)
-
-proc clearvalue*(message: google_protobuf_Option) =
- message.value = nil
- excl(message.hasField, 2)
-
-proc hasvalue*(message: google_protobuf_Option): bool =
- result = contains(message.hasField, 2)
-
-proc setvalue*(message: google_protobuf_Option, value: google_protobuf_Any) =
- message.value = value
- incl(message.hasField, 2)
-
-proc value*(message: google_protobuf_Option): google_protobuf_Any {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_Option, value: google_protobuf_Any) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_Option*(message: google_protobuf_Option): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasvalue(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Any(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
-
-proc writegoogle_protobuf_Option*(stream: ProtobufStream, message: google_protobuf_Option) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- if hasvalue(message):
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Any(message.value))
- writegoogle_protobuf_Any(stream, message.value)
-
-proc readgoogle_protobuf_Option*(stream: ProtobufStream): google_protobuf_Option =
- result = newgoogle_protobuf_Option()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setvalue(result, readgoogle_protobuf_Any(pbs))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Option): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Option(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Option*(data: string): google_protobuf_Option =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Option(pbs)
-
-
-proc newgoogle_protobuf_Field*(): google_protobuf_Field =
- new(result)
- result.hasField = initIntSet()
- result.kind = google_protobuf_Field_Kind(0)
- result.cardinality = google_protobuf_Field_Cardinality(0)
- result.number = 0
- result.name = ""
- result.type_url = ""
- result.oneof_index = 0
- result.packed = false
- result.options = @[]
- result.json_name = ""
- result.default_value = ""
-
-proc clearkind*(message: google_protobuf_Field) =
- message.kind = google_protobuf_Field_Kind(0)
- excl(message.hasField, 1)
-
-proc haskind*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 1)
-
-proc setkind*(message: google_protobuf_Field, value: google_protobuf_Field_Kind) =
- message.kind = value
- incl(message.hasField, 1)
-
-proc kind*(message: google_protobuf_Field): google_protobuf_Field_Kind {.inline.} =
- message.kind
-
-proc `kind=`*(message: google_protobuf_Field, value: google_protobuf_Field_Kind) {.inline.} =
- setkind(message, value)
-
-proc clearcardinality*(message: google_protobuf_Field) =
- message.cardinality = google_protobuf_Field_Cardinality(0)
- excl(message.hasField, 2)
-
-proc hascardinality*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 2)
-
-proc setcardinality*(message: google_protobuf_Field, value: google_protobuf_Field_Cardinality) =
- message.cardinality = value
- incl(message.hasField, 2)
-
-proc cardinality*(message: google_protobuf_Field): google_protobuf_Field_Cardinality {.inline.} =
- message.cardinality
-
-proc `cardinality=`*(message: google_protobuf_Field, value: google_protobuf_Field_Cardinality) {.inline.} =
- setcardinality(message, value)
-
-proc clearnumber*(message: google_protobuf_Field) =
- message.number = 0
- excl(message.hasField, 3)
-
-proc hasnumber*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 3)
-
-proc setnumber*(message: google_protobuf_Field, value: int32) =
- message.number = value
- incl(message.hasField, 3)
-
-proc number*(message: google_protobuf_Field): int32 {.inline.} =
- message.number
-
-proc `number=`*(message: google_protobuf_Field, value: int32) {.inline.} =
- setnumber(message, value)
-
-proc clearname*(message: google_protobuf_Field) =
- message.name = ""
- excl(message.hasField, 4)
-
-proc hasname*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 4)
-
-proc setname*(message: google_protobuf_Field, value: string) =
- message.name = value
- incl(message.hasField, 4)
-
-proc name*(message: google_protobuf_Field): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Field, value: string) {.inline.} =
- setname(message, value)
-
-proc cleartype_url*(message: google_protobuf_Field) =
- message.type_url = ""
- excl(message.hasField, 6)
-
-proc hastype_url*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 6)
-
-proc settype_url*(message: google_protobuf_Field, value: string) =
- message.type_url = value
- incl(message.hasField, 6)
-
-proc type_url*(message: google_protobuf_Field): string {.inline.} =
- message.type_url
-
-proc `type_url=`*(message: google_protobuf_Field, value: string) {.inline.} =
- settype_url(message, value)
-
-proc clearoneof_index*(message: google_protobuf_Field) =
- message.oneof_index = 0
- excl(message.hasField, 7)
-
-proc hasoneof_index*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 7)
-
-proc setoneof_index*(message: google_protobuf_Field, value: int32) =
- message.oneof_index = value
- incl(message.hasField, 7)
-
-proc oneof_index*(message: google_protobuf_Field): int32 {.inline.} =
- message.oneof_index
-
-proc `oneof_index=`*(message: google_protobuf_Field, value: int32) {.inline.} =
- setoneof_index(message, value)
-
-proc clearpacked*(message: google_protobuf_Field) =
- message.packed = false
- excl(message.hasField, 8)
-
-proc haspacked*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 8)
-
-proc setpacked*(message: google_protobuf_Field, value: bool) =
- message.packed = value
- incl(message.hasField, 8)
-
-proc packed*(message: google_protobuf_Field): bool {.inline.} =
- message.packed
-
-proc `packed=`*(message: google_protobuf_Field, value: bool) {.inline.} =
- setpacked(message, value)
-
-proc clearoptions*(message: google_protobuf_Field) =
- message.options = @[]
- excl(message.hasField, 9)
-
-proc hasoptions*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 9)
-
-proc setoptions*(message: google_protobuf_Field, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 9)
-
-proc addoptions*(message: google_protobuf_Field, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 9)
-
-proc options*(message: google_protobuf_Field): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_Field, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc clearjson_name*(message: google_protobuf_Field) =
- message.json_name = ""
- excl(message.hasField, 10)
-
-proc hasjson_name*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 10)
-
-proc setjson_name*(message: google_protobuf_Field, value: string) =
- message.json_name = value
- incl(message.hasField, 10)
-
-proc json_name*(message: google_protobuf_Field): string {.inline.} =
- message.json_name
-
-proc `json_name=`*(message: google_protobuf_Field, value: string) {.inline.} =
- setjson_name(message, value)
-
-proc cleardefault_value*(message: google_protobuf_Field) =
- message.default_value = ""
- excl(message.hasField, 11)
-
-proc hasdefault_value*(message: google_protobuf_Field): bool =
- result = contains(message.hasField, 11)
-
-proc setdefault_value*(message: google_protobuf_Field, value: string) =
- message.default_value = value
- incl(message.hasField, 11)
-
-proc default_value*(message: google_protobuf_Field): string {.inline.} =
- message.default_value
-
-proc `default_value=`*(message: google_protobuf_Field, value: string) {.inline.} =
- setdefault_value(message, value)
-
-proc sizeOfgoogle_protobuf_Field*(message: google_protobuf_Field): uint64 =
- if haskind(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Field_Kind(message.kind)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hascardinality(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Field_Cardinality(message.cardinality)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasnumber(message):
- let
- sizeOfField = sizeOfInt32(message.number)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hastype_url(message):
- let
- sizeOfField = sizeOfString(message.type_url)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(6, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasoneof_index(message):
- let
- sizeOfField = sizeOfInt32(message.oneof_index)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(7, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- if haspacked(message):
- let
- sizeOfField = sizeOfBool(message.packed)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(8, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(9, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hasjson_name(message):
- let
- sizeOfField = sizeOfString(message.json_name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(10, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasdefault_value(message):
- let
- sizeOfField = sizeOfString(message.default_value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(11, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Field*(stream: ProtobufStream, message: google_protobuf_Field) =
- if haskind(message):
- writeTag(stream, 1, WireType.Varint)
- writegoogle_protobuf_Field_Kind(stream, message.kind)
- if hascardinality(message):
- writeTag(stream, 2, WireType.Varint)
- writegoogle_protobuf_Field_Cardinality(stream, message.cardinality)
- if hasnumber(message):
- writeTag(stream, 3, WireType.Varint)
- writeInt32(stream, message.number)
- if hasname(message):
- writeTag(stream, 4, WireType.LengthDelimited)
- writeString(stream, message.name)
- if hastype_url(message):
- writeTag(stream, 6, WireType.LengthDelimited)
- writeString(stream, message.type_url)
- if hasoneof_index(message):
- writeTag(stream, 7, WireType.Varint)
- writeInt32(stream, message.oneof_index)
- if haspacked(message):
- writeTag(stream, 8, WireType.Varint)
- writeBool(stream, message.packed)
- for value in message.options:
- writeTag(stream, 9, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
- if hasjson_name(message):
- writeTag(stream, 10, WireType.LengthDelimited)
- writeString(stream, message.json_name)
- if hasdefault_value(message):
- writeTag(stream, 11, WireType.LengthDelimited)
- writeString(stream, message.default_value)
-
-proc readgoogle_protobuf_Field*(stream: ProtobufStream): google_protobuf_Field =
- result = newgoogle_protobuf_Field()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setkind(result, readgoogle_protobuf_Field_Kind(stream))
- of 2:
- expectWireType(wireType, WireType.Varint)
- setcardinality(result, readgoogle_protobuf_Field_Cardinality(stream))
- of 3:
- expectWireType(wireType, WireType.Varint)
- setnumber(result, readInt32(stream))
- of 4:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 6:
- expectWireType(wireType, WireType.LengthDelimited)
- settype_url(result, readString(stream))
- of 7:
- expectWireType(wireType, WireType.Varint)
- setoneof_index(result, readInt32(stream))
- of 8:
- expectWireType(wireType, WireType.Varint)
- setpacked(result, readBool(stream))
- of 9:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- of 10:
- expectWireType(wireType, WireType.LengthDelimited)
- setjson_name(result, readString(stream))
- of 11:
- expectWireType(wireType, WireType.LengthDelimited)
- setdefault_value(result, readString(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Field): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Field(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Field*(data: string): google_protobuf_Field =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Field(pbs)
-
-
-proc newgoogle_protobuf_Type*(): google_protobuf_Type =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.fields = @[]
- result.oneofs = @[]
- result.options = @[]
- result.source_context = nil
- result.syntax = google_protobuf_Syntax(0)
-
-proc clearname*(message: google_protobuf_Type) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Type, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Type): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Type, value: string) {.inline.} =
- setname(message, value)
-
-proc clearfields*(message: google_protobuf_Type) =
- message.fields = @[]
- excl(message.hasField, 2)
-
-proc hasfields*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 2)
-
-proc setfields*(message: google_protobuf_Type, value: seq[google_protobuf_Field]) =
- message.fields = value
- incl(message.hasField, 2)
-
-proc addfields*(message: google_protobuf_Type, value: google_protobuf_Field) =
- add(message.fields, value)
- incl(message.hasField, 2)
-
-proc fields*(message: google_protobuf_Type): seq[google_protobuf_Field] {.inline.} =
- message.fields
-
-proc `fields=`*(message: google_protobuf_Type, value: seq[google_protobuf_Field]) {.inline.} =
- setfields(message, value)
-
-proc clearoneofs*(message: google_protobuf_Type) =
- message.oneofs = @[]
- excl(message.hasField, 3)
-
-proc hasoneofs*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 3)
-
-proc setoneofs*(message: google_protobuf_Type, value: seq[string]) =
- message.oneofs = value
- incl(message.hasField, 3)
-
-proc addoneofs*(message: google_protobuf_Type, value: string) =
- add(message.oneofs, value)
- incl(message.hasField, 3)
-
-proc oneofs*(message: google_protobuf_Type): seq[string] {.inline.} =
- message.oneofs
-
-proc `oneofs=`*(message: google_protobuf_Type, value: seq[string]) {.inline.} =
- setoneofs(message, value)
-
-proc clearoptions*(message: google_protobuf_Type) =
- message.options = @[]
- excl(message.hasField, 4)
-
-proc hasoptions*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 4)
-
-proc setoptions*(message: google_protobuf_Type, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 4)
-
-proc addoptions*(message: google_protobuf_Type, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 4)
-
-proc options*(message: google_protobuf_Type): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_Type, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc clearsource_context*(message: google_protobuf_Type) =
- message.source_context = nil
- excl(message.hasField, 5)
-
-proc hassource_context*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 5)
-
-proc setsource_context*(message: google_protobuf_Type, value: google_protobuf_SourceContext) =
- message.source_context = value
- incl(message.hasField, 5)
-
-proc source_context*(message: google_protobuf_Type): google_protobuf_SourceContext {.inline.} =
- message.source_context
-
-proc `source_context=`*(message: google_protobuf_Type, value: google_protobuf_SourceContext) {.inline.} =
- setsource_context(message, value)
-
-proc clearsyntax*(message: google_protobuf_Type) =
- message.syntax = google_protobuf_Syntax(0)
- excl(message.hasField, 6)
-
-proc hassyntax*(message: google_protobuf_Type): bool =
- result = contains(message.hasField, 6)
-
-proc setsyntax*(message: google_protobuf_Type, value: google_protobuf_Syntax) =
- message.syntax = value
- incl(message.hasField, 6)
-
-proc syntax*(message: google_protobuf_Type): google_protobuf_Syntax {.inline.} =
- message.syntax
-
-proc `syntax=`*(message: google_protobuf_Type, value: google_protobuf_Syntax) {.inline.} =
- setsyntax(message, value)
-
-proc sizeOfgoogle_protobuf_Type*(message: google_protobuf_Type): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- for value in message.fields:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Field(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- for value in message.oneofs:
- let
- sizeOfValue = sizeOfString(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hassource_context(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_SourceContext(message.source_context)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(5, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
- if hassyntax(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Syntax(message.syntax)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(6, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Type*(stream: ProtobufStream, message: google_protobuf_Type) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- for value in message.fields:
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Field(value))
- writegoogle_protobuf_Field(stream, value)
- for value in message.oneofs:
- writeTag(stream, 3, WireType.LengthDelimited)
- writeString(stream, value)
- for value in message.options:
- writeTag(stream, 4, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
- if hassource_context(message):
- writeTag(stream, 5, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_SourceContext(message.source_context))
- writegoogle_protobuf_SourceContext(stream, message.source_context)
- if hassyntax(message):
- writeTag(stream, 6, WireType.Varint)
- writegoogle_protobuf_Syntax(stream, message.syntax)
-
-proc readgoogle_protobuf_Type*(stream: ProtobufStream): google_protobuf_Type =
- result = newgoogle_protobuf_Type()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addfields(result, readgoogle_protobuf_Field(pbs))
- of 3:
- expectWireType(wireType, WireType.LengthDelimited)
- addoneofs(result, readString(stream))
- of 4:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- of 5:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setsource_context(result, readgoogle_protobuf_SourceContext(pbs))
- of 6:
- expectWireType(wireType, WireType.Varint)
- setsyntax(result, readgoogle_protobuf_Syntax(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Type): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Type(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Type*(data: string): google_protobuf_Type =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Type(pbs)
-
-
-proc newgoogle_protobuf_EnumValue*(): google_protobuf_EnumValue =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.number = 0
- result.options = @[]
-
-proc clearname*(message: google_protobuf_EnumValue) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_EnumValue): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_EnumValue, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_EnumValue): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_EnumValue, value: string) {.inline.} =
- setname(message, value)
-
-proc clearnumber*(message: google_protobuf_EnumValue) =
- message.number = 0
- excl(message.hasField, 2)
-
-proc hasnumber*(message: google_protobuf_EnumValue): bool =
- result = contains(message.hasField, 2)
-
-proc setnumber*(message: google_protobuf_EnumValue, value: int32) =
- message.number = value
- incl(message.hasField, 2)
-
-proc number*(message: google_protobuf_EnumValue): int32 {.inline.} =
- message.number
-
-proc `number=`*(message: google_protobuf_EnumValue, value: int32) {.inline.} =
- setnumber(message, value)
-
-proc clearoptions*(message: google_protobuf_EnumValue) =
- message.options = @[]
- excl(message.hasField, 3)
-
-proc hasoptions*(message: google_protobuf_EnumValue): bool =
- result = contains(message.hasField, 3)
-
-proc setoptions*(message: google_protobuf_EnumValue, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 3)
-
-proc addoptions*(message: google_protobuf_EnumValue, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 3)
-
-proc options*(message: google_protobuf_EnumValue): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_EnumValue, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc sizeOfgoogle_protobuf_EnumValue*(message: google_protobuf_EnumValue): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- if hasnumber(message):
- let
- sizeOfField = sizeOfInt32(message.number)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
-
-proc writegoogle_protobuf_EnumValue*(stream: ProtobufStream, message: google_protobuf_EnumValue) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- if hasnumber(message):
- writeTag(stream, 2, WireType.Varint)
- writeInt32(stream, message.number)
- for value in message.options:
- writeTag(stream, 3, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
-
-proc readgoogle_protobuf_EnumValue*(stream: ProtobufStream): google_protobuf_EnumValue =
- result = newgoogle_protobuf_EnumValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.Varint)
- setnumber(result, readInt32(stream))
- of 3:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_EnumValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_EnumValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_EnumValue*(data: string): google_protobuf_EnumValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_EnumValue(pbs)
-
-
-proc newgoogle_protobuf_Enum*(): google_protobuf_Enum =
- new(result)
- result.hasField = initIntSet()
- result.name = ""
- result.enumvalue = @[]
- result.options = @[]
- result.source_context = nil
- result.syntax = google_protobuf_Syntax(0)
-
-proc clearname*(message: google_protobuf_Enum) =
- message.name = ""
- excl(message.hasField, 1)
-
-proc hasname*(message: google_protobuf_Enum): bool =
- result = contains(message.hasField, 1)
-
-proc setname*(message: google_protobuf_Enum, value: string) =
- message.name = value
- incl(message.hasField, 1)
-
-proc name*(message: google_protobuf_Enum): string {.inline.} =
- message.name
-
-proc `name=`*(message: google_protobuf_Enum, value: string) {.inline.} =
- setname(message, value)
-
-proc clearenumvalue*(message: google_protobuf_Enum) =
- message.enumvalue = @[]
- excl(message.hasField, 2)
-
-proc hasenumvalue*(message: google_protobuf_Enum): bool =
- result = contains(message.hasField, 2)
-
-proc setenumvalue*(message: google_protobuf_Enum, value: seq[google_protobuf_EnumValue]) =
- message.enumvalue = value
- incl(message.hasField, 2)
-
-proc addenumvalue*(message: google_protobuf_Enum, value: google_protobuf_EnumValue) =
- add(message.enumvalue, value)
- incl(message.hasField, 2)
-
-proc enumvalue*(message: google_protobuf_Enum): seq[google_protobuf_EnumValue] {.inline.} =
- message.enumvalue
-
-proc `enumvalue=`*(message: google_protobuf_Enum, value: seq[google_protobuf_EnumValue]) {.inline.} =
- setenumvalue(message, value)
-
-proc clearoptions*(message: google_protobuf_Enum) =
- message.options = @[]
- excl(message.hasField, 3)
-
-proc hasoptions*(message: google_protobuf_Enum): bool =
- result = contains(message.hasField, 3)
-
-proc setoptions*(message: google_protobuf_Enum, value: seq[google_protobuf_Option]) =
- message.options = value
- incl(message.hasField, 3)
-
-proc addoptions*(message: google_protobuf_Enum, value: google_protobuf_Option) =
- add(message.options, value)
- incl(message.hasField, 3)
-
-proc options*(message: google_protobuf_Enum): seq[google_protobuf_Option] {.inline.} =
- message.options
-
-proc `options=`*(message: google_protobuf_Enum, value: seq[google_protobuf_Option]) {.inline.} =
- setoptions(message, value)
-
-proc clearsource_context*(message: google_protobuf_Enum) =
- message.source_context = nil
- excl(message.hasField, 4)
-
-proc hassource_context*(message: google_protobuf_Enum): bool =
- result = contains(message.hasField, 4)
-
-proc setsource_context*(message: google_protobuf_Enum, value: google_protobuf_SourceContext) =
- message.source_context = value
- incl(message.hasField, 4)
-
-proc source_context*(message: google_protobuf_Enum): google_protobuf_SourceContext {.inline.} =
- message.source_context
-
-proc `source_context=`*(message: google_protobuf_Enum, value: google_protobuf_SourceContext) {.inline.} =
- setsource_context(message, value)
-
-proc clearsyntax*(message: google_protobuf_Enum) =
- message.syntax = google_protobuf_Syntax(0)
- excl(message.hasField, 5)
-
-proc hassyntax*(message: google_protobuf_Enum): bool =
- result = contains(message.hasField, 5)
-
-proc setsyntax*(message: google_protobuf_Enum, value: google_protobuf_Syntax) =
- message.syntax = value
- incl(message.hasField, 5)
-
-proc syntax*(message: google_protobuf_Enum): google_protobuf_Syntax {.inline.} =
- message.syntax
-
-proc `syntax=`*(message: google_protobuf_Enum, value: google_protobuf_Syntax) {.inline.} =
- setsyntax(message, value)
-
-proc sizeOfgoogle_protobuf_Enum*(message: google_protobuf_Enum): uint64 =
- if hasname(message):
- let
- sizeOfField = sizeOfString(message.name)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- for value in message.enumvalue:
- let
- sizeOfValue = sizeOfgoogle_protobuf_EnumValue(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(2, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- for value in message.options:
- let
- sizeOfValue = sizeOfgoogle_protobuf_Option(value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(3, WireType.LengthDelimited)))
- result = result + sizeOfValue + sizeOfTag
-
- result = result + sizeOfUInt64(sizeOfValue)
- if hassource_context(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_SourceContext(message.source_context)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(4, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
- result = result + sizeOfUInt64(sizeOfField)
- if hassyntax(message):
- let
- sizeOfField = sizeOfgoogle_protobuf_Syntax(message.syntax)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(5, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Enum*(stream: ProtobufStream, message: google_protobuf_Enum) =
- if hasname(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.name)
- for value in message.enumvalue:
- writeTag(stream, 2, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_EnumValue(value))
- writegoogle_protobuf_EnumValue(stream, value)
- for value in message.options:
- writeTag(stream, 3, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_Option(value))
- writegoogle_protobuf_Option(stream, value)
- if hassource_context(message):
- writeTag(stream, 4, WireType.LengthDelimited)
- writeVarint(stream, sizeOfgoogle_protobuf_SourceContext(message.source_context))
- writegoogle_protobuf_SourceContext(stream, message.source_context)
- if hassyntax(message):
- writeTag(stream, 5, WireType.Varint)
- writegoogle_protobuf_Syntax(stream, message.syntax)
-
-proc readgoogle_protobuf_Enum*(stream: ProtobufStream): google_protobuf_Enum =
- result = newgoogle_protobuf_Enum()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setname(result, readString(stream))
- of 2:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addenumvalue(result, readgoogle_protobuf_EnumValue(pbs))
- of 3:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- addoptions(result, readgoogle_protobuf_Option(pbs))
- of 4:
- expectWireType(wireType, WireType.LengthDelimited)
- let
- size = readVarint(stream)
- data = safeReadStr(stream, int(size))
- pbs = newProtobufStream(newStringStream(data))
- setsource_context(result, readgoogle_protobuf_SourceContext(pbs))
- of 5:
- expectWireType(wireType, WireType.Varint)
- setsyntax(result, readgoogle_protobuf_Syntax(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Enum): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Enum(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Enum*(data: string): google_protobuf_Enum =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Enum(pbs)
-
-
diff --git a/src/protobuf/wkt/wrappers.proto b/src/protobuf/wkt/wrappers.proto
deleted file mode 100644
index 0194763..0000000
--- a/src/protobuf/wkt/wrappers.proto
+++ /dev/null
@@ -1,118 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Wrappers for primitive (non-message) types. These types are useful
-// for embedding primitives in the `google.protobuf.Any` type and for places
-// where we need to distinguish between the absence of a primitive
-// typed field and its default value.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/wrappers";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "WrappersProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// Wrapper message for `double`.
-//
-// The JSON representation for `DoubleValue` is JSON number.
-message DoubleValue {
- // The double value.
- double value = 1;
-}
-
-// Wrapper message for `float`.
-//
-// The JSON representation for `FloatValue` is JSON number.
-message FloatValue {
- // The float value.
- float value = 1;
-}
-
-// Wrapper message for `int64`.
-//
-// The JSON representation for `Int64Value` is JSON string.
-message Int64Value {
- // The int64 value.
- int64 value = 1;
-}
-
-// Wrapper message for `uint64`.
-//
-// The JSON representation for `UInt64Value` is JSON string.
-message UInt64Value {
- // The uint64 value.
- uint64 value = 1;
-}
-
-// Wrapper message for `int32`.
-//
-// The JSON representation for `Int32Value` is JSON number.
-message Int32Value {
- // The int32 value.
- int32 value = 1;
-}
-
-// Wrapper message for `uint32`.
-//
-// The JSON representation for `UInt32Value` is JSON number.
-message UInt32Value {
- // The uint32 value.
- uint32 value = 1;
-}
-
-// Wrapper message for `bool`.
-//
-// The JSON representation for `BoolValue` is JSON `true` and `false`.
-message BoolValue {
- // The bool value.
- bool value = 1;
-}
-
-// Wrapper message for `string`.
-//
-// The JSON representation for `StringValue` is JSON string.
-message StringValue {
- // The string value.
- string value = 1;
-}
-
-// Wrapper message for `bytes`.
-//
-// The JSON representation for `BytesValue` is JSON string.
-message BytesValue {
- // The bytes value.
- bytes value = 1;
-}
diff --git a/src/protobuf/wkt/wrappers_pb.nim b/src/protobuf/wkt/wrappers_pb.nim
deleted file mode 100644
index 873fcb7..0000000
--- a/src/protobuf/wkt/wrappers_pb.nim
+++ /dev/null
@@ -1,647 +0,0 @@
-# Generated by protoc_gen_nim. Do not edit!
-
-import intsets
-
-import protobuf/protobuf
-
-type
- google_protobuf_DoubleValue* = ref google_protobuf_DoubleValueObj
- google_protobuf_DoubleValueObj* = object of RootObj
- hasField: IntSet
- value: float64
- google_protobuf_FloatValue* = ref google_protobuf_FloatValueObj
- google_protobuf_FloatValueObj* = object of RootObj
- hasField: IntSet
- value: float32
- google_protobuf_Int64Value* = ref google_protobuf_Int64ValueObj
- google_protobuf_Int64ValueObj* = object of RootObj
- hasField: IntSet
- value: int64
- google_protobuf_UInt64Value* = ref google_protobuf_UInt64ValueObj
- google_protobuf_UInt64ValueObj* = object of RootObj
- hasField: IntSet
- value: uint64
- google_protobuf_Int32Value* = ref google_protobuf_Int32ValueObj
- google_protobuf_Int32ValueObj* = object of RootObj
- hasField: IntSet
- value: int32
- google_protobuf_UInt32Value* = ref google_protobuf_UInt32ValueObj
- google_protobuf_UInt32ValueObj* = object of RootObj
- hasField: IntSet
- value: uint32
- google_protobuf_BoolValue* = ref google_protobuf_BoolValueObj
- google_protobuf_BoolValueObj* = object of RootObj
- hasField: IntSet
- value: bool
- google_protobuf_StringValue* = ref google_protobuf_StringValueObj
- google_protobuf_StringValueObj* = object of RootObj
- hasField: IntSet
- value: string
- google_protobuf_BytesValue* = ref google_protobuf_BytesValueObj
- google_protobuf_BytesValueObj* = object of RootObj
- hasField: IntSet
- value: bytes
-
-proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value
-proc writegoogle_protobuf_Int32Value*(stream: ProtobufStream, message: google_protobuf_Int32Value)
-proc readgoogle_protobuf_Int32Value*(stream: ProtobufStream): google_protobuf_Int32Value
-proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64
-
-proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value
-proc writegoogle_protobuf_Int64Value*(stream: ProtobufStream, message: google_protobuf_Int64Value)
-proc readgoogle_protobuf_Int64Value*(stream: ProtobufStream): google_protobuf_Int64Value
-proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64
-
-proc newgoogle_protobuf_DoubleValue*(): google_protobuf_DoubleValue
-proc writegoogle_protobuf_DoubleValue*(stream: ProtobufStream, message: google_protobuf_DoubleValue)
-proc readgoogle_protobuf_DoubleValue*(stream: ProtobufStream): google_protobuf_DoubleValue
-proc sizeOfgoogle_protobuf_DoubleValue*(message: google_protobuf_DoubleValue): uint64
-
-proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue
-proc writegoogle_protobuf_StringValue*(stream: ProtobufStream, message: google_protobuf_StringValue)
-proc readgoogle_protobuf_StringValue*(stream: ProtobufStream): google_protobuf_StringValue
-proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64
-
-proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue
-proc writegoogle_protobuf_BoolValue*(stream: ProtobufStream, message: google_protobuf_BoolValue)
-proc readgoogle_protobuf_BoolValue*(stream: ProtobufStream): google_protobuf_BoolValue
-proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64
-
-proc newgoogle_protobuf_BytesValue*(): google_protobuf_BytesValue
-proc writegoogle_protobuf_BytesValue*(stream: ProtobufStream, message: google_protobuf_BytesValue)
-proc readgoogle_protobuf_BytesValue*(stream: ProtobufStream): google_protobuf_BytesValue
-proc sizeOfgoogle_protobuf_BytesValue*(message: google_protobuf_BytesValue): uint64
-
-proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue
-proc writegoogle_protobuf_FloatValue*(stream: ProtobufStream, message: google_protobuf_FloatValue)
-proc readgoogle_protobuf_FloatValue*(stream: ProtobufStream): google_protobuf_FloatValue
-proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64
-
-proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value
-proc writegoogle_protobuf_UInt64Value*(stream: ProtobufStream, message: google_protobuf_UInt64Value)
-proc readgoogle_protobuf_UInt64Value*(stream: ProtobufStream): google_protobuf_UInt64Value
-proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64
-
-proc newgoogle_protobuf_UInt32Value*(): google_protobuf_UInt32Value
-proc writegoogle_protobuf_UInt32Value*(stream: ProtobufStream, message: google_protobuf_UInt32Value)
-proc readgoogle_protobuf_UInt32Value*(stream: ProtobufStream): google_protobuf_UInt32Value
-proc sizeOfgoogle_protobuf_UInt32Value*(message: google_protobuf_UInt32Value): uint64
-
-proc newgoogle_protobuf_Int32Value*(): google_protobuf_Int32Value =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_Int32Value) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_Int32Value): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_Int32Value, value: int32) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_Int32Value): int32 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_Int32Value, value: int32) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_Int32Value*(message: google_protobuf_Int32Value): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfInt32(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Int32Value*(stream: ProtobufStream, message: google_protobuf_Int32Value) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Varint)
- writeInt32(stream, message.value)
-
-proc readgoogle_protobuf_Int32Value*(stream: ProtobufStream): google_protobuf_Int32Value =
- result = newgoogle_protobuf_Int32Value()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setvalue(result, readInt32(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Int32Value): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Int32Value(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Int32Value*(data: string): google_protobuf_Int32Value =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Int32Value(pbs)
-
-
-proc newgoogle_protobuf_Int64Value*(): google_protobuf_Int64Value =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_Int64Value) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_Int64Value): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_Int64Value, value: int64) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_Int64Value): int64 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_Int64Value, value: int64) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_Int64Value*(message: google_protobuf_Int64Value): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfInt64(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_Int64Value*(stream: ProtobufStream, message: google_protobuf_Int64Value) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Varint)
- writeInt64(stream, message.value)
-
-proc readgoogle_protobuf_Int64Value*(stream: ProtobufStream): google_protobuf_Int64Value =
- result = newgoogle_protobuf_Int64Value()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setvalue(result, readInt64(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_Int64Value): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_Int64Value(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_Int64Value*(data: string): google_protobuf_Int64Value =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_Int64Value(pbs)
-
-
-proc newgoogle_protobuf_DoubleValue*(): google_protobuf_DoubleValue =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_DoubleValue) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_DoubleValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_DoubleValue, value: float64) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_DoubleValue): float64 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_DoubleValue, value: float64) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_DoubleValue*(message: google_protobuf_DoubleValue): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfDouble(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Fixed64)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_DoubleValue*(stream: ProtobufStream, message: google_protobuf_DoubleValue) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Fixed64)
- writeDouble(stream, message.value)
-
-proc readgoogle_protobuf_DoubleValue*(stream: ProtobufStream): google_protobuf_DoubleValue =
- result = newgoogle_protobuf_DoubleValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Fixed64)
- setvalue(result, readDouble(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_DoubleValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_DoubleValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_DoubleValue*(data: string): google_protobuf_DoubleValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_DoubleValue(pbs)
-
-
-proc newgoogle_protobuf_StringValue*(): google_protobuf_StringValue =
- new(result)
- result.hasField = initIntSet()
- result.value = ""
-
-proc clearvalue*(message: google_protobuf_StringValue) =
- message.value = ""
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_StringValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_StringValue, value: string) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_StringValue): string {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_StringValue, value: string) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_StringValue*(message: google_protobuf_StringValue): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfString(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_StringValue*(stream: ProtobufStream, message: google_protobuf_StringValue) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeString(stream, message.value)
-
-proc readgoogle_protobuf_StringValue*(stream: ProtobufStream): google_protobuf_StringValue =
- result = newgoogle_protobuf_StringValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setvalue(result, readString(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_StringValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_StringValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_StringValue*(data: string): google_protobuf_StringValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_StringValue(pbs)
-
-
-proc newgoogle_protobuf_BoolValue*(): google_protobuf_BoolValue =
- new(result)
- result.hasField = initIntSet()
- result.value = false
-
-proc clearvalue*(message: google_protobuf_BoolValue) =
- message.value = false
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_BoolValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_BoolValue, value: bool) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_BoolValue): bool {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_BoolValue, value: bool) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_BoolValue*(message: google_protobuf_BoolValue): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfBool(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_BoolValue*(stream: ProtobufStream, message: google_protobuf_BoolValue) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Varint)
- writeBool(stream, message.value)
-
-proc readgoogle_protobuf_BoolValue*(stream: ProtobufStream): google_protobuf_BoolValue =
- result = newgoogle_protobuf_BoolValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setvalue(result, readBool(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_BoolValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_BoolValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_BoolValue*(data: string): google_protobuf_BoolValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_BoolValue(pbs)
-
-
-proc newgoogle_protobuf_BytesValue*(): google_protobuf_BytesValue =
- new(result)
- result.hasField = initIntSet()
- result.value = bytes("")
-
-proc clearvalue*(message: google_protobuf_BytesValue) =
- message.value = bytes("")
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_BytesValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_BytesValue, value: bytes) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_BytesValue): bytes {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_BytesValue, value: bytes) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_BytesValue*(message: google_protobuf_BytesValue): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfBytes(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.LengthDelimited)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_BytesValue*(stream: ProtobufStream, message: google_protobuf_BytesValue) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.LengthDelimited)
- writeBytes(stream, message.value)
-
-proc readgoogle_protobuf_BytesValue*(stream: ProtobufStream): google_protobuf_BytesValue =
- result = newgoogle_protobuf_BytesValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.LengthDelimited)
- setvalue(result, readBytes(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_BytesValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_BytesValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_BytesValue*(data: string): google_protobuf_BytesValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_BytesValue(pbs)
-
-
-proc newgoogle_protobuf_FloatValue*(): google_protobuf_FloatValue =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_FloatValue) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_FloatValue): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_FloatValue, value: float32) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_FloatValue): float32 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_FloatValue, value: float32) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_FloatValue*(message: google_protobuf_FloatValue): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfFloat(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Fixed32)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_FloatValue*(stream: ProtobufStream, message: google_protobuf_FloatValue) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Fixed32)
- writeFloat(stream, message.value)
-
-proc readgoogle_protobuf_FloatValue*(stream: ProtobufStream): google_protobuf_FloatValue =
- result = newgoogle_protobuf_FloatValue()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Fixed32)
- setvalue(result, readFloat(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_FloatValue): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_FloatValue(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_FloatValue*(data: string): google_protobuf_FloatValue =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_FloatValue(pbs)
-
-
-proc newgoogle_protobuf_UInt64Value*(): google_protobuf_UInt64Value =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_UInt64Value) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_UInt64Value): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_UInt64Value, value: uint64) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_UInt64Value): uint64 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_UInt64Value, value: uint64) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_UInt64Value*(message: google_protobuf_UInt64Value): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfUInt64(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_UInt64Value*(stream: ProtobufStream, message: google_protobuf_UInt64Value) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Varint)
- writeUInt64(stream, message.value)
-
-proc readgoogle_protobuf_UInt64Value*(stream: ProtobufStream): google_protobuf_UInt64Value =
- result = newgoogle_protobuf_UInt64Value()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setvalue(result, readUInt64(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_UInt64Value): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_UInt64Value(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_UInt64Value*(data: string): google_protobuf_UInt64Value =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_UInt64Value(pbs)
-
-
-proc newgoogle_protobuf_UInt32Value*(): google_protobuf_UInt32Value =
- new(result)
- result.hasField = initIntSet()
- result.value = 0
-
-proc clearvalue*(message: google_protobuf_UInt32Value) =
- message.value = 0
- excl(message.hasField, 1)
-
-proc hasvalue*(message: google_protobuf_UInt32Value): bool =
- result = contains(message.hasField, 1)
-
-proc setvalue*(message: google_protobuf_UInt32Value, value: uint32) =
- message.value = value
- incl(message.hasField, 1)
-
-proc value*(message: google_protobuf_UInt32Value): uint32 {.inline.} =
- message.value
-
-proc `value=`*(message: google_protobuf_UInt32Value, value: uint32) {.inline.} =
- setvalue(message, value)
-
-proc sizeOfgoogle_protobuf_UInt32Value*(message: google_protobuf_UInt32Value): uint64 =
- if hasvalue(message):
- let
- sizeOfField = sizeOfUInt32(message.value)
- sizeOfTag = sizeOfUInt32(uint32(makeTag(1, WireType.Varint)))
- result = result + sizeOfField + sizeOfTag
-
-proc writegoogle_protobuf_UInt32Value*(stream: ProtobufStream, message: google_protobuf_UInt32Value) =
- if hasvalue(message):
- writeTag(stream, 1, WireType.Varint)
- writeUInt32(stream, message.value)
-
-proc readgoogle_protobuf_UInt32Value*(stream: ProtobufStream): google_protobuf_UInt32Value =
- result = newgoogle_protobuf_UInt32Value()
- while not atEnd(stream):
- let
- tag = readTag(stream)
- wireType = getTagWireType(tag)
- case getTagFieldNumber(tag)
- of 0:
- raise newException(InvalidFieldNumberError, "Invalid field number: 0")
- of 1:
- expectWireType(wireType, WireType.Varint)
- setvalue(result, readUInt32(stream))
- else: skipField(stream, wireType)
-
-proc serialize*(message: google_protobuf_UInt32Value): string =
- let
- ss = newStringStream()
- pbs = newProtobufStream(ss)
- writegoogle_protobuf_UInt32Value(pbs, message)
- result = ss.data
-
-proc newgoogle_protobuf_UInt32Value*(data: string): google_protobuf_UInt32Value =
- let
- ss = newStringStream(data)
- pbs = newProtobufStream(ss)
- result = readgoogle_protobuf_UInt32Value(pbs)
-
-