mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 00:51:47 +00:00
[Lua] Apply Namer to Lua (#7171)
* Apply Namer to Lua bfbs code gen * refactor namer into IdlNamer to keep idl includes separate * remove commented out code * added bfbs_namer * remove Enum case * add to bazel
This commit is contained in:
43
src/bfbs_namer.h
Normal file
43
src/bfbs_namer.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef FLATBUFFERS_BFBS_NAMER
|
||||
#define FLATBUFFERS_BFBS_NAMER
|
||||
|
||||
#include "flatbuffers/reflection.h"
|
||||
#include "namer.h"
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
// Provides Namer capabilities to types defined in the flatbuffers reflection.
|
||||
class BfbsNamer : public Namer {
|
||||
public:
|
||||
explicit BfbsNamer(Config config, std::set<std::string> keywords)
|
||||
: Namer(config, std::move(keywords)) {}
|
||||
|
||||
using Namer::Constant;
|
||||
using Namer::Denamespace;
|
||||
using Namer::Directories;
|
||||
using Namer::Field;
|
||||
using Namer::File;
|
||||
using Namer::Function;
|
||||
using Namer::Method;
|
||||
using Namer::Namespace;
|
||||
using Namer::NamespacedType;
|
||||
using Namer::ObjectType;
|
||||
using Namer::Type;
|
||||
using Namer::Variable;
|
||||
using Namer::Variant;
|
||||
|
||||
template<typename T>
|
||||
std::string Denamespace(T t, std::string &namespace_prefix,
|
||||
const char delimiter = '.') const {
|
||||
return Namer::Denamespace(t->name()->c_str(), namespace_prefix, delimiter);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::string Denamespace(T t, const char delimiter = '.') const {
|
||||
return Namer::Denamespace(t->name()->c_str(), delimiter);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif // FLATBUFFERS_BFBS_NAMER
|
||||
Reference in New Issue
Block a user