[Yunq] Move repeated field parsing to the yunq library.

This commit is contained in:
Drew Galbraith 2024-01-11 19:36:24 -08:00
parent 9e9ef21a3d
commit 30b220b2fb
4 changed files with 31 additions and 27 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <glacier/buffer/byte_buffer.h>
#include <glacier/container/vector.h>
#include <glacier/status/error_or.h>
namespace yunq {
@ -21,6 +22,9 @@ class MessageView {
template <typename T>
glcr::ErrorOr<T> ReadField(uint64_t field_index);
template <typename T>
glcr::ErrorOr<glcr::Vector<T>> ReadRepeated(uint64_t field_index);
private:
const glcr::ByteBuffer& buffer_;
uint64_t offset_;
@ -37,4 +41,8 @@ template <>
glcr::ErrorOr<glcr::String> MessageView::ReadField<glcr::String>(
uint64_t field_index);
template <>
glcr::ErrorOr<glcr::Vector<uint64_t>> MessageView::ReadRepeated<uint64_t>(
uint64_t field_index);
} // namespace yunq