mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
Add arbitrary string type to the native object API (#4218)
* Custom strings are very common for optimizations around small objects or growth style optimizations, i.e.: grow at 1.57 times vs doubling vs.. A second common strategy is to cooperate w/ the memory allocator see FBString[1] and seastar[2] string for examples. [1] fbstring: https://github.com/facebook/folly/blob/master/folly/docs/FBString.md [2] sstring: https://github.com/scylladb/seastar/blob/master/core/sstring.hh
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
9c25ecdcd1
commit
f2071e4f80
@@ -86,6 +86,8 @@ std::string FlatCompiler::GetUsageString(const char* program_name) const {
|
||||
" --escape-proto-ids Disable appending '_' in namespaces names.\n"
|
||||
" --gen-object-api Generate an additional object-based API.\n"
|
||||
" --cpp-ptr-type T Set object API pointer type (default std::unique_ptr)\n"
|
||||
" --cpp-str-type T Set object API string type (default std::string)\n"
|
||||
" T::c_str() and T::length() must be supported\n"
|
||||
" --no-js-exports Removes Node.js style export lines in JS.\n"
|
||||
" --goog-js-export Uses goog.exports* for closure compiler exporting in JS.\n"
|
||||
" --raw-binary Allow binaries without file_indentifier to be read.\n"
|
||||
@@ -178,6 +180,9 @@ int FlatCompiler::Compile(int argc, const char** argv) {
|
||||
} else if (arg == "--cpp-ptr-type") {
|
||||
if (++argi >= argc) Error("missing type following" + arg, true);
|
||||
opts.cpp_object_api_pointer_type = argv[argi];
|
||||
} else if (arg == "--cpp-str-type") {
|
||||
if (++argi >= argc) Error("missing type following" + arg, true);
|
||||
opts.cpp_object_api_string_type = argv[argi];
|
||||
} else if(arg == "--gen-all") {
|
||||
opts.generate_all = true;
|
||||
opts.include_dependence_headers = false;
|
||||
|
||||
Reference in New Issue
Block a user