mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 05:47:36 +00:00
[C++] Object API: document custom string type requirements,
implement better custom string type constructor alternative for Unpack() and fix bug with vector of custom string types in Pack(). Squashed commit of the following: commite9519c647eAuthor: Luca Longinotti <luca.longinotti@inivation.com> Date: Tue Mar 5 18:24:49 2019 +0100 tests: regenerate code, reverts change to CreateVectorOfStrings(). commit117e3b0679Author: Luca Longinotti <luca.longinotti@inivation.com> Date: Tue Mar 5 18:15:05 2019 +0100 idl_gen_cpp.cpp: move clang-format on/off outside of declaration, so they are kept properly aligned automatically. commit4791923806Author: Luca Longinotti <luca.longinotti@inivation.com> Date: Tue Mar 5 18:11:40 2019 +0100 idl_gen_cpp.cpp: full clang-format run with provided Google format file, enforce 80 lines width. commit2f0402f9ffAuthor: Luca Longinotti <luca.longinotti@inivation.com> Date: Tue Mar 5 18:09:32 2019 +0100 CppUsage: address requested changes. idl_gen_cpp.cpp: fix formatting, keep CreateVectorOfStrings for normal string cases. commit371d4e0b79Author: Luca Longinotti <luca.longinotti@inivation.com> Date: Fri Mar 1 16:35:29 2019 +0100 Fix compile error with a vector of non-std::strings. CreateVectorOfStrings() expects a vector of std::string types, but that's not always the case. commit92b90d7f0fAuthor: Luca Longinotti <luca.longinotti@inivation.com> Date: Fri Mar 1 16:15:36 2019 +0100 Document requirement for custom string types to implement empty() and be constructible from std::string. Add new option --cpp-str-flex-ctor to construct custom string types not via std::string, but (char * + length). commit28cb2e92d5Author: Luca Longinotti <luca.longinotti@inivation.com> Date: Fri Mar 1 14:31:17 2019 +0100 idl_gen_cpp.cpp: clang-format run, to better separate changes in content from formatting. Change-Id: I4887ba2f2c632b9e7a8c938659b088cd95690870
This commit is contained in:
@@ -410,6 +410,7 @@ struct IDLOptions {
|
||||
bool gen_compare;
|
||||
std::string cpp_object_api_pointer_type;
|
||||
std::string cpp_object_api_string_type;
|
||||
bool cpp_object_api_string_flexible_constructor;
|
||||
bool gen_nullable;
|
||||
bool gen_generated;
|
||||
std::string object_prefix;
|
||||
@@ -486,6 +487,7 @@ struct IDLOptions {
|
||||
generate_object_based_api(false),
|
||||
gen_compare(false),
|
||||
cpp_object_api_pointer_type("std::unique_ptr"),
|
||||
cpp_object_api_string_flexible_constructor(false),
|
||||
gen_nullable(false),
|
||||
gen_generated(false),
|
||||
object_suffix("T"),
|
||||
@@ -627,6 +629,7 @@ class Parser : public ParserState {
|
||||
known_attributes_["cpp_ptr_type"] = true;
|
||||
known_attributes_["cpp_ptr_type_get"] = true;
|
||||
known_attributes_["cpp_str_type"] = true;
|
||||
known_attributes_["cpp_str_flex_ctor"] = true;
|
||||
known_attributes_["native_inline"] = true;
|
||||
known_attributes_["native_custom_alloc"] = true;
|
||||
known_attributes_["native_type"] = true;
|
||||
|
||||
Reference in New Issue
Block a user