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
c4966370
Commit
c4966370
authored
Nov 14, 2015
by
takaken1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++: Fixed generated header file cannot be compiled when the type of key is enum class
parent
3f1c4b41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
idl_gen_cpp.cpp
src/idl_gen_cpp.cpp
+12
-2
No files found.
src/idl_gen_cpp.cpp
View file @
c4966370
...
...
@@ -154,7 +154,10 @@ static void GenEnum(const Parser &parser, EnumDef &enum_def,
std
::
string
&
code
=
*
code_ptr
;
std
::
string
&
code_post
=
*
code_ptr_post
;
GenComment
(
enum_def
.
doc_comment
,
code_ptr
,
nullptr
);
code
+=
GenEnumDecl
(
enum_def
,
opts
)
+
" {
\n
"
;
code
+=
GenEnumDecl
(
enum_def
,
opts
);
if
(
opts
.
scoped_enums
)
code
+=
" : "
+
GenTypeBasic
(
parser
,
enum_def
.
underlying_type
,
false
);
code
+=
" {
\n
"
;
for
(
auto
it
=
enum_def
.
vals
.
vec
.
begin
();
it
!=
enum_def
.
vals
.
vec
.
end
();
++
it
)
{
...
...
@@ -311,7 +314,14 @@ static void GenTable(const Parser &parser, StructDef &struct_def,
code
+=
"const char *val) const { return strcmp("
+
field
.
name
;
code
+=
"()->c_str(), val); }
\n
"
;
}
else
{
code
+=
GenTypeBasic
(
parser
,
field
.
value
.
type
,
false
);
if
(
opts
.
scoped_enums
&&
field
.
value
.
type
.
enum_def
&&
IsScalar
(
field
.
value
.
type
.
base_type
))
{
code
+=
GenTypeGet
(
parser
,
field
.
value
.
type
,
" "
,
"const "
,
" *"
,
true
);
}
else
{
code
+=
GenTypeBasic
(
parser
,
field
.
value
.
type
,
false
);
}
code
+=
" val) const { return "
+
field
.
name
+
"() < val ? -1 : "
;
code
+=
field
.
name
+
"() > val; }
\n
"
;
}
...
...
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