mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-05 16:26:54 +00:00
idl_gen_cpp.cpp: clang-format run, to better separate changes in content from formatting.
This commit is contained in:
@@ -43,7 +43,7 @@ class CppGenerator : public BaseGenerator {
|
||||
float_const_gen_("std::numeric_limits<double>::",
|
||||
"std::numeric_limits<float>::", "quiet_NaN()",
|
||||
"infinity()") {
|
||||
static const char * const keywords[] = {
|
||||
static const char *const keywords[] = {
|
||||
"alignas",
|
||||
"alignof",
|
||||
"and",
|
||||
@@ -139,7 +139,8 @@ class CppGenerator : public BaseGenerator {
|
||||
"while",
|
||||
"xor",
|
||||
"xor_eq",
|
||||
nullptr };
|
||||
nullptr,
|
||||
};
|
||||
for (auto kw = keywords; *kw; kw++) keywords_.insert(*kw);
|
||||
}
|
||||
|
||||
@@ -494,8 +495,8 @@ class CppGenerator : public BaseGenerator {
|
||||
|
||||
// Return a C++ type from the table in idl.h
|
||||
std::string GenTypeBasic(const Type &type, bool user_facing_type) const {
|
||||
static const char * const ctypename[] = {
|
||||
// clang-format off
|
||||
static const char *const ctypename[] = {
|
||||
// clang-format off
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, \
|
||||
RTYPE) \
|
||||
#CTYPE,
|
||||
@@ -581,8 +582,7 @@ class CppGenerator : public BaseGenerator {
|
||||
bool is_constructor) {
|
||||
auto &ptr_type = PtrType(field);
|
||||
if (ptr_type != "naked") {
|
||||
return (ptr_type != "default_ptr_type" ? ptr_type :
|
||||
parser_.opts.cpp_object_api_pointer_type) + "<" + type + ">";
|
||||
return (ptr_type != "default_ptr_type" ? ptr_type : parser_.opts.cpp_object_api_pointer_type) + "<" + type + ">";
|
||||
} else if (is_constructor) {
|
||||
return "";
|
||||
} else {
|
||||
@@ -1395,7 +1395,7 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
std::string GenDefaultConstant(const FieldDef &field) {
|
||||
if(IsFloat(field.value.type.base_type))
|
||||
if (IsFloat(field.value.type.base_type))
|
||||
return float_const_gen_.GenFloatConstant(field);
|
||||
else
|
||||
return field.value.constant;
|
||||
@@ -1706,7 +1706,6 @@ class CppGenerator : public BaseGenerator {
|
||||
code_ += " }";
|
||||
}
|
||||
|
||||
|
||||
GenFullyQualifiedNameGetter(struct_def, Name(struct_def));
|
||||
|
||||
// Generate field id constants.
|
||||
@@ -2064,7 +2063,8 @@ class CppGenerator : public BaseGenerator {
|
||||
|
||||
// Generate a CreateXDirect function with vector types as parameters
|
||||
if (has_string_or_vector_fields) {
|
||||
code_ += "inline flatbuffers::Offset<{{STRUCT_NAME}}> "
|
||||
code_ +=
|
||||
"inline flatbuffers::Offset<{{STRUCT_NAME}}> "
|
||||
"Create{{STRUCT_NAME}}Direct(";
|
||||
code_ += " flatbuffers::FlatBufferBuilder &_fbb\\";
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
@@ -2294,7 +2294,6 @@ class CppGenerator : public BaseGenerator {
|
||||
type + ">((*_rehasher)(" + value + GenPtrGet(field) + ")) : 0";
|
||||
}
|
||||
|
||||
|
||||
std::string code;
|
||||
switch (field.value.type.base_type) {
|
||||
// String fields are of the form:
|
||||
|
||||
Reference in New Issue
Block a user