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
53977143
Commit
53977143
authored
May 23, 2019
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add config file option from manual and help text
parent
d8022647
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+22
-8
No files found.
libcaf_core/src/actor_system_config.cpp
View file @
53977143
...
...
@@ -67,7 +67,8 @@ actor_system_config::actor_system_config()
opt_group
{
custom_options_
,
"global"
}
.
add
<
bool
>
(
"help,h?"
,
"print help text to STDERR and exit"
)
.
add
<
bool
>
(
"long-help"
,
"print long help text to STDERR and exit"
)
.
add
<
bool
>
(
"dump-config"
,
"print configuration to STDERR and exit"
);
.
add
<
bool
>
(
"dump-config"
,
"print configuration to STDERR and exit"
)
.
add
<
string
>
(
"config-file"
,
"set config file (default: caf-application.ini)"
);
opt_group
{
custom_options_
,
"stream"
}
.
add
<
timespan
>
(
stream_desired_batch_complexity
,
"desired-batch-complexity"
,
"processing time per batch"
)
...
...
@@ -367,13 +368,26 @@ std::string actor_system_config::render_pec(uint8_t x, atom_value,
void
actor_system_config
::
extract_config_file_path
(
string_list
&
args
)
{
static
constexpr
const
char
needle
[]
=
"--caf#config-file="
;
auto
last
=
args
.
end
();
auto
i
=
std
::
find_if
(
args
.
begin
(),
last
,
[](
const
std
::
string
&
arg
)
{
return
arg
.
compare
(
0
,
sizeof
(
needle
)
-
1
,
needle
)
==
0
;
});
if
(
i
==
last
)
return
;
auto
arg_begin
=
i
->
begin
()
+
strlen
(
needle
);
static
constexpr
const
char
needle_global
[]
=
"--config-file="
;
const
auto
last
=
args
.
end
();
size_t
len
=
0
;
auto
i
=
args
.
begin
();
// Look for match and set len and i.
auto
check
=
[
&
](
const
char
*
str
)
{
i
=
std
::
find_if
(
args
.
begin
(),
last
,
[
&
](
const
std
::
string
&
arg
)
{
return
arg
.
compare
(
0
,
strlen
(
str
),
str
)
==
0
;
});
len
=
strlen
(
str
);
};
// Check for global name.
check
(
needle_global
);
if
(
i
==
last
)
{
// Check for full name.
check
(
needle
);
if
(
i
==
last
)
return
;
}
auto
arg_begin
=
i
->
begin
()
+
len
;
auto
arg_end
=
i
->
end
();
if
(
arg_begin
==
arg_end
)
{
// Missing value.
...
...
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