Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
partons
core
elementary-utils
Commits
17c2a370
Commit
17c2a370
authored
Aug 03, 2016
by
Bryan Berthou
Browse files
refs#16
In ElementaryUtils (trunk) : - Add remove() method in Parameters class.
parent
31a5625c
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ElementaryUtils/parameters/Parameters.h
View file @
17c2a370
...
...
@@ -41,6 +41,7 @@ public:
virtual
std
::
string
toString
()
const
;
bool
update
(
const
std
::
string
&
key
,
const
GenericType
&
value
);
bool
remove
(
const
std
::
string
&
key
);
const
GenericType
&
get
(
const
std
::
string
&
key
)
const
;
const
GenericType
&
getLastAvailable
()
const
;
/// Care ! Use it after isAvailable() to ensure that the iterator is in the map range.
...
...
src/ElementaryUtils/parameters/Parameters.cpp
View file @
17c2a370
...
...
@@ -120,5 +120,16 @@ GenericType Parameters::value(size_t index) const {
return
it
->
second
;
}
}
// namespace ElemUtils
bool
ElemUtils
::
Parameters
::
remove
(
const
std
::
string
&
key
)
{
bool
erased
=
false
;
std
::
map
<
std
::
string
,
GenericType
>::
iterator
it
=
m_parameters
.
find
(
key
);
if
(
it
!=
m_parameters
.
end
())
{
m_parameters
.
erase
(
it
);
erased
=
true
;
}
return
erased
;
}
}
// namespace ElemUtils
Write
Preview
Supports
Markdown
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