Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
ac63acc8
Commit
ac63acc8
authored
Sep 15, 2021
by
Jose Borreguero
Browse files
use provided method to find a key
Signed-off-by:
Jose Borreguero
<
borreguero@gmail.com
>
parent
4bf44c28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp
View file @
ac63acc8
...
...
@@ -54,7 +54,7 @@ const InstrumentInfo &getInstrument(ConfigServiceImpl &self, const object &name
std
::
string
getStringUsingCacheElseDefault
(
ConfigServiceImpl
&
self
,
const
std
::
string
&
key
,
const
std
::
string
&
defaultValue
)
{
std
::
vector
<
std
::
string
>
keys
=
self
.
keys
();
if
(
s
td
::
find
(
keys
.
begin
(),
keys
.
end
(),
key
)
!=
keys
.
end
(
))
if
(
s
elf
.
hasProperty
(
key
))
return
self
.
getString
(
key
,
true
);
else
return
defaultValue
;
...
...
@@ -144,9 +144,12 @@ void export_ConfigService() {
.
def
(
"keys"
,
&
ConfigServiceImpl
::
keys
,
arg
(
"self"
))
// Treat this as a dictionary
.
def
(
"get"
,
&
getStringUsingCache
,
(
arg
(
"self"
),
arg
(
"key"
)))
.
def
(
"get"
,
&
getStringUsingCache
,
(
arg
(
"self"
),
arg
(
"key"
)),
"get the string value of a property; return empty string value if the property "
"is not found in the configuration"
)
.
def
(
"get"
,
&
getStringUsingCacheElseDefault
,
(
arg
(
"self"
),
arg
(
"key"
)),
arg
(
"default"
),
"get the value of a property; return a default value if the property is not found in the configuration"
)
"get the string value of a property; return a default string value if the property "
"is not found in the configuration"
)
.
def
(
"__getitem__"
,
&
getStringUsingCache
,
(
arg
(
"self"
),
arg
(
"key"
)))
.
def
(
"__setitem__"
,
&
ConfigServiceImpl
::
setString
,
(
arg
(
"self"
),
arg
(
"key"
),
arg
(
"value"
)))
.
def
(
"__contains__"
,
&
ConfigServiceImpl
::
hasProperty
,
(
arg
(
"self"
),
arg
(
"key"
)))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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