Skip to content

Commit

Permalink
[Java] ObjectAPI implementation (google#6521) (google#6582)
Browse files Browse the repository at this point in the history
* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)

* [Java] ObjectAPI implementation (google#6521)
  • Loading branch information
ofirm93 authored Jun 3, 2021
1 parent baaffba commit 7c3e267
Show file tree
Hide file tree
Showing 77 changed files with 3,539 additions and 239 deletions.
2 changes: 1 addition & 1 deletion include/flatbuffers/base.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_
# define FLATBUFFERS_BASE_H_

// clang-format off

Expand Down
10 changes: 6 additions & 4 deletions include/flatbuffers/flexbuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1397,10 +1397,12 @@ class Builder FLATBUFFERS_FINAL_CLASS {

template<typename T> static Type GetScalarType() {
static_assert(flatbuffers::is_scalar<T>::value, "Unrelated types");
return flatbuffers::is_floating_point<T>::value ? FBT_FLOAT
: flatbuffers::is_same<T, bool>::value
? FBT_BOOL
: (flatbuffers::is_unsigned<T>::value ? FBT_UINT : FBT_INT);
return flatbuffers::is_floating_point<T>::value
? FBT_FLOAT
: flatbuffers::is_same<T, bool>::value
? FBT_BOOL
: (flatbuffers::is_unsigned<T>::value ? FBT_UINT
: FBT_INT);
}

public:
Expand Down
15 changes: 6 additions & 9 deletions src/idl_gen_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,7 @@ class CppGenerator : public BaseGenerator {
}
case BASE_TYPE_UNION:
// fall through
default: {
return "void";
}
default: { return "void"; }
}
}

Expand Down Expand Up @@ -1009,9 +1007,10 @@ class CppGenerator : public BaseGenerator {
? bt - BASE_TYPE_UTYPE + ET_UTYPE
: ET_SEQUENCE;
int ref_idx = -1;
std::string ref_name = type.struct_def ? WrapInNameSpace(*type.struct_def)
: type.enum_def ? WrapInNameSpace(*type.enum_def)
: "";
std::string ref_name =
type.struct_def
? WrapInNameSpace(*type.struct_def)
: type.enum_def ? WrapInNameSpace(*type.enum_def) : "";
if (!ref_name.empty()) {
auto rit = type_refs.begin();
for (; rit != type_refs.end(); ++rit) {
Expand Down Expand Up @@ -1924,9 +1923,7 @@ class CppGenerator : public BaseGenerator {
}
break;
}
default: {
break;
}
default: { break; }
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/idl_gen_csharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,10 +1515,11 @@ class CSharpGenerator : public BaseGenerator {
case BASE_TYPE_ARRAY: {
auto type_name = GenTypeGet_ObjectAPI(field.value.type, opts);
auto length_str = NumToString(field.value.type.fixed_length);
auto unpack_method = field.value.type.struct_def == nullptr ? ""
: field.value.type.struct_def->fixed
? ".UnPack()"
: "?.UnPack()";
auto unpack_method = field.value.type.struct_def == nullptr
? ""
: field.value.type.struct_def->fixed
? ".UnPack()"
: "?.UnPack()";
code += start + "new " + type_name.substr(0, type_name.length() - 1) +
length_str + "];\n";
code += " for (var _j = 0; _j < " + length_str + "; ++_j) { _o." +
Expand Down
Loading

0 comments on commit 7c3e267

Please sign in to comment.