mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 22:03:40 +00:00
Added --filename-suffix and --filename-ext to flatc (#5778)
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case. * Added --filename-suffix and --filename-ext to flatc * Fixed typo and added example generation of suffix and extension for C++ * Removed extra ; * Removed clang-format block from a region that didn't need it. Fixed an auto format of another clang-format block * Added docs, fixed pointer alignment, removed suffix test file
This commit is contained in:
@@ -49,7 +49,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
public:
|
||||
SwiftGenerator(const Parser &parser, const std::string &path,
|
||||
const std::string &file_name)
|
||||
: BaseGenerator(parser, path, file_name, "", "."),
|
||||
: BaseGenerator(parser, path, file_name, "", ".", "swift"),
|
||||
cur_name_space_(nullptr) {
|
||||
namespace_depth = 0;
|
||||
static const char *const keywords[] = {
|
||||
@@ -181,7 +181,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
|
||||
if (cur_name_space_) SetNameSpace(nullptr);
|
||||
|
||||
const auto filename = GeneratedFileName(path_, file_name_);
|
||||
const auto filename = GeneratedFileName(path_, file_name_, parser_.opts);
|
||||
const auto final_code = code_.ToString();
|
||||
return SaveFile(filename.c_str(), final_code, false);
|
||||
}
|
||||
@@ -843,10 +843,6 @@ class SwiftGenerator : public BaseGenerator {
|
||||
return EscapeKeyword(MakeCamel(def.name, false));
|
||||
}
|
||||
|
||||
static std::string GeneratedFileName(const std::string &path,
|
||||
const std::string &file_name) {
|
||||
return path + file_name + "_generated.swift";
|
||||
}
|
||||
// MARK: - Copied from the cpp implementation, needs revisiting
|
||||
void SetNameSpace(const Namespace *ns) {
|
||||
if (cur_name_space_ == ns) { return; }
|
||||
|
||||
Reference in New Issue
Block a user