[Yunq] POC for moving yunq parsing to a library.

This commit is contained in:
Drew Galbraith 2024-01-11 19:27:57 -08:00
parent 8a711266ef
commit 9e9ef21a3d
8 changed files with 125 additions and 59 deletions

19
lib/yunq/message_view.cpp Normal file
View file

@ -0,0 +1,19 @@
#include "message_view.h"
namespace yunq {
template <>
glcr::ErrorOr<uint64_t> MessageView::ReadField<uint64_t>(uint64_t field_index) {
return buffer_.At<uint64_t>(field_offset(field_index));
}
template <>
glcr::ErrorOr<glcr::String> MessageView::ReadField<glcr::String>(
uint64_t field_index) {
ExtensionPointer ptr =
buffer_.At<ExtensionPointer>(field_offset(field_index));
return buffer_.StringAt(offset_ + ptr.offset, ptr.length);
}
} // namespace yunq