mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 14:15:17 +00:00
Defined CodeGenerator Interface and implement C++ (#7771)
This commit is contained in:
@@ -20,9 +20,12 @@
|
||||
#include "bfbs_gen_lua.h"
|
||||
#include "bfbs_gen_nim.h"
|
||||
#include "flatbuffers/base.h"
|
||||
#include "flatbuffers/code_generator.h"
|
||||
#include "flatbuffers/flatc.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
|
||||
|
||||
static const char *g_program_name = nullptr;
|
||||
|
||||
static void Warn(const flatbuffers::FlatCompiler *flatc,
|
||||
@@ -159,6 +162,12 @@ int main(int argc, const char *argv[]) {
|
||||
|
||||
flatbuffers::FlatCompiler flatc(params);
|
||||
|
||||
std::shared_ptr<flatbuffers::CodeGenerator> cpp_generator =
|
||||
flatbuffers::NewCppCodeGenerator();
|
||||
|
||||
flatc.RegisterCodeGenerator("--cpp", cpp_generator);
|
||||
flatc.RegisterCodeGenerator("-c", cpp_generator);
|
||||
|
||||
// Create the FlatC options by parsing the command line arguments.
|
||||
const flatbuffers::FlatCOptions &options =
|
||||
flatc.ParseFromCommandLineArguments(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user