Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
37be14ea
Commit
37be14ea
authored
3 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Use alias
parent
8771e1e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SimoxUtility/json/util.cpp
+2
-1
2 additions, 1 deletion
SimoxUtility/json/util.cpp
SimoxUtility/json/util.h
+5
-3
5 additions, 3 deletions
SimoxUtility/json/util.h
with
7 additions
and
4 deletions
SimoxUtility/json/util.cpp
+
2
−
1
View file @
37be14ea
...
...
@@ -5,7 +5,8 @@
namespace
simox
{
nlohmann
::
json
::
const_reference
json
::
at_any_key
(
const
nlohmann
::
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
)
json
::
json
::
const_reference
json
::
at_any_key
(
const
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
)
{
for
(
const
std
::
string
&
key
:
keys
)
{
...
...
This diff is collapsed.
Click to expand it.
SimoxUtility/json/util.h
+
5
−
3
View file @
37be14ea
...
...
@@ -2,7 +2,7 @@
#include
<optional>
#include
"json.h
pp
"
#include
"json.h"
namespace
simox
::
json
...
...
@@ -10,16 +10,18 @@ namespace simox::json
/**
* @brief Get the value at the first key in `keys` contained in `j`.
*
* @param j The JSON object.
* @param keys The keys.
* @return The value at the first contained key.
*
* @throw std::out_of_range If none of the keys is found in `j`.
*/
nlohmann
::
json
::
const_reference
at_any_key
(
const
nlohmann
::
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
);
json
::
const_reference
at_any_key
(
const
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
);
template
<
class
T
>
T
get_at_any_key
(
const
nlohmann
::
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
)
T
get_at_any_key
(
const
json
&
j
,
const
std
::
vector
<
std
::
string
>&
keys
)
{
return
at_any_key
(
j
,
keys
).
get
<
T
>
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment