Annotated Flatbuffer Binary (#7174)

* Annotated Flatbuffer Binary

* Various fixes

* Handles old schema

* handle multiple missing fields

* minor edits

* bazel fix, spelling fix, ascii fix
This commit is contained in:
Derek Bailey
2022-03-18 14:08:05 -07:00
committed by GitHub
parent 0bceba24db
commit d3aeee32bb
18 changed files with 2520 additions and 7 deletions

View File

@@ -103,6 +103,11 @@ class FlatCompiler {
void Error(const std::string &err, bool usage = true,
bool show_exe_name = true) const;
void AnnotateBinaries(const uint8_t *binary_schema,
uint64_t binary_schema_size,
const std::string & schema_filename,
const std::vector<std::string> &binary_files);
InitParams params_;
};

View File

@@ -279,6 +279,12 @@ T *GetAnyFieldAddressOf(const Struct &st, const reflection::Field &field) {
return reinterpret_cast<T *>(st.GetAddressOf(field.offset()));
}
// Loop over all the fields of the provided `object` and call `func` on each one
// in increasing order by their field->id(). If `reverse` is true, `func` is
// called in descending order
void ForAllFields(const reflection::Object *object, bool reverse,
std::function<void(const reflection::Field *)> func);
// ------------------------- SETTERS -------------------------
// Set any scalar field, if you know its exact type.