mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 07:06:26 +00:00
fixed bfbs gen to pass extra options (#7949)
This commit is contained in:
@@ -253,8 +253,9 @@ static void GenNameSpace(const Namespace &name_space, std::string *_schema,
|
||||
}
|
||||
|
||||
// Generate a flatbuffer schema from the Parser's internal representation.
|
||||
static std::string GenerateFBS(const Parser &parser, const std::string &file_name,
|
||||
bool no_log = false) {
|
||||
static std::string GenerateFBS(const Parser &parser,
|
||||
const std::string &file_name,
|
||||
bool no_log = false) {
|
||||
// Proto namespaces may clash with table names, escape the ones that were
|
||||
// generated from a table:
|
||||
for (auto it = parser.namespaces_.begin(); it != parser.namespaces_.end();
|
||||
@@ -376,7 +377,7 @@ static std::string GenerateFBS(const Parser &parser, const std::string &file_nam
|
||||
}
|
||||
|
||||
static bool GenerateFBS(const Parser &parser, const std::string &path,
|
||||
const std::string &file_name, bool no_log = false) {
|
||||
const std::string &file_name, bool no_log = false) {
|
||||
const std::string fbs = GenerateFBS(parser, file_name, no_log);
|
||||
if (fbs.empty()) { return false; }
|
||||
// TODO: Use LogCompilerWarn
|
||||
@@ -388,7 +389,6 @@ static bool GenerateFBS(const Parser &parser, const std::string &path,
|
||||
return SaveFile((path + file_name + ".fbs").c_str(), fbs, false);
|
||||
}
|
||||
|
||||
|
||||
class FBSCodeGenerator : public CodeGenerator {
|
||||
public:
|
||||
explicit FBSCodeGenerator(const bool no_log) : no_log_(no_log) {}
|
||||
@@ -400,16 +400,15 @@ class FBSCodeGenerator : public CodeGenerator {
|
||||
}
|
||||
|
||||
Status GenerateCodeString(const Parser &parser, const std::string &filename,
|
||||
std::string &output) override {
|
||||
std::string &output) override {
|
||||
output = GenerateFBS(parser, filename, no_log_);
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
// Generate code from the provided `buffer` of given `length`. The buffer is a
|
||||
// serialized reflection.fbs.
|
||||
Status GenerateCode(const uint8_t *buffer, int64_t length) override {
|
||||
(void)buffer;
|
||||
(void)length;
|
||||
Status GenerateCode(const uint8_t *, int64_t,
|
||||
const CodeGenOptions &) override {
|
||||
return Status::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user