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).
This commit is contained in:
Luca Longinotti
2019-03-01 16:15:36 +01:00
parent 28cb2e92d5
commit 92b90d7f0f
5 changed files with 44 additions and 9 deletions

View File

@@ -75,7 +75,7 @@ Additional options:
- `--allow-non-utf8` : Pass non-UTF-8 input through parser and emit nonstandard
\x escapes in JSON. (Default is to raise parse error on non-UTF-8 input.)
- `--natural-utf8` : Output strings with UTF-8 as human-readable strings.
- `--natural-utf8` : Output strings with UTF-8 as human-readable strings.
By default, UTF-8 characters are printed as \uXXXX escapes."
- `--defaults-json` : Output fields whose value is equal to the default value
@@ -120,7 +120,13 @@ Additional options:
- `--cpp-ptr-type T` : Set object API pointer type (default std::unique_ptr)
- `--cpp-str-type T` : Set object API string type (default std::string)
- T::c_str() and T::length() must be supported.
T::c_str(), T::length() and T::empty() must be supported.
The custom type also needs to be constructible from std::string (see the
--cpp-str-flex-ctor option to change this behavior).
- `--cpp-str-flex-ctor` : Don't construct custom string types by passing
std::string from Flatbuffers, but (char* + length). This allows efficient
construction of custom string types, including zero-copy construction.
- `--object-prefix` : Customise class prefix for C++ object-based API.
@@ -168,7 +174,7 @@ Additional options:
an evolution of. Gives errors if not. Useful to check if schema
modifications don't break schema evolution rules.
- `--conform-includes PATH` : Include path for the schema given with
- `--conform-includes PATH` : Include path for the schema given with
`--conform PATH`.
- `--include-prefix PATH` : Prefix this path to any generated include