Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-flatbuffers
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-flatbuffers
Commits
22722299
Commit
22722299
authored
8 years ago
by
Wouter van Oortmerssen
Browse files
Options
Downloads
Patches
Plain Diff
Added --prefix-include option for generated includes.
Change-Id: I288cda33345362f9aec5cbe309e590bf64f328e1 Tested: on Linux.
parent
b7bfecb4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/source/Compiler.md
+3
-0
3 additions, 0 deletions
docs/source/Compiler.md
include/flatbuffers/idl.h
+1
-0
1 addition, 0 deletions
include/flatbuffers/idl.h
src/flatc.cpp
+7
-0
7 additions, 0 deletions
src/flatc.cpp
src/idl_gen_cpp.cpp
+2
-1
2 additions, 1 deletion
src/idl_gen_cpp.cpp
with
13 additions
and
1 deletion
docs/source/Compiler.md
+
3
−
0
View file @
22722299
...
...
@@ -118,5 +118,8 @@ Additional options:
an evolution of. Gives errors if not. Useful to check if schema
modifications don't break schema evolution rules.
- `
--include-prefix PATH
`
: Prefix this path to any generated include
statements.
NOTE: short-form options for generators are deprecated, use the long form
whenever possible.
This diff is collapsed.
Click to expand it.
include/flatbuffers/idl.h
+
1
−
0
View file @
22722299
...
...
@@ -355,6 +355,7 @@ struct IDLOptions {
std
::
string
cpp_object_api_pointer_type
;
bool
union_value_namespacing
;
bool
allow_non_utf8
;
std
::
string
include_prefix
;
// Possible options for the more general generator below.
enum
Language
{
...
...
This diff is collapsed.
Click to expand it.
src/flatc.cpp
+
7
−
0
View file @
22722299
...
...
@@ -97,6 +97,8 @@ std::string FlatCompiler::GetUsageString(const char* program_name) const {
" an evolution of. Gives errors if not.
\n
"
" --conform-includes Include path for the schema given with --conform
\n
"
" PATH
\n
"
" --include-prefix Prefix this path to any generated include statements.
\n
"
" PATH
\n
"
"FILEs may be schemas, or JSON files (conforming to preceding schema)
\n
"
"FILEs after the -- must be binary flatbuffer format files.
\n
"
"Output files are named using the base file name of the input,
\n
"
...
...
@@ -142,6 +144,11 @@ int FlatCompiler::Compile(int argc, const char** argv) {
}
else
if
(
arg
==
"--conform-includes"
)
{
if
(
++
argi
>=
argc
)
Error
(
"missing path following"
+
arg
,
true
);
conform_include_directories
.
push_back
(
argv
[
argi
]);
}
else
if
(
arg
==
"--include-prefix"
)
{
if
(
++
argi
>=
argc
)
Error
(
"missing path following"
+
arg
,
true
);
opts
.
include_prefix
=
argv
[
argi
];
if
(
opts
.
include_prefix
.
back
()
!=
'/'
&&
opts
.
include_prefix
.
back
()
!=
'\\'
)
opts
.
include_prefix
+=
"/"
;
}
else
if
(
arg
==
"--strict-json"
)
{
opts
.
strict_json
=
true
;
}
else
if
(
arg
==
"--allow-non-utf8"
)
{
...
...
This diff is collapsed.
Click to expand it.
src/idl_gen_cpp.cpp
+
2
−
1
View file @
22722299
...
...
@@ -70,7 +70,8 @@ class CppGenerator : public BaseGenerator {
const
auto
basename
=
flatbuffers
::
StripPath
(
flatbuffers
::
StripExtension
(
it
->
first
));
if
(
basename
!=
file_name_
)
{
code_
+=
"#include
\"
"
+
basename
+
"_generated.h
\"
"
;
code_
+=
"#include
\"
"
+
parser_
.
opts
.
include_prefix
+
basename
+
"_generated.h
\"
"
;
num_includes
++
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment