Commit c9a840e9 authored by Hyungjin Kim's avatar Hyungjin Kim Committed by Wouter van Oortmerssen

Change nested_root accessor to be const function.

The `<field>_nested_root()` is not viable from const object. (We usually get `const Monster *`.)

Change-Id: I0d0adcb38dd974318608417ee3094c34fb9c480d
parent 620fe1c5
......@@ -242,7 +242,7 @@ static void GenTable(const Parser &parser, StructDef &struct_def,
auto nested_root = parser.structs_.Lookup(nested->constant);
assert(nested_root); // Guaranteed to exist by parser.
code += " const " + nested_root->name + " *" + field.name;
code += "_nested_root() { return flatbuffers::GetRoot<";
code += "_nested_root() const { return flatbuffers::GetRoot<";
code += nested_root->name + ">(" + field.name + "()->Data()); }\n";
}
// Generate a comparison function for this field if it is a key.
......
......@@ -138,7 +138,7 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<flatbuffers::Offset<Monster>> *testarrayoftables() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(26); }
const Monster *enemy() const { return GetPointer<const Monster *>(28); }
const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(30); }
const Monster *testnestedflatbuffer_nested_root() { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
const Monster *testnestedflatbuffer_nested_root() const { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
const Stat *testempty() const { return GetPointer<const Stat *>(32); }
uint8_t testbool() const { return GetField<uint8_t>(34, 0); }
bool Verify(flatbuffers::Verifier &verifier) const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment