Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
7d84a491
Commit
7d84a491
authored
Jul 04, 2016
by
Raman
Committed by
GitHub
Jul 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update idl_gen_fbs.cpp
parent
68a83edd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
idl_gen_fbs.cpp
src/idl_gen_fbs.cpp
+7
-3
No files found.
src/idl_gen_fbs.cpp
View file @
7d84a491
...
...
@@ -52,8 +52,10 @@ 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
)
{
std
::
string
GenerateFBS
(
const
Parser
&
parser
,
const
std
::
string
&
file_name
,
const
bool
&
escape_proto_identifiers
)
{
// Proto namespaces may clash with table names, so we have to prefix all:
if
(
!
escape_proto_identifiers
)
{
for
(
auto
it
=
parser
.
namespaces_
.
begin
();
it
!=
parser
.
namespaces_
.
end
();
++
it
)
{
for
(
auto
comp
=
(
*
it
)
->
components
.
begin
();
comp
!=
(
*
it
)
->
components
.
end
();
...
...
@@ -61,6 +63,7 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name) {
(
*
comp
)
=
"_"
+
(
*
comp
);
}
}
}
std
::
string
schema
;
schema
+=
"// Generated from "
+
file_name
+
".proto
\n\n
"
;
...
...
@@ -119,9 +122,10 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name) {
bool
GenerateFBS
(
const
Parser
&
parser
,
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
(),
GenerateFBS
(
parser
,
file_name
),
false
);
GenerateFBS
(
parser
,
file_name
,
escape_proto_identifiers
),
false
);
}
}
// namespace flatbuffers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment