mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
Added a CPP UnPackSizePrefixed<struct_name> generated helper function (#5350)
* Added a cpp UnPackSizePrefixed<struct_name> generated helper function Missing helper function added to the cpp API generator for unpacking size prefixed structures * Added generated test files
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
718ddea558
commit
fe83b68ac6
@@ -474,6 +474,14 @@ class CppGenerator : public BaseGenerator {
|
||||
code_ += "(Get{{STRUCT_NAME}}(buf)->UnPack(res));";
|
||||
code_ += "}";
|
||||
code_ += "";
|
||||
|
||||
code_ += "inline {{UNPACK_RETURN}} UnPackSizePrefixed{{STRUCT_NAME}}(";
|
||||
code_ += " const void *buf,";
|
||||
code_ += " const flatbuffers::resolver_function_t *res = nullptr) {";
|
||||
code_ += " return {{UNPACK_TYPE}}\\";
|
||||
code_ += "(GetSizePrefixed{{STRUCT_NAME}}(buf)->UnPack(res));";
|
||||
code_ += "}";
|
||||
code_ += "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user