From 0980e39c9b99659cfd17e8fa33e00a3177345029 Mon Sep 17 00:00:00 2001 From: Shlomi Regev Date: Mon, 12 Jul 2021 09:42:55 -0700 Subject: [PATCH] flexbuffers: Add variant of Blob() that takes a key (#6730) --- include/flatbuffers/flexbuffers.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 049f752cc..0e3593352 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -1072,6 +1072,15 @@ class Builder FLATBUFFERS_FINAL_CLASS { return CreateBlob(flatbuffers::vector_data(v), v.size(), 0, FBT_BLOB); } + void Blob(const char *key, const void *data, size_t len) { + Key(key); + Blob(data, len); + } + void Blob(const char *key, const std::vector &v) { + Key(key); + Blob(v); + } + // TODO(wvo): support all the FlexBuffer types (like flexbuffers::String), // e.g. Vector etc. Also in overloaded versions. // Also some FlatBuffers types?