mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 20:31:23 +00:00
[C++] Add GetMutableSizePrefixedRoot and generate GetMutableSizePrefixedXxx functions (#6815)
* flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(127): error C2220: warning treated as error - no 'object' file generated
stringify_util.h(127): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'fbs': unreferenced formal parameter
* [C++] Add GetMutableSizePrefixedRoot() and generate a GetMutableSizePrefixed function
When using the mutable API together with size prefixed buffers these functions should be present.
* clang-format
* Cleanup branch for PR
Revert "flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter"
This reverts commit a92055203e.
This commit is contained in:
@@ -505,6 +505,17 @@ class CppGenerator : public BaseGenerator {
|
||||
code_ += " return flatbuffers::GetMutableRoot<{{STRUCT_NAME}}>(buf);";
|
||||
code_ += "}";
|
||||
code_ += "";
|
||||
|
||||
code_ += "inline \\";
|
||||
code_ +=
|
||||
"{{CPP_NAME}} "
|
||||
"*{{NULLABLE_EXT}}GetMutableSizePrefixed{{STRUCT_NAME}}(void "
|
||||
"*buf) {";
|
||||
code_ +=
|
||||
" return "
|
||||
"flatbuffers::GetMutableSizePrefixedRoot<{{CPP_NAME}}>(buf);";
|
||||
code_ += "}";
|
||||
code_ += "";
|
||||
}
|
||||
|
||||
if (parser_.file_identifier_.length()) {
|
||||
|
||||
Reference in New Issue
Block a user