2015-11-29 20:31:55 +00:00
|
|
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
|
2015-11-29 20:31:55 +00:00
|
|
|
#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
|
|
|
#define FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|
|
|
|
|
|
|
|
#include "flatbuffers/flatbuffers.h"
|
|
|
|
|
2015-12-10 01:06:11 +00:00
|
|
|
#include "namespace_test1_generated.h"
|
|
|
|
|
2015-11-29 20:31:55 +00:00
|
|
|
namespace NamespaceA {
|
|
|
|
|
|
|
|
struct TableInFirstNS;
|
|
|
|
|
2016-02-13 00:20:33 +00:00
|
|
|
} // namespace NamespaceA
|
|
|
|
|
|
|
|
namespace NamespaceC {
|
|
|
|
|
|
|
|
struct TableInC;
|
|
|
|
|
|
|
|
} // namespace NamespaceC
|
|
|
|
|
|
|
|
namespace NamespaceA {
|
|
|
|
|
|
|
|
struct SecondTableInA;
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *TableInFirstNSTypeTable();
|
2018-02-15 22:58:06 +00:00
|
|
|
|
|
|
|
} // namespace NamespaceA
|
|
|
|
|
|
|
|
namespace NamespaceC {
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *TableInCTypeTable();
|
2018-02-15 22:58:06 +00:00
|
|
|
|
|
|
|
} // namespace NamespaceC
|
|
|
|
|
|
|
|
namespace NamespaceA {
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *SecondTableInATypeTable();
|
2018-02-15 22:58:06 +00:00
|
|
|
|
2015-11-29 20:31:55 +00:00
|
|
|
struct TableInFirstNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
2018-02-15 22:58:06 +00:00
|
|
|
return TableInFirstNSTypeTable();
|
|
|
|
}
|
2018-10-22 22:57:45 +00:00
|
|
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
2015-12-10 01:06:11 +00:00
|
|
|
VT_FOO_TABLE = 4,
|
|
|
|
VT_FOO_ENUM = 6,
|
2016-01-06 16:31:53 +00:00
|
|
|
VT_FOO_STRUCT = 8
|
2015-12-10 01:06:11 +00:00
|
|
|
};
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
const NamespaceA::NamespaceB::TableInNestedNS *foo_table() const {
|
|
|
|
return GetPointer<const NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
|
|
|
}
|
|
|
|
NamespaceA::NamespaceB::TableInNestedNS *mutable_foo_table() {
|
|
|
|
return GetPointer<NamespaceA::NamespaceB::TableInNestedNS *>(VT_FOO_TABLE);
|
|
|
|
}
|
|
|
|
NamespaceA::NamespaceB::EnumInNestedNS foo_enum() const {
|
|
|
|
return static_cast<NamespaceA::NamespaceB::EnumInNestedNS>(GetField<int8_t>(VT_FOO_ENUM, 0));
|
|
|
|
}
|
|
|
|
bool mutate_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS _foo_enum) {
|
2017-03-21 00:36:27 +00:00
|
|
|
return SetField<int8_t>(VT_FOO_ENUM, static_cast<int8_t>(_foo_enum), 0);
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
}
|
|
|
|
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct() const {
|
|
|
|
return GetStruct<const NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
|
|
|
}
|
|
|
|
NamespaceA::NamespaceB::StructInNestedNS *mutable_foo_struct() {
|
|
|
|
return GetStruct<NamespaceA::NamespaceB::StructInNestedNS *>(VT_FOO_STRUCT);
|
|
|
|
}
|
2015-11-29 20:31:55 +00:00
|
|
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
|
|
|
return VerifyTableStart(verifier) &&
|
2017-04-26 21:26:18 +00:00
|
|
|
VerifyOffset(verifier, VT_FOO_TABLE) &&
|
2015-11-29 20:31:55 +00:00
|
|
|
verifier.VerifyTable(foo_table()) &&
|
2015-12-10 01:06:11 +00:00
|
|
|
VerifyField<int8_t>(verifier, VT_FOO_ENUM) &&
|
|
|
|
VerifyField<NamespaceA::NamespaceB::StructInNestedNS>(verifier, VT_FOO_STRUCT) &&
|
2015-11-29 20:31:55 +00:00
|
|
|
verifier.EndTable();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TableInFirstNSBuilder {
|
|
|
|
flatbuffers::FlatBufferBuilder &fbb_;
|
|
|
|
flatbuffers::uoffset_t start_;
|
2017-01-04 18:12:39 +00:00
|
|
|
void add_foo_table(flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table) {
|
|
|
|
fbb_.AddOffset(TableInFirstNS::VT_FOO_TABLE, foo_table);
|
|
|
|
}
|
|
|
|
void add_foo_enum(NamespaceA::NamespaceB::EnumInNestedNS foo_enum) {
|
|
|
|
fbb_.AddElement<int8_t>(TableInFirstNS::VT_FOO_ENUM, static_cast<int8_t>(foo_enum), 0);
|
|
|
|
}
|
|
|
|
void add_foo_struct(const NamespaceA::NamespaceB::StructInNestedNS *foo_struct) {
|
|
|
|
fbb_.AddStruct(TableInFirstNS::VT_FOO_STRUCT, foo_struct);
|
|
|
|
}
|
2017-10-06 15:50:24 +00:00
|
|
|
explicit TableInFirstNSBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
: fbb_(_fbb) {
|
|
|
|
start_ = fbb_.StartTable();
|
|
|
|
}
|
2015-11-29 20:31:55 +00:00
|
|
|
TableInFirstNSBuilder &operator=(const TableInFirstNSBuilder &);
|
|
|
|
flatbuffers::Offset<TableInFirstNS> Finish() {
|
2017-08-21 20:44:23 +00:00
|
|
|
const auto end = fbb_.EndTable(start_);
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
auto o = flatbuffers::Offset<TableInFirstNS>(end);
|
2015-11-29 20:31:55 +00:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
inline flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(
|
|
|
|
flatbuffers::FlatBufferBuilder &_fbb,
|
2016-07-14 17:15:06 +00:00
|
|
|
flatbuffers::Offset<NamespaceA::NamespaceB::TableInNestedNS> foo_table = 0,
|
|
|
|
NamespaceA::NamespaceB::EnumInNestedNS foo_enum = NamespaceA::NamespaceB::EnumInNestedNS_A,
|
|
|
|
const NamespaceA::NamespaceB::StructInNestedNS *foo_struct = 0) {
|
2015-11-29 20:31:55 +00:00
|
|
|
TableInFirstNSBuilder builder_(_fbb);
|
|
|
|
builder_.add_foo_struct(foo_struct);
|
|
|
|
builder_.add_foo_table(foo_table);
|
|
|
|
builder_.add_foo_enum(foo_enum);
|
|
|
|
return builder_.Finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NamespaceA
|
|
|
|
|
2016-02-13 00:20:33 +00:00
|
|
|
namespace NamespaceC {
|
|
|
|
|
|
|
|
struct TableInC FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
2018-02-15 22:58:06 +00:00
|
|
|
return TableInCTypeTable();
|
|
|
|
}
|
2018-10-22 22:57:45 +00:00
|
|
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
2016-02-13 00:20:33 +00:00
|
|
|
VT_REFER_TO_A1 = 4,
|
|
|
|
VT_REFER_TO_A2 = 6
|
|
|
|
};
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
const NamespaceA::TableInFirstNS *refer_to_a1() const {
|
|
|
|
return GetPointer<const NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
|
|
|
}
|
|
|
|
NamespaceA::TableInFirstNS *mutable_refer_to_a1() {
|
|
|
|
return GetPointer<NamespaceA::TableInFirstNS *>(VT_REFER_TO_A1);
|
|
|
|
}
|
|
|
|
const NamespaceA::SecondTableInA *refer_to_a2() const {
|
|
|
|
return GetPointer<const NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
|
|
|
}
|
|
|
|
NamespaceA::SecondTableInA *mutable_refer_to_a2() {
|
|
|
|
return GetPointer<NamespaceA::SecondTableInA *>(VT_REFER_TO_A2);
|
|
|
|
}
|
2016-02-13 00:20:33 +00:00
|
|
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
|
|
|
return VerifyTableStart(verifier) &&
|
2017-04-26 21:26:18 +00:00
|
|
|
VerifyOffset(verifier, VT_REFER_TO_A1) &&
|
2016-02-13 00:20:33 +00:00
|
|
|
verifier.VerifyTable(refer_to_a1()) &&
|
2017-04-26 21:26:18 +00:00
|
|
|
VerifyOffset(verifier, VT_REFER_TO_A2) &&
|
2016-02-13 00:20:33 +00:00
|
|
|
verifier.VerifyTable(refer_to_a2()) &&
|
|
|
|
verifier.EndTable();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TableInCBuilder {
|
|
|
|
flatbuffers::FlatBufferBuilder &fbb_;
|
|
|
|
flatbuffers::uoffset_t start_;
|
2017-01-04 18:12:39 +00:00
|
|
|
void add_refer_to_a1(flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1) {
|
|
|
|
fbb_.AddOffset(TableInC::VT_REFER_TO_A1, refer_to_a1);
|
|
|
|
}
|
|
|
|
void add_refer_to_a2(flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2) {
|
|
|
|
fbb_.AddOffset(TableInC::VT_REFER_TO_A2, refer_to_a2);
|
|
|
|
}
|
2017-10-06 15:50:24 +00:00
|
|
|
explicit TableInCBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
: fbb_(_fbb) {
|
|
|
|
start_ = fbb_.StartTable();
|
|
|
|
}
|
2016-02-13 00:20:33 +00:00
|
|
|
TableInCBuilder &operator=(const TableInCBuilder &);
|
|
|
|
flatbuffers::Offset<TableInC> Finish() {
|
2017-08-21 20:44:23 +00:00
|
|
|
const auto end = fbb_.EndTable(start_);
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
auto o = flatbuffers::Offset<TableInC>(end);
|
2016-02-13 00:20:33 +00:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
inline flatbuffers::Offset<TableInC> CreateTableInC(
|
|
|
|
flatbuffers::FlatBufferBuilder &_fbb,
|
2016-07-14 17:15:06 +00:00
|
|
|
flatbuffers::Offset<NamespaceA::TableInFirstNS> refer_to_a1 = 0,
|
|
|
|
flatbuffers::Offset<NamespaceA::SecondTableInA> refer_to_a2 = 0) {
|
2016-02-13 00:20:33 +00:00
|
|
|
TableInCBuilder builder_(_fbb);
|
|
|
|
builder_.add_refer_to_a2(refer_to_a2);
|
|
|
|
builder_.add_refer_to_a1(refer_to_a1);
|
|
|
|
return builder_.Finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NamespaceC
|
|
|
|
|
|
|
|
namespace NamespaceA {
|
|
|
|
|
|
|
|
struct SecondTableInA FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
2018-02-15 22:58:06 +00:00
|
|
|
return SecondTableInATypeTable();
|
|
|
|
}
|
2018-10-22 22:57:45 +00:00
|
|
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
2016-02-13 00:20:33 +00:00
|
|
|
VT_REFER_TO_C = 4
|
|
|
|
};
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
const NamespaceC::TableInC *refer_to_c() const {
|
|
|
|
return GetPointer<const NamespaceC::TableInC *>(VT_REFER_TO_C);
|
|
|
|
}
|
|
|
|
NamespaceC::TableInC *mutable_refer_to_c() {
|
|
|
|
return GetPointer<NamespaceC::TableInC *>(VT_REFER_TO_C);
|
|
|
|
}
|
2016-02-13 00:20:33 +00:00
|
|
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
|
|
|
return VerifyTableStart(verifier) &&
|
2017-04-26 21:26:18 +00:00
|
|
|
VerifyOffset(verifier, VT_REFER_TO_C) &&
|
2016-02-13 00:20:33 +00:00
|
|
|
verifier.VerifyTable(refer_to_c()) &&
|
|
|
|
verifier.EndTable();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SecondTableInABuilder {
|
|
|
|
flatbuffers::FlatBufferBuilder &fbb_;
|
|
|
|
flatbuffers::uoffset_t start_;
|
2017-01-04 18:12:39 +00:00
|
|
|
void add_refer_to_c(flatbuffers::Offset<NamespaceC::TableInC> refer_to_c) {
|
|
|
|
fbb_.AddOffset(SecondTableInA::VT_REFER_TO_C, refer_to_c);
|
|
|
|
}
|
2017-10-06 15:50:24 +00:00
|
|
|
explicit SecondTableInABuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
: fbb_(_fbb) {
|
|
|
|
start_ = fbb_.StartTable();
|
|
|
|
}
|
2016-02-13 00:20:33 +00:00
|
|
|
SecondTableInABuilder &operator=(const SecondTableInABuilder &);
|
|
|
|
flatbuffers::Offset<SecondTableInA> Finish() {
|
2017-08-21 20:44:23 +00:00
|
|
|
const auto end = fbb_.EndTable(start_);
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
auto o = flatbuffers::Offset<SecondTableInA>(end);
|
2016-02-13 00:20:33 +00:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Add CodeWriter utility class.
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-14 01:44:42 +00:00
|
|
|
inline flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(
|
|
|
|
flatbuffers::FlatBufferBuilder &_fbb,
|
2016-07-14 17:15:06 +00:00
|
|
|
flatbuffers::Offset<NamespaceC::TableInC> refer_to_c = 0) {
|
2016-02-13 00:20:33 +00:00
|
|
|
SecondTableInABuilder builder_(_fbb);
|
|
|
|
builder_.add_refer_to_c(refer_to_c);
|
|
|
|
return builder_.Finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NamespaceA
|
|
|
|
|
2016-07-02 01:08:51 +00:00
|
|
|
namespace NamespaceC {
|
|
|
|
|
|
|
|
} // namespace NamespaceC
|
|
|
|
|
|
|
|
namespace NamespaceA {
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *TableInFirstNSTypeTable() {
|
|
|
|
static const flatbuffers::TypeCode type_codes[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
{ flatbuffers::ET_SEQUENCE, 0, 0 },
|
|
|
|
{ flatbuffers::ET_CHAR, 0, 1 },
|
|
|
|
{ flatbuffers::ET_SEQUENCE, 0, 2 }
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeFunction type_refs[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
NamespaceA::NamespaceB::TableInNestedNSTypeTable,
|
|
|
|
NamespaceA::NamespaceB::EnumInNestedNSTypeTable,
|
|
|
|
NamespaceA::NamespaceB::StructInNestedNSTypeTable
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const char * const names[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
"foo_table",
|
|
|
|
"foo_enum",
|
|
|
|
"foo_struct"
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable tt = {
|
2017-08-25 00:44:03 +00:00
|
|
|
flatbuffers::ST_TABLE, 3, type_codes, type_refs, nullptr, names
|
|
|
|
};
|
|
|
|
return &tt;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NamespaceA
|
|
|
|
|
|
|
|
namespace NamespaceC {
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *TableInCTypeTable() {
|
|
|
|
static const flatbuffers::TypeCode type_codes[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
{ flatbuffers::ET_SEQUENCE, 0, 0 },
|
|
|
|
{ flatbuffers::ET_SEQUENCE, 0, 1 }
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeFunction type_refs[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
NamespaceA::TableInFirstNSTypeTable,
|
|
|
|
NamespaceA::SecondTableInATypeTable
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const char * const names[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
"refer_to_a1",
|
|
|
|
"refer_to_a2"
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable tt = {
|
2017-08-25 00:44:03 +00:00
|
|
|
flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, names
|
|
|
|
};
|
|
|
|
return &tt;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NamespaceC
|
|
|
|
|
|
|
|
namespace NamespaceA {
|
|
|
|
|
2018-03-23 15:58:07 +00:00
|
|
|
inline const flatbuffers::TypeTable *SecondTableInATypeTable() {
|
|
|
|
static const flatbuffers::TypeCode type_codes[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
{ flatbuffers::ET_SEQUENCE, 0, 0 }
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeFunction type_refs[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
NamespaceC::TableInCTypeTable
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const char * const names[] = {
|
2017-08-25 00:44:03 +00:00
|
|
|
"refer_to_c"
|
|
|
|
};
|
2018-03-23 15:58:07 +00:00
|
|
|
static const flatbuffers::TypeTable tt = {
|
2017-08-25 00:44:03 +00:00
|
|
|
flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, names
|
|
|
|
};
|
|
|
|
return &tt;
|
|
|
|
}
|
|
|
|
|
2016-07-02 01:08:51 +00:00
|
|
|
} // namespace NamespaceA
|
|
|
|
|
2015-11-29 20:31:55 +00:00
|
|
|
#endif // FLATBUFFERS_GENERATED_NAMESPACETEST2_NAMESPACEA_H_
|