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
c6232740
Commit
c6232740
authored
Nov 22, 2018
by
Tobias Mayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make config_option copyable
parent
a317d135
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
libcaf_core/caf/config_option.hpp
libcaf_core/caf/config_option.hpp
+8
-0
libcaf_core/src/config_option.cpp
libcaf_core/src/config_option.cpp
+28
-0
No files found.
libcaf_core/caf/config_option.hpp
View file @
c6232740
...
...
@@ -54,10 +54,18 @@ public:
config_option
(
string_view
category
,
string_view
name
,
string_view
description
,
const
meta_state
*
meta
,
void
*
value
=
nullptr
);
config_option
(
const
config_option
&
);
config_option
(
config_option
&&
)
=
default
;
config_option
&
operator
=
(
const
config_option
&
);
config_option
&
operator
=
(
config_option
&&
)
=
default
;
// -- swap function ----------------------------------------------------------
friend
void
swap
(
config_option
&
first
,
config_option
&
second
)
noexcept
;
// -- properties -------------------------------------------------------------
/// Returns the category of the option.
...
...
libcaf_core/src/config_option.cpp
View file @
c6232740
...
...
@@ -77,6 +77,34 @@ config_option::config_option(string_view category, string_view name,
CAF_ASSERT
(
pos
()
==
buf_size_
);
}
config_option
::
config_option
(
const
config_option
&
other
)
:
category_separator_
{
other
.
category_separator_
},
long_name_separator_
{
other
.
long_name_separator_
},
short_names_separator_
{
other
.
short_names_separator_
},
buf_size_
{
other
.
buf_size_
},
meta_
{
other
.
meta_
},
value_
{
other
.
value_
}
{
buf_
.
reset
(
new
char
[
buf_size_
]);
std
::
copy_n
(
other
.
buf_
.
get
(),
buf_size_
,
buf_
.
get
());
}
config_option
&
config_option
::
operator
=
(
const
config_option
&
other
)
{
config_option
tmp
{
other
};
swap
(
*
this
,
tmp
);
return
*
this
;
}
void
swap
(
config_option
&
first
,
config_option
&
second
)
noexcept
{
using
std
::
swap
;
swap
(
first
.
buf_
,
second
.
buf_
);
swap
(
first
.
category_separator_
,
second
.
category_separator_
);
swap
(
first
.
long_name_separator_
,
second
.
long_name_separator_
);
swap
(
first
.
short_names_separator_
,
second
.
short_names_separator_
);
swap
(
first
.
buf_size_
,
second
.
buf_size_
);
swap
(
first
.
meta_
,
second
.
meta_
);
swap
(
first
.
value_
,
second
.
value_
);
}
// -- properties ---------------------------------------------------------------
string_view
config_option
::
category
()
const
noexcept
{
...
...
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