mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 20:43:58 +00:00
* include service in reflection data (fixes #4639) * changes from review * regenerated test data
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
34cb163e38
commit
9bb88a026a
1
.gitignore
vendored
1
.gitignore
vendored
@@ -93,3 +93,4 @@ js/flatbuffers.mjs
|
|||||||
.ninja_log
|
.ninja_log
|
||||||
build.ninja
|
build.ninja
|
||||||
rules.ninja
|
rules.ninja
|
||||||
|
.vscode
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ inline size_t InlineAlignment(const Type &type) {
|
|||||||
struct EnumVal {
|
struct EnumVal {
|
||||||
EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
|
EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
|
||||||
|
|
||||||
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder) const;
|
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::vector<std::string> doc_comment;
|
std::vector<std::string> doc_comment;
|
||||||
@@ -326,8 +326,7 @@ struct EnumDef : public Definition {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<reflection::Enum> Serialize(FlatBufferBuilder *builder,
|
Offset<reflection::Enum> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
const Parser &parser) const;
|
|
||||||
|
|
||||||
SymbolTable<EnumVal> vals;
|
SymbolTable<EnumVal> vals;
|
||||||
bool is_union;
|
bool is_union;
|
||||||
@@ -342,14 +341,15 @@ inline bool EqualByName(const Type &a, const Type &b) {
|
|||||||
(a.enum_def == b.enum_def || a.enum_def->name == b.enum_def->name);
|
(a.enum_def == b.enum_def || a.enum_def->name == b.enum_def->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RPCCall {
|
struct RPCCall : public Definition {
|
||||||
std::string name;
|
Offset<reflection::RPCCall> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
SymbolTable<Value> attributes;
|
|
||||||
StructDef *request, *response;
|
StructDef *request, *response;
|
||||||
std::vector<std::string> rpc_comment;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServiceDef : public Definition {
|
struct ServiceDef : public Definition {
|
||||||
|
Offset<reflection::Service> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
|
|
||||||
SymbolTable<RPCCall> calls;
|
SymbolTable<RPCCall> calls;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -382,6 +382,7 @@ struct IDLOptions {
|
|||||||
std::string include_prefix;
|
std::string include_prefix;
|
||||||
bool keep_include_path;
|
bool keep_include_path;
|
||||||
bool binary_schema_comments;
|
bool binary_schema_comments;
|
||||||
|
bool binary_schema_builtins;
|
||||||
bool skip_flatbuffers_import;
|
bool skip_flatbuffers_import;
|
||||||
std::string go_import;
|
std::string go_import;
|
||||||
std::string go_namespace;
|
std::string go_namespace;
|
||||||
@@ -440,6 +441,7 @@ struct IDLOptions {
|
|||||||
allow_non_utf8(false),
|
allow_non_utf8(false),
|
||||||
keep_include_path(false),
|
keep_include_path(false),
|
||||||
binary_schema_comments(false),
|
binary_schema_comments(false),
|
||||||
|
binary_schema_builtins(false),
|
||||||
skip_flatbuffers_import(false),
|
skip_flatbuffers_import(false),
|
||||||
reexport_ts_modules(true),
|
reexport_ts_modules(true),
|
||||||
protobuf_ascii_alike(false),
|
protobuf_ascii_alike(false),
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ struct Field;
|
|||||||
|
|
||||||
struct Object;
|
struct Object;
|
||||||
|
|
||||||
|
struct RPCCall;
|
||||||
|
|
||||||
|
struct Service;
|
||||||
|
|
||||||
struct Schema;
|
struct Schema;
|
||||||
|
|
||||||
enum BaseType {
|
enum BaseType {
|
||||||
@@ -228,7 +232,8 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
VT_NAME = 4,
|
VT_NAME = 4,
|
||||||
VT_VALUE = 6,
|
VT_VALUE = 6,
|
||||||
VT_OBJECT = 8,
|
VT_OBJECT = 8,
|
||||||
VT_UNION_TYPE = 10
|
VT_UNION_TYPE = 10,
|
||||||
|
VT_DOCUMENTATION = 12
|
||||||
};
|
};
|
||||||
const flatbuffers::String *name() const {
|
const flatbuffers::String *name() const {
|
||||||
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
||||||
@@ -255,6 +260,9 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
const Type *union_type() const {
|
const Type *union_type() const {
|
||||||
return GetPointer<const Type *>(VT_UNION_TYPE);
|
return GetPointer<const Type *>(VT_UNION_TYPE);
|
||||||
}
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
|
||||||
|
}
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyOffsetRequired(verifier, VT_NAME) &&
|
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||||
@@ -264,6 +272,9 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
verifier.VerifyTable(object()) &&
|
verifier.VerifyTable(object()) &&
|
||||||
VerifyOffset(verifier, VT_UNION_TYPE) &&
|
VerifyOffset(verifier, VT_UNION_TYPE) &&
|
||||||
verifier.VerifyTable(union_type()) &&
|
verifier.VerifyTable(union_type()) &&
|
||||||
|
VerifyOffset(verifier, VT_DOCUMENTATION) &&
|
||||||
|
verifier.Verify(documentation()) &&
|
||||||
|
verifier.VerifyVectorOfStrings(documentation()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -283,6 +294,9 @@ struct EnumValBuilder {
|
|||||||
void add_union_type(flatbuffers::Offset<Type> union_type) {
|
void add_union_type(flatbuffers::Offset<Type> union_type) {
|
||||||
fbb_.AddOffset(EnumVal::VT_UNION_TYPE, union_type);
|
fbb_.AddOffset(EnumVal::VT_UNION_TYPE, union_type);
|
||||||
}
|
}
|
||||||
|
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
|
||||||
|
fbb_.AddOffset(EnumVal::VT_DOCUMENTATION, documentation);
|
||||||
|
}
|
||||||
explicit EnumValBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
explicit EnumValBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
: fbb_(_fbb) {
|
: fbb_(_fbb) {
|
||||||
start_ = fbb_.StartTable();
|
start_ = fbb_.StartTable();
|
||||||
@@ -301,9 +315,11 @@ inline flatbuffers::Offset<EnumVal> CreateEnumVal(
|
|||||||
flatbuffers::Offset<flatbuffers::String> name = 0,
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||||
int64_t value = 0,
|
int64_t value = 0,
|
||||||
flatbuffers::Offset<Object> object = 0,
|
flatbuffers::Offset<Object> object = 0,
|
||||||
flatbuffers::Offset<Type> union_type = 0) {
|
flatbuffers::Offset<Type> union_type = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
|
||||||
EnumValBuilder builder_(_fbb);
|
EnumValBuilder builder_(_fbb);
|
||||||
builder_.add_value(value);
|
builder_.add_value(value);
|
||||||
|
builder_.add_documentation(documentation);
|
||||||
builder_.add_union_type(union_type);
|
builder_.add_union_type(union_type);
|
||||||
builder_.add_object(object);
|
builder_.add_object(object);
|
||||||
builder_.add_name(name);
|
builder_.add_name(name);
|
||||||
@@ -315,13 +331,15 @@ inline flatbuffers::Offset<EnumVal> CreateEnumValDirect(
|
|||||||
const char *name = nullptr,
|
const char *name = nullptr,
|
||||||
int64_t value = 0,
|
int64_t value = 0,
|
||||||
flatbuffers::Offset<Object> object = 0,
|
flatbuffers::Offset<Object> object = 0,
|
||||||
flatbuffers::Offset<Type> union_type = 0) {
|
flatbuffers::Offset<Type> union_type = 0,
|
||||||
|
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
|
||||||
return reflection::CreateEnumVal(
|
return reflection::CreateEnumVal(
|
||||||
_fbb,
|
_fbb,
|
||||||
name ? _fbb.CreateString(name) : 0,
|
name ? _fbb.CreateString(name) : 0,
|
||||||
value,
|
value,
|
||||||
object,
|
object,
|
||||||
union_type);
|
union_type,
|
||||||
|
documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
@@ -766,13 +784,224 @@ inline flatbuffers::Offset<Object> CreateObjectDirect(
|
|||||||
documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0);
|
documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
|
enum {
|
||||||
|
VT_NAME = 4,
|
||||||
|
VT_REQUEST = 6,
|
||||||
|
VT_RESPONSE = 8,
|
||||||
|
VT_ATTRIBUTES = 10,
|
||||||
|
VT_DOCUMENTATION = 12
|
||||||
|
};
|
||||||
|
const flatbuffers::String *name() const {
|
||||||
|
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
||||||
|
}
|
||||||
|
bool KeyCompareLessThan(const RPCCall *o) const {
|
||||||
|
return *name() < *o->name();
|
||||||
|
}
|
||||||
|
int KeyCompareWithValue(const char *val) const {
|
||||||
|
return strcmp(name()->c_str(), val);
|
||||||
|
}
|
||||||
|
const Object *request() const {
|
||||||
|
return GetPointer<const Object *>(VT_REQUEST);
|
||||||
|
}
|
||||||
|
const Object *response() const {
|
||||||
|
return GetPointer<const Object *>(VT_RESPONSE);
|
||||||
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *attributes() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *>(VT_ATTRIBUTES);
|
||||||
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
|
||||||
|
}
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||||
|
verifier.Verify(name()) &&
|
||||||
|
VerifyOffsetRequired(verifier, VT_REQUEST) &&
|
||||||
|
verifier.VerifyTable(request()) &&
|
||||||
|
VerifyOffsetRequired(verifier, VT_RESPONSE) &&
|
||||||
|
verifier.VerifyTable(response()) &&
|
||||||
|
VerifyOffset(verifier, VT_ATTRIBUTES) &&
|
||||||
|
verifier.Verify(attributes()) &&
|
||||||
|
verifier.VerifyVectorOfTables(attributes()) &&
|
||||||
|
VerifyOffset(verifier, VT_DOCUMENTATION) &&
|
||||||
|
verifier.Verify(documentation()) &&
|
||||||
|
verifier.VerifyVectorOfStrings(documentation()) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RPCCallBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
|
||||||
|
fbb_.AddOffset(RPCCall::VT_NAME, name);
|
||||||
|
}
|
||||||
|
void add_request(flatbuffers::Offset<Object> request) {
|
||||||
|
fbb_.AddOffset(RPCCall::VT_REQUEST, request);
|
||||||
|
}
|
||||||
|
void add_response(flatbuffers::Offset<Object> response) {
|
||||||
|
fbb_.AddOffset(RPCCall::VT_RESPONSE, response);
|
||||||
|
}
|
||||||
|
void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> attributes) {
|
||||||
|
fbb_.AddOffset(RPCCall::VT_ATTRIBUTES, attributes);
|
||||||
|
}
|
||||||
|
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
|
||||||
|
fbb_.AddOffset(RPCCall::VT_DOCUMENTATION, documentation);
|
||||||
|
}
|
||||||
|
explicit RPCCallBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
|
: fbb_(_fbb) {
|
||||||
|
start_ = fbb_.StartTable();
|
||||||
|
}
|
||||||
|
RPCCallBuilder &operator=(const RPCCallBuilder &);
|
||||||
|
flatbuffers::Offset<RPCCall> Finish() {
|
||||||
|
const auto end = fbb_.EndTable(start_);
|
||||||
|
auto o = flatbuffers::Offset<RPCCall>(end);
|
||||||
|
fbb_.Required(o, RPCCall::VT_NAME);
|
||||||
|
fbb_.Required(o, RPCCall::VT_REQUEST);
|
||||||
|
fbb_.Required(o, RPCCall::VT_RESPONSE);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<RPCCall> CreateRPCCall(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||||
|
flatbuffers::Offset<Object> request = 0,
|
||||||
|
flatbuffers::Offset<Object> response = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> attributes = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
|
||||||
|
RPCCallBuilder builder_(_fbb);
|
||||||
|
builder_.add_documentation(documentation);
|
||||||
|
builder_.add_attributes(attributes);
|
||||||
|
builder_.add_response(response);
|
||||||
|
builder_.add_request(request);
|
||||||
|
builder_.add_name(name);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<RPCCall> CreateRPCCallDirect(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
const char *name = nullptr,
|
||||||
|
flatbuffers::Offset<Object> request = 0,
|
||||||
|
flatbuffers::Offset<Object> response = 0,
|
||||||
|
const std::vector<flatbuffers::Offset<KeyValue>> *attributes = nullptr,
|
||||||
|
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
|
||||||
|
return reflection::CreateRPCCall(
|
||||||
|
_fbb,
|
||||||
|
name ? _fbb.CreateString(name) : 0,
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
attributes ? _fbb.CreateVector<flatbuffers::Offset<KeyValue>>(*attributes) : 0,
|
||||||
|
documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
|
enum {
|
||||||
|
VT_NAME = 4,
|
||||||
|
VT_CALLS = 6,
|
||||||
|
VT_ATTRIBUTES = 8,
|
||||||
|
VT_DOCUMENTATION = 10
|
||||||
|
};
|
||||||
|
const flatbuffers::String *name() const {
|
||||||
|
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
||||||
|
}
|
||||||
|
bool KeyCompareLessThan(const Service *o) const {
|
||||||
|
return *name() < *o->name();
|
||||||
|
}
|
||||||
|
int KeyCompareWithValue(const char *val) const {
|
||||||
|
return strcmp(name()->c_str(), val);
|
||||||
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<RPCCall>> *calls() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<RPCCall>> *>(VT_CALLS);
|
||||||
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *attributes() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *>(VT_ATTRIBUTES);
|
||||||
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
|
||||||
|
}
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||||
|
verifier.Verify(name()) &&
|
||||||
|
VerifyOffset(verifier, VT_CALLS) &&
|
||||||
|
verifier.Verify(calls()) &&
|
||||||
|
verifier.VerifyVectorOfTables(calls()) &&
|
||||||
|
VerifyOffset(verifier, VT_ATTRIBUTES) &&
|
||||||
|
verifier.Verify(attributes()) &&
|
||||||
|
verifier.VerifyVectorOfTables(attributes()) &&
|
||||||
|
VerifyOffset(verifier, VT_DOCUMENTATION) &&
|
||||||
|
verifier.Verify(documentation()) &&
|
||||||
|
verifier.VerifyVectorOfStrings(documentation()) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ServiceBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
|
||||||
|
fbb_.AddOffset(Service::VT_NAME, name);
|
||||||
|
}
|
||||||
|
void add_calls(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RPCCall>>> calls) {
|
||||||
|
fbb_.AddOffset(Service::VT_CALLS, calls);
|
||||||
|
}
|
||||||
|
void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> attributes) {
|
||||||
|
fbb_.AddOffset(Service::VT_ATTRIBUTES, attributes);
|
||||||
|
}
|
||||||
|
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
|
||||||
|
fbb_.AddOffset(Service::VT_DOCUMENTATION, documentation);
|
||||||
|
}
|
||||||
|
explicit ServiceBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
|
: fbb_(_fbb) {
|
||||||
|
start_ = fbb_.StartTable();
|
||||||
|
}
|
||||||
|
ServiceBuilder &operator=(const ServiceBuilder &);
|
||||||
|
flatbuffers::Offset<Service> Finish() {
|
||||||
|
const auto end = fbb_.EndTable(start_);
|
||||||
|
auto o = flatbuffers::Offset<Service>(end);
|
||||||
|
fbb_.Required(o, Service::VT_NAME);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<Service> CreateService(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RPCCall>>> calls = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> attributes = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
|
||||||
|
ServiceBuilder builder_(_fbb);
|
||||||
|
builder_.add_documentation(documentation);
|
||||||
|
builder_.add_attributes(attributes);
|
||||||
|
builder_.add_calls(calls);
|
||||||
|
builder_.add_name(name);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<Service> CreateServiceDirect(
|
||||||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
const char *name = nullptr,
|
||||||
|
const std::vector<flatbuffers::Offset<RPCCall>> *calls = nullptr,
|
||||||
|
const std::vector<flatbuffers::Offset<KeyValue>> *attributes = nullptr,
|
||||||
|
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
|
||||||
|
return reflection::CreateService(
|
||||||
|
_fbb,
|
||||||
|
name ? _fbb.CreateString(name) : 0,
|
||||||
|
calls ? _fbb.CreateVector<flatbuffers::Offset<RPCCall>>(*calls) : 0,
|
||||||
|
attributes ? _fbb.CreateVector<flatbuffers::Offset<KeyValue>>(*attributes) : 0,
|
||||||
|
documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
enum {
|
enum {
|
||||||
VT_OBJECTS = 4,
|
VT_OBJECTS = 4,
|
||||||
VT_ENUMS = 6,
|
VT_ENUMS = 6,
|
||||||
VT_FILE_IDENT = 8,
|
VT_FILE_IDENT = 8,
|
||||||
VT_FILE_EXT = 10,
|
VT_FILE_EXT = 10,
|
||||||
VT_ROOT_TABLE = 12
|
VT_ROOT_TABLE = 12,
|
||||||
|
VT_SERVICES = 14
|
||||||
};
|
};
|
||||||
const flatbuffers::Vector<flatbuffers::Offset<Object>> *objects() const {
|
const flatbuffers::Vector<flatbuffers::Offset<Object>> *objects() const {
|
||||||
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Object>> *>(VT_OBJECTS);
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Object>> *>(VT_OBJECTS);
|
||||||
@@ -789,6 +1018,9 @@ struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
const Object *root_table() const {
|
const Object *root_table() const {
|
||||||
return GetPointer<const Object *>(VT_ROOT_TABLE);
|
return GetPointer<const Object *>(VT_ROOT_TABLE);
|
||||||
}
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<Service>> *services() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Service>> *>(VT_SERVICES);
|
||||||
|
}
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyOffsetRequired(verifier, VT_OBJECTS) &&
|
VerifyOffsetRequired(verifier, VT_OBJECTS) &&
|
||||||
@@ -803,6 +1035,9 @@ struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
verifier.Verify(file_ext()) &&
|
verifier.Verify(file_ext()) &&
|
||||||
VerifyOffset(verifier, VT_ROOT_TABLE) &&
|
VerifyOffset(verifier, VT_ROOT_TABLE) &&
|
||||||
verifier.VerifyTable(root_table()) &&
|
verifier.VerifyTable(root_table()) &&
|
||||||
|
VerifyOffset(verifier, VT_SERVICES) &&
|
||||||
|
verifier.Verify(services()) &&
|
||||||
|
verifier.VerifyVectorOfTables(services()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -825,6 +1060,9 @@ struct SchemaBuilder {
|
|||||||
void add_root_table(flatbuffers::Offset<Object> root_table) {
|
void add_root_table(flatbuffers::Offset<Object> root_table) {
|
||||||
fbb_.AddOffset(Schema::VT_ROOT_TABLE, root_table);
|
fbb_.AddOffset(Schema::VT_ROOT_TABLE, root_table);
|
||||||
}
|
}
|
||||||
|
void add_services(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Service>>> services) {
|
||||||
|
fbb_.AddOffset(Schema::VT_SERVICES, services);
|
||||||
|
}
|
||||||
explicit SchemaBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
explicit SchemaBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
: fbb_(_fbb) {
|
: fbb_(_fbb) {
|
||||||
start_ = fbb_.StartTable();
|
start_ = fbb_.StartTable();
|
||||||
@@ -845,8 +1083,10 @@ inline flatbuffers::Offset<Schema> CreateSchema(
|
|||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Enum>>> enums = 0,
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Enum>>> enums = 0,
|
||||||
flatbuffers::Offset<flatbuffers::String> file_ident = 0,
|
flatbuffers::Offset<flatbuffers::String> file_ident = 0,
|
||||||
flatbuffers::Offset<flatbuffers::String> file_ext = 0,
|
flatbuffers::Offset<flatbuffers::String> file_ext = 0,
|
||||||
flatbuffers::Offset<Object> root_table = 0) {
|
flatbuffers::Offset<Object> root_table = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Service>>> services = 0) {
|
||||||
SchemaBuilder builder_(_fbb);
|
SchemaBuilder builder_(_fbb);
|
||||||
|
builder_.add_services(services);
|
||||||
builder_.add_root_table(root_table);
|
builder_.add_root_table(root_table);
|
||||||
builder_.add_file_ext(file_ext);
|
builder_.add_file_ext(file_ext);
|
||||||
builder_.add_file_ident(file_ident);
|
builder_.add_file_ident(file_ident);
|
||||||
@@ -861,14 +1101,16 @@ inline flatbuffers::Offset<Schema> CreateSchemaDirect(
|
|||||||
const std::vector<flatbuffers::Offset<Enum>> *enums = nullptr,
|
const std::vector<flatbuffers::Offset<Enum>> *enums = nullptr,
|
||||||
const char *file_ident = nullptr,
|
const char *file_ident = nullptr,
|
||||||
const char *file_ext = nullptr,
|
const char *file_ext = nullptr,
|
||||||
flatbuffers::Offset<Object> root_table = 0) {
|
flatbuffers::Offset<Object> root_table = 0,
|
||||||
|
const std::vector<flatbuffers::Offset<Service>> *services = nullptr) {
|
||||||
return reflection::CreateSchema(
|
return reflection::CreateSchema(
|
||||||
_fbb,
|
_fbb,
|
||||||
objects ? _fbb.CreateVector<flatbuffers::Offset<Object>>(*objects) : 0,
|
objects ? _fbb.CreateVector<flatbuffers::Offset<Object>>(*objects) : 0,
|
||||||
enums ? _fbb.CreateVector<flatbuffers::Offset<Enum>>(*enums) : 0,
|
enums ? _fbb.CreateVector<flatbuffers::Offset<Enum>>(*enums) : 0,
|
||||||
file_ident ? _fbb.CreateString(file_ident) : 0,
|
file_ident ? _fbb.CreateString(file_ident) : 0,
|
||||||
file_ext ? _fbb.CreateString(file_ext) : 0,
|
file_ext ? _fbb.CreateString(file_ext) : 0,
|
||||||
root_table);
|
root_table,
|
||||||
|
services ? _fbb.CreateVector<flatbuffers::Offset<Service>>(*services) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const reflection::Schema *GetSchema(const void *buf) {
|
inline const reflection::Schema *GetSchema(const void *buf) {
|
||||||
|
|||||||
0
reflection/generate_code.sh
Normal file → Executable file
0
reflection/generate_code.sh
Normal file → Executable file
@@ -44,6 +44,7 @@ table EnumVal {
|
|||||||
value:long (key);
|
value:long (key);
|
||||||
object:Object; // Will be deprecated in favor of union_type in the future.
|
object:Object; // Will be deprecated in favor of union_type in the future.
|
||||||
union_type:Type;
|
union_type:Type;
|
||||||
|
documentation:[string];
|
||||||
}
|
}
|
||||||
|
|
||||||
table Enum {
|
table Enum {
|
||||||
@@ -79,12 +80,28 @@ table Object { // Used for both tables and structs.
|
|||||||
documentation:[string];
|
documentation:[string];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table RPCCall {
|
||||||
|
name:string (required, key);
|
||||||
|
request:Object (required); // must be a table (not a struct)
|
||||||
|
response:Object (required); // must be a table (not a struct)
|
||||||
|
attributes:[KeyValue];
|
||||||
|
documentation:[string];
|
||||||
|
}
|
||||||
|
|
||||||
|
table Service {
|
||||||
|
name:string (required, key);
|
||||||
|
calls:[RPCCall];
|
||||||
|
attributes:[KeyValue];
|
||||||
|
documentation:[string];
|
||||||
|
}
|
||||||
|
|
||||||
table Schema {
|
table Schema {
|
||||||
objects:[Object] (required); // Sorted.
|
objects:[Object] (required); // Sorted.
|
||||||
enums:[Enum] (required); // Sorted.
|
enums:[Enum] (required); // Sorted.
|
||||||
file_ident:string;
|
file_ident:string;
|
||||||
file_ext:string;
|
file_ext:string;
|
||||||
root_table:Object;
|
root_table:Object;
|
||||||
|
services:[Service]; // Sorted.
|
||||||
}
|
}
|
||||||
|
|
||||||
root_type Schema;
|
root_type Schema;
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
|
|||||||
" --grpc Generate GRPC interfaces for the specified languages\n"
|
" --grpc Generate GRPC interfaces for the specified languages\n"
|
||||||
" --schema Serialize schemas instead of JSON (use with -b)\n"
|
" --schema Serialize schemas instead of JSON (use with -b)\n"
|
||||||
" --bfbs-comments Add doc comments to the binary schema files.\n"
|
" --bfbs-comments Add doc comments to the binary schema files.\n"
|
||||||
|
" --bfbs-builtins Add builtin attributes to the binary schema files.\n"
|
||||||
" --conform FILE Specify a schema the following schemas should be\n"
|
" --conform FILE Specify a schema the following schemas should be\n"
|
||||||
" an evolution of. Gives errors if not.\n"
|
" an evolution of. Gives errors if not.\n"
|
||||||
" --conform-includes Include path for the schema given with --conform\n"
|
" --conform-includes Include path for the schema given with --conform\n"
|
||||||
@@ -253,6 +254,8 @@ int FlatCompiler::Compile(int argc, const char **argv) {
|
|||||||
grpc_enabled = true;
|
grpc_enabled = true;
|
||||||
} else if (arg == "--bfbs-comments") {
|
} else if (arg == "--bfbs-comments") {
|
||||||
opts.binary_schema_comments = true;
|
opts.binary_schema_comments = true;
|
||||||
|
} else if (arg == "--bfbs-builtins") {
|
||||||
|
opts.binary_schema_builtins = true;
|
||||||
} else if (arg == "--no-fb-import") {
|
} else if (arg == "--no-fb-import") {
|
||||||
opts.skip_flatbuffers_import = true;
|
opts.skip_flatbuffers_import = true;
|
||||||
} else if (arg == "--no-ts-reexport") {
|
} else if (arg == "--no-ts-reexport") {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class FlatBufMethod : public grpc_generator::Method {
|
|||||||
grpc::string GetLeadingComments(const grpc::string) const { return ""; }
|
grpc::string GetLeadingComments(const grpc::string) const { return ""; }
|
||||||
grpc::string GetTrailingComments(const grpc::string) const { return ""; }
|
grpc::string GetTrailingComments(const grpc::string) const { return ""; }
|
||||||
std::vector<grpc::string> GetAllComments() const {
|
std::vector<grpc::string> GetAllComments() const {
|
||||||
return method_->rpc_comment;
|
return method_->doc_comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name() const { return method_->name; }
|
std::string name() const { return method_->name; }
|
||||||
|
|||||||
@@ -1724,7 +1724,7 @@ CheckedError Parser::ParseService() {
|
|||||||
ECHECK(ParseMetaData(&service_def.attributes));
|
ECHECK(ParseMetaData(&service_def.attributes));
|
||||||
EXPECT('{');
|
EXPECT('{');
|
||||||
do {
|
do {
|
||||||
std::vector<std::string> rpc_comment = doc_comment_;
|
std::vector<std::string> doc_comment = doc_comment_;
|
||||||
auto rpc_name = attribute_;
|
auto rpc_name = attribute_;
|
||||||
EXPECT(kTokenIdentifier);
|
EXPECT(kTokenIdentifier);
|
||||||
EXPECT('(');
|
EXPECT('(');
|
||||||
@@ -1740,7 +1740,7 @@ CheckedError Parser::ParseService() {
|
|||||||
rpc.name = rpc_name;
|
rpc.name = rpc_name;
|
||||||
rpc.request = reqtype.struct_def;
|
rpc.request = reqtype.struct_def;
|
||||||
rpc.response = resptype.struct_def;
|
rpc.response = resptype.struct_def;
|
||||||
rpc.rpc_comment = rpc_comment;
|
rpc.doc_comment = doc_comment;
|
||||||
if (service_def.calls.Add(rpc_name, &rpc))
|
if (service_def.calls.Add(rpc_name, &rpc))
|
||||||
return Error("rpc already exists: " + rpc_name);
|
return Error("rpc already exists: " + rpc_name);
|
||||||
ECHECK(ParseMetaData(&rpc.attributes));
|
ECHECK(ParseMetaData(&rpc.attributes));
|
||||||
@@ -2527,12 +2527,20 @@ void Parser::Serialize() {
|
|||||||
enum_offsets.push_back(offset);
|
enum_offsets.push_back(offset);
|
||||||
(*it)->serialized_location = offset.o;
|
(*it)->serialized_location = offset.o;
|
||||||
}
|
}
|
||||||
|
std::vector<Offset<reflection::Service>> service_offsets;
|
||||||
|
for (auto it = services_.vec.begin(); it != services_.vec.end(); ++it) {
|
||||||
|
auto offset = (*it)->Serialize(&builder_, *this);
|
||||||
|
service_offsets.push_back(offset);
|
||||||
|
(*it)->serialized_location = offset.o;
|
||||||
|
}
|
||||||
auto schema_offset = reflection::CreateSchema(
|
auto schema_offset = reflection::CreateSchema(
|
||||||
builder_, builder_.CreateVectorOfSortedTables(&object_offsets),
|
builder_,
|
||||||
|
builder_.CreateVectorOfSortedTables(&object_offsets),
|
||||||
builder_.CreateVectorOfSortedTables(&enum_offsets),
|
builder_.CreateVectorOfSortedTables(&enum_offsets),
|
||||||
builder_.CreateString(file_identifier_),
|
builder_.CreateString(file_identifier_),
|
||||||
builder_.CreateString(file_extension_),
|
builder_.CreateString(file_extension_),
|
||||||
root_struct_def_ ? root_struct_def_->serialized_location : 0);
|
(root_struct_def_ ? root_struct_def_->serialized_location : 0),
|
||||||
|
builder_.CreateVectorOfSortedTables(&service_offsets));
|
||||||
if (opts.size_prefixed) {
|
if (opts.size_prefixed) {
|
||||||
builder_.FinishSizePrefixed(schema_offset, reflection::SchemaIdentifier());
|
builder_.FinishSizePrefixed(schema_offset, reflection::SchemaIdentifier());
|
||||||
} else {
|
} else {
|
||||||
@@ -2549,9 +2557,12 @@ Offset<reflection::Object> StructDef::Serialize(FlatBufferBuilder *builder,
|
|||||||
}
|
}
|
||||||
auto qualified_name = defined_namespace->GetFullyQualifiedName(name);
|
auto qualified_name = defined_namespace->GetFullyQualifiedName(name);
|
||||||
return reflection::CreateObject(
|
return reflection::CreateObject(
|
||||||
*builder, builder->CreateString(qualified_name),
|
*builder,
|
||||||
builder->CreateVectorOfSortedTables(&field_offsets), fixed,
|
builder->CreateString(qualified_name),
|
||||||
static_cast<int>(minalign), static_cast<int>(bytesize),
|
builder->CreateVectorOfSortedTables(&field_offsets),
|
||||||
|
fixed,
|
||||||
|
static_cast<int>(minalign),
|
||||||
|
static_cast<int>(bytesize),
|
||||||
SerializeAttributes(builder, parser),
|
SerializeAttributes(builder, parser),
|
||||||
parser.opts.binary_schema_comments
|
parser.opts.binary_schema_comments
|
||||||
? builder->CreateVectorOfStrings(doc_comment)
|
? builder->CreateVectorOfStrings(doc_comment)
|
||||||
@@ -2575,33 +2586,72 @@ Offset<reflection::Field> FieldDef::Serialize(FlatBufferBuilder *builder,
|
|||||||
// space by sharing it. Same for common values of value.type.
|
// space by sharing it. Same for common values of value.type.
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<reflection::Enum> EnumDef::Serialize(FlatBufferBuilder *builder,
|
Offset<reflection::RPCCall> RPCCall::Serialize(FlatBufferBuilder *builder,
|
||||||
const Parser &parser) const {
|
const Parser &parser) const {
|
||||||
std::vector<Offset<reflection::EnumVal>> enumval_offsets;
|
return reflection::CreateRPCCall(
|
||||||
for (auto it = vals.vec.begin(); it != vals.vec.end(); ++it) {
|
*builder,
|
||||||
enumval_offsets.push_back((*it)->Serialize(builder));
|
builder->CreateString(name),
|
||||||
}
|
request->serialized_location,
|
||||||
auto qualified_name = defined_namespace->GetFullyQualifiedName(name);
|
response->serialized_location,
|
||||||
return reflection::CreateEnum(
|
SerializeAttributes(builder, parser),
|
||||||
*builder, builder->CreateString(qualified_name),
|
|
||||||
builder->CreateVector(enumval_offsets), is_union,
|
|
||||||
underlying_type.Serialize(builder), SerializeAttributes(builder, parser),
|
|
||||||
parser.opts.binary_schema_comments
|
parser.opts.binary_schema_comments
|
||||||
? builder->CreateVectorOfStrings(doc_comment)
|
? builder->CreateVectorOfStrings(doc_comment)
|
||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<reflection::EnumVal> EnumVal::Serialize(
|
Offset<reflection::Service> ServiceDef::Serialize(FlatBufferBuilder *builder,
|
||||||
FlatBufferBuilder *builder) const {
|
const Parser &parser) const {
|
||||||
|
std::vector<Offset<reflection::RPCCall>> servicecall_offsets;
|
||||||
|
for (auto it = calls.vec.begin(); it != calls.vec.end(); ++it) {
|
||||||
|
servicecall_offsets.push_back((*it)->Serialize(builder, parser));
|
||||||
|
}
|
||||||
|
auto qualified_name = defined_namespace->GetFullyQualifiedName(name);
|
||||||
|
return reflection::CreateService(
|
||||||
|
*builder,
|
||||||
|
builder->CreateString(qualified_name),
|
||||||
|
builder->CreateVector(servicecall_offsets),
|
||||||
|
SerializeAttributes(builder, parser),
|
||||||
|
parser.opts.binary_schema_comments
|
||||||
|
? builder->CreateVectorOfStrings(doc_comment)
|
||||||
|
: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<reflection::Enum> EnumDef::Serialize(FlatBufferBuilder *builder,
|
||||||
|
const Parser &parser) const {
|
||||||
|
std::vector<Offset<reflection::EnumVal>> enumval_offsets;
|
||||||
|
for (auto it = vals.vec.begin(); it != vals.vec.end(); ++it) {
|
||||||
|
enumval_offsets.push_back((*it)->Serialize(builder, parser));
|
||||||
|
}
|
||||||
|
auto qualified_name = defined_namespace->GetFullyQualifiedName(name);
|
||||||
|
return reflection::CreateEnum(
|
||||||
|
*builder,
|
||||||
|
builder->CreateString(qualified_name),
|
||||||
|
builder->CreateVector(enumval_offsets),
|
||||||
|
is_union,
|
||||||
|
underlying_type.Serialize(builder),
|
||||||
|
SerializeAttributes(builder, parser),
|
||||||
|
parser.opts.binary_schema_comments
|
||||||
|
? builder->CreateVectorOfStrings(doc_comment)
|
||||||
|
: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<reflection::EnumVal> EnumVal::Serialize(FlatBufferBuilder *builder,
|
||||||
|
const Parser &parser) const {
|
||||||
return reflection::CreateEnumVal(
|
return reflection::CreateEnumVal(
|
||||||
*builder, builder->CreateString(name), value,
|
*builder,
|
||||||
|
builder->CreateString(name),
|
||||||
|
value,
|
||||||
union_type.struct_def ? union_type.struct_def->serialized_location : 0,
|
union_type.struct_def ? union_type.struct_def->serialized_location : 0,
|
||||||
union_type.Serialize(builder));
|
union_type.Serialize(builder),
|
||||||
|
parser.opts.binary_schema_comments
|
||||||
|
? builder->CreateVectorOfStrings(doc_comment)
|
||||||
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<reflection::Type> Type::Serialize(FlatBufferBuilder *builder) const {
|
Offset<reflection::Type> Type::Serialize(FlatBufferBuilder *builder) const {
|
||||||
return reflection::CreateType(
|
return reflection::CreateType(
|
||||||
*builder, static_cast<reflection::BaseType>(base_type),
|
*builder,
|
||||||
|
static_cast<reflection::BaseType>(base_type),
|
||||||
static_cast<reflection::BaseType>(element),
|
static_cast<reflection::BaseType>(element),
|
||||||
struct_def ? struct_def->index : (enum_def ? enum_def->index : -1));
|
struct_def ? struct_def->index : (enum_def ? enum_def->index : -1));
|
||||||
}
|
}
|
||||||
@@ -2614,7 +2664,7 @@ Definition::SerializeAttributes(FlatBufferBuilder *builder,
|
|||||||
for (auto kv = attributes.dict.begin(); kv != attributes.dict.end(); ++kv) {
|
for (auto kv = attributes.dict.begin(); kv != attributes.dict.end(); ++kv) {
|
||||||
auto it = parser.known_attributes_.find(kv->first);
|
auto it = parser.known_attributes_.find(kv->first);
|
||||||
FLATBUFFERS_ASSERT(it != parser.known_attributes_.end());
|
FLATBUFFERS_ASSERT(it != parser.known_attributes_.end());
|
||||||
if (!it->second) { // Custom attribute.
|
if (parser.opts.binary_schema_builtins || !it->second) {
|
||||||
attrs.push_back(reflection::CreateKeyValue(
|
attrs.push_back(reflection::CreateKeyValue(
|
||||||
*builder, builder->CreateString(kv->first),
|
*builder, builder->CreateString(kv->first),
|
||||||
builder->CreateString(kv->second->constant)));
|
builder->CreateString(kv->second->constant)));
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
// automatically generated by the FlatBuffers compiler, do not modify
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
import * as NS11563891686210618450 from "./namespace_test1_generated";
|
import * as NS9459827973991502386 from "./namespace_test1_generated";
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
@@ -39,24 +39,24 @@ static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):T
|
|||||||
* @param {NamespaceA.NamespaceB.TableInNestedNS=} obj
|
* @param {NamespaceA.NamespaceB.TableInNestedNS=} obj
|
||||||
* @returns {NamespaceA.NamespaceB.TableInNestedNS|null}
|
* @returns {NamespaceA.NamespaceB.TableInNestedNS|null}
|
||||||
*/
|
*/
|
||||||
fooTable(obj?:NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS):NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS|null {
|
fooTable(obj?:NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS|null {
|
||||||
var offset = this.bb!.__offset(this.bb_pos, 4);
|
var offset = this.bb!.__offset(this.bb_pos, 4);
|
||||||
return offset ? (obj || new NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {NamespaceA.NamespaceB.EnumInNestedNS}
|
* @returns {NamespaceA.NamespaceB.EnumInNestedNS}
|
||||||
*/
|
*/
|
||||||
fooEnum():NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS {
|
fooEnum():NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS {
|
||||||
var offset = this.bb!.__offset(this.bb_pos, 6);
|
var offset = this.bb!.__offset(this.bb_pos, 6);
|
||||||
return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb!.readInt8(this.bb_pos + offset)) : NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS.A;
|
return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb!.readInt8(this.bb_pos + offset)) : NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {NamespaceA.NamespaceB.EnumInNestedNS} value
|
* @param {NamespaceA.NamespaceB.EnumInNestedNS} value
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
mutate_foo_enum(value:NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS):boolean {
|
mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS):boolean {
|
||||||
var offset = this.bb!.__offset(this.bb_pos, 6);
|
var offset = this.bb!.__offset(this.bb_pos, 6);
|
||||||
|
|
||||||
if (offset === 0) {
|
if (offset === 0) {
|
||||||
@@ -71,9 +71,9 @@ mutate_foo_enum(value:NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedN
|
|||||||
* @param {NamespaceA.NamespaceB.StructInNestedNS=} obj
|
* @param {NamespaceA.NamespaceB.StructInNestedNS=} obj
|
||||||
* @returns {NamespaceA.NamespaceB.StructInNestedNS|null}
|
* @returns {NamespaceA.NamespaceB.StructInNestedNS|null}
|
||||||
*/
|
*/
|
||||||
fooStruct(obj?:NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS):NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS|null {
|
fooStruct(obj?:NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS|null {
|
||||||
var offset = this.bb!.__offset(this.bb_pos, 8);
|
var offset = this.bb!.__offset(this.bb_pos, 8);
|
||||||
return offset ? (obj || new NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb!) : null;
|
return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb!) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,8 +95,8 @@ static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offse
|
|||||||
* @param {flatbuffers.Builder} builder
|
* @param {flatbuffers.Builder} builder
|
||||||
* @param {NamespaceA.NamespaceB.EnumInNestedNS} fooEnum
|
* @param {NamespaceA.NamespaceB.EnumInNestedNS} fooEnum
|
||||||
*/
|
*/
|
||||||
static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS) {
|
static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS) {
|
||||||
builder.addFieldInt8(1, fooEnum, NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS.A);
|
builder.addFieldInt8(1, fooEnum, NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user