Commit d9d47a53 authored by Raman's avatar Raman Committed by GitHub

Update idl_gen_fbs.cpp

parent 71d30d5c
...@@ -52,18 +52,18 @@ static void GenNameSpace(const Namespace &name_space, std::string *_schema, ...@@ -52,18 +52,18 @@ static void GenNameSpace(const Namespace &name_space, std::string *_schema,
} }
// Generate a flatbuffer schema from the Parser's internal representation. // Generate a flatbuffer schema from the Parser's internal representation.
std::string GenerateFBS(const Parser &parser, const std::string &file_name, const bool &escape_proto_identifiers) { std::string GenerateFBS(const Parser &parser, const std::string &file_name) {
// Proto namespaces may clash with table names, so we have to prefix all: // Proto namespaces may clash with table names, so we have to prefix all:
if (!parser.opts.escape_proto_identifiers) {
if (!escape_proto_identifiers) { for (auto it = parser.namespaces_.begin(); it != parser.namespaces_.end();
for (auto it = parser.namespaces_.begin(); it != parser.namespaces_.end(); ++it) {
++it) { for (auto comp = (*it)->components.begin(); comp != (*it)->components.end();
for (auto comp = (*it)->components.begin(); comp != (*it)->components.end(); ++comp) {
++comp) { (*comp) = "_" + (*comp);
(*comp) = "_" + (*comp); }
} }
}
} }
std::string schema; std::string schema;
schema += "// Generated from " + file_name + ".proto\n\n"; schema += "// Generated from " + file_name + ".proto\n\n";
if (parser.opts.include_dependence_headers) { if (parser.opts.include_dependence_headers) {
...@@ -121,10 +121,9 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name, cons ...@@ -121,10 +121,9 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name, cons
bool GenerateFBS(const Parser &parser, bool GenerateFBS(const Parser &parser,
const std::string &path, const std::string &path,
const std::string &file_name, const std::string &file_name) {
const bool &escape_proto_identifiers) {
return SaveFile((path + file_name + ".fbs").c_str(), return SaveFile((path + file_name + ".fbs").c_str(),
GenerateFBS(parser, file_name, escape_proto_identifiers), false); GenerateFBS(parser, file_name), false);
} }
} // namespace flatbuffers } // namespace flatbuffers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment