[C++] flatc --cpp-field-case-style option to permit camel-case field names in C++ (#6669)

* flatc --cpp-field-case option to permit camel-case field names in C++

* fixed option name; cleaned up tabs

* formatting fixed to conform to CI

* resolved comments

* fixed white space indentation

* per PR comments

* rename snake case option to unchanged for clarity, per PR comments

* cleanup of unchanged case option in C++ codegen, per PR 6669 comments

* incorporated PR feedback from vglavnyy

* cleaned up to pass Travis CI / clang format

* bumped PR to retry transient CI failure

* bumped PR to retry transient CI failure

* bump PR

* assert union type field name length > suffix, per PR 6669 comments
This commit is contained in:
Huw Rogers
2021-06-08 19:23:05 +01:00
committed by GitHub
parent 021177af0d
commit f069396d1b
3 changed files with 45 additions and 0 deletions

View File

@@ -536,6 +536,9 @@ struct ServiceDef : public Definition {
// Container of options that may apply to any of the source/text generators.
struct IDLOptions {
// field case style options for C++
enum CaseStyle { CaseStyle_Unchanged = 0, CaseStyle_Upper, CaseStyle_Lower };
bool gen_jvmstatic;
// Use flexbuffers instead for binary and text generation
bool use_flexbuffers;
@@ -558,6 +561,7 @@ struct IDLOptions {
std::string cpp_object_api_pointer_type;
std::string cpp_object_api_string_type;
bool cpp_object_api_string_flexible_constructor;
CaseStyle cpp_object_api_field_case_style;
bool cpp_direct_copy;
bool gen_nullable;
bool java_checkerframework;
@@ -651,6 +655,7 @@ struct IDLOptions {
gen_compare(false),
cpp_object_api_pointer_type("std::unique_ptr"),
cpp_object_api_string_flexible_constructor(false),
cpp_object_api_field_case_style(CaseStyle_Unchanged),
cpp_direct_copy(true),
gen_nullable(false),
java_checkerframework(false),