Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Koch
dune-common
Commits
2961fa8b
Commit
2961fa8b
authored
14 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
reduce copy-and-paste code
[[Imported from SVN: r6223]]
parent
6f8a2e08
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/configparser.cc
+2
-24
2 additions, 24 deletions
dune/common/configparser.cc
with
2 additions
and
24 deletions
dune/common/configparser.cc
+
2
−
24
View file @
2961fa8b
...
...
@@ -124,9 +124,7 @@ void ConfigParser::parseCmd(int argc, char* argv [])
else
{
if
(
k
.
size
())
{
(
*
this
)[
k
]
=
argv
[
i
];
}
k
.
clear
();
}
}
...
...
@@ -136,30 +134,10 @@ void ConfigParser::parseCmd(int argc, char* argv [])
ConfigParser
&
ConfigParser
::
sub
(
const
string
&
key
)
{
string
::
size_type
dot
=
key
.
find
(
"."
);
if
(
dot
!=
string
::
npos
)
{
ConfigParser
&
s
=
sub
(
key
.
substr
(
0
,
dot
));
return
s
.
sub
(
key
.
substr
(
dot
+
1
));
}
else
// Cast is safe, because ConfigParser has the same memory layout as ParameterTree,
// and this method is temporary anyways.
return
static_cast
<
ConfigParser
&>
(
subs
[
key
]);
return
static_cast
<
ConfigParser
&>
(
ParameterTree
::
sub
(
key
));
}
const
ConfigParser
&
ConfigParser
::
sub
(
const
string
&
key
)
const
{
string
::
size_type
dot
=
key
.
find
(
"."
);
if
(
dot
!=
string
::
npos
)
{
const
ConfigParser
&
s
=
sub
(
key
.
substr
(
0
,
dot
));
return
s
.
sub
(
key
.
substr
(
dot
+
1
));
}
else
// Cast is safe, because ConfigParser has the same memory layout as ParameterTree,
// and this method is temporary anyways.
return
static_cast
<
const
ConfigParser
&>
(
subs
.
find
(
key
)
->
second
);
return
static_cast
<
const
ConfigParser
&>
(
ParameterTree
::
sub
(
key
));
}
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