Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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 Framework
Commits
8c3afc04
Commit
8c3afc04
authored
Sep 10, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate review feedback
parent
7037c152
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
CMakeLists.txt
CMakeLists.txt
+2
-2
cmake/caf-generate-enum-strings.cmake
cmake/caf-generate-enum-strings.cmake
+9
-9
No files found.
CMakeLists.txt
View file @
8c3afc04
...
@@ -205,8 +205,8 @@ endif()
...
@@ -205,8 +205,8 @@ endif()
# -- utility functions ---------------------------------------------------------
# -- utility functions ---------------------------------------------------------
#
adds a consistency check that verifies that `cpp_file` is still valid by
#
generates the implementation file for the enum that contains to_string,
#
re-generating the file and comparing it to the existing file
#
from_string and from_integer
function
(
caf_add_enum_type target enum_name
)
function
(
caf_add_enum_type target enum_name
)
string
(
REPLACE
"."
"/"
path
"
${
enum_name
}
"
)
string
(
REPLACE
"."
"/"
path
"
${
enum_name
}
"
)
set
(
hpp_file
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf/
${
path
}
.hpp"
)
set
(
hpp_file
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf/
${
path
}
.hpp"
)
...
...
cmake/caf-generate-enum-strings.cmake
View file @
8c3afc04
# seeks the beginning of the enum while also keeping track of namespaces
# seeks the beginning of the enum while also keeping track of namespaces
macro
(
seek_mode
)
macro
(
seek_
enum_
mode
)
if
(
line MATCHES
"^namespace "
)
if
(
line MATCHES
"^namespace "
)
string
(
REGEX REPLACE
"^namespace ([a-zA-Z0-9:_]+).*$"
"
\\
1"
tmp
"
${
line
}
"
)
string
(
REGEX REPLACE
"^namespace ([a-zA-Z0-9:_]+).*$"
"
\\
1"
tmp
"
${
line
}
"
)
list
(
APPEND namespaces
"
${
tmp
}
"
)
list
(
APPEND namespaces
"
${
tmp
}
"
)
...
@@ -11,12 +11,12 @@ macro(seek_mode)
...
@@ -11,12 +11,12 @@ macro(seek_mode)
set
(
is_enum_class TRUE
)
set
(
is_enum_class TRUE
)
endif
()
endif
()
string
(
REGEX REPLACE
"^enum (class )?([0-9a-zA-Z_]+).*$"
"
\\
2"
enum_name
"
${
line
}
"
)
string
(
REGEX REPLACE
"^enum (class )?([0-9a-zA-Z_]+).*$"
"
\\
2"
enum_name
"
${
line
}
"
)
set
(
mode
"
scan
"
)
set
(
mode
"
read_values
"
)
endif
()
endif
()
endmacro
()
endmacro
()
# scans the input for
case label
s
# scans the input for
enum value
s
macro
(
scan
_mode
)
macro
(
read_values
_mode
)
if
(
line MATCHES
"^}"
)
if
(
line MATCHES
"^}"
)
set
(
mode
"generate"
)
set
(
mode
"generate"
)
elseif
(
line MATCHES
"^[0-9a-zA-Z_]+"
)
elseif
(
line MATCHES
"^[0-9a-zA-Z_]+"
)
...
@@ -107,14 +107,14 @@ function(main)
...
@@ -107,14 +107,14 @@ function(main)
set
(
enum_values
""
)
set
(
enum_values
""
)
set
(
is_enum_class FALSE
)
set
(
is_enum_class FALSE
)
file
(
STRINGS
"
${
INPUT_FILE
}
"
lines
)
file
(
STRINGS
"
${
INPUT_FILE
}
"
lines
)
set
(
mode
"seek"
)
set
(
mode
"seek
_enum
"
)
foreach
(
line IN LISTS lines
)
foreach
(
line IN LISTS lines
)
string
(
REGEX REPLACE
"^(.+)(//.*)?"
"
\\
1"
line
"
${
line
}
"
)
string
(
REGEX REPLACE
"^(.+)(//.*)?"
"
\\
1"
line
"
${
line
}
"
)
string
(
STRIP
"
${
line
}
"
line
)
string
(
STRIP
"
${
line
}
"
line
)
if
(
mode STREQUAL seek
)
if
(
mode STREQUAL seek
_enum
)
seek_mode
()
seek_
enum_
mode
()
elseif
(
mode STREQUAL
scan
)
elseif
(
mode STREQUAL
read_values
)
scan
_mode
()
read_values
_mode
()
else
()
else
()
# reached the end
# reached the end
if
(
NOT enum_name
)
if
(
NOT enum_name
)
...
...
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