Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
actor-incubator
Commits
17180cac
Commit
17180cac
authored
Dec 17, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix enum-string generation
parent
e5695676
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
cmake/caf-generate-enum-strings.cpp
cmake/caf-generate-enum-strings.cpp
+8
-7
No files found.
cmake/caf-generate-enum-strings.cpp
View file @
17180cac
...
...
@@ -99,20 +99,22 @@ int main(int argc, char** argv) {
cerr
<<
"unable to open output file: "
<<
argv
[
1
]
<<
'\n'
;
return
EXIT_FAILURE
;
}
std
::
string
namespace_str
;
for
(
size_t
i
=
0
;
i
<
namespaces
.
size
()
-
1
;
++
i
)
namespace_str
+=
namespaces
[
i
]
+
"::"
;
namespace_str
+=
namespaces
[
namespaces
.
size
()
-
1
];
// Print file header.
out
<<
"#include
\"
"
<<
namespaces
[
0
];
for
(
size_t
i
=
1
;
i
<
namespaces
.
size
();
++
i
)
out
<<
'/'
<<
namespaces
[
i
];
out
<<
'/'
<<
enum_name
<<
".hpp
\"\n\n
"
<<
"#include <string>
\n\n
"
<<
"namespace "
<<
namespaces
[
0
]
<<
" {
\n
"
;
for
(
size_t
i
=
1
;
i
<
namespaces
.
size
();
++
i
)
out
<<
"namespace "
<<
namespaces
[
i
]
<<
" {
\n
"
;
<<
"namespace "
;
out
<<
namespace_str
<<
" {
\n
"
;
out
<<
"
\n
std::string to_string("
<<
enum_name
<<
" x) {
\n
"
<<
" switch(x) {
\n
"
<<
" switch
(x) {
\n
"
<<
" default:
\n
"
<<
" return
\"
???
\"
;
\n
"
;
// Read until hitting the closing '}'.
std
::
string
case_label_prefix
;
if
(
is_enum_class
)
...
...
@@ -136,6 +138,5 @@ int main(int argc, char** argv) {
// Done. Print file footer and exit.
out
<<
" };
\n
"
<<
"}
\n\n
"
;
for
(
auto
i
=
namespaces
.
rbegin
();
i
!=
namespaces
.
rend
();
++
i
)
out
<<
"} // namespace "
<<
*
i
<<
'\n'
;
out
<<
"} // namespace "
<<
namespace_str
<<
'\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