removed extern code generation declarations preferring direct includes (#7948)

* removed extern code generation definitions, preferring direct includes

* add static to functions

* remove idl_gen_lua
This commit is contained in:
Derek Bailey
2023-05-09 21:50:28 -07:00
committed by GitHub
parent 16a7df46f0
commit 10b79d87c1
27 changed files with 117 additions and 1081 deletions

View File

@@ -28,6 +28,7 @@
#include "flatbuffers/util.h"
namespace flatbuffers {
namespace {
static std::string GenType(const Type &type, bool underlying = false) {
switch (type.base_type) {
@@ -252,7 +253,7 @@ static void GenNameSpace(const Namespace &name_space, std::string *_schema,
}
// Generate a flatbuffer schema from the Parser's internal representation.
std::string GenerateFBS(const Parser &parser, const std::string &file_name,
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:
@@ -374,7 +375,7 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name,
return schema;
}
bool GenerateFBS(const Parser &parser, const std::string &path,
static bool GenerateFBS(const Parser &parser, const std::string &path,
const std::string &file_name, bool no_log = false) {
const std::string fbs = GenerateFBS(parser, file_name, no_log);
if (fbs.empty()) { return false; }
@@ -387,7 +388,6 @@ bool GenerateFBS(const Parser &parser, const std::string &path,
return SaveFile((path + file_name + ".fbs").c_str(), fbs, false);
}
namespace {
class FBSCodeGenerator : public CodeGenerator {
public:
@@ -399,6 +399,12 @@ class FBSCodeGenerator : public CodeGenerator {
return Status::OK;
}
Status GenerateCodeString(const Parser &parser, const std::string &filename,
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 {