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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Core Modules
dune-common
Commits
edb8fd69
Commit
edb8fd69
authored
14 years ago
by
Jorrit Fahlke
Browse files
Options
Downloads
Patches
Plain Diff
ConfigParser: Allow to write the report to an arbitrary C++ stream instead of std::cout only
[[Imported from SVN: r6000]]
parent
746d8959
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/configparser.cc
+9
-3
9 additions, 3 deletions
dune/common/configparser.cc
dune/common/configparser.hh
+12
-0
12 additions, 0 deletions
dune/common/configparser.hh
with
21 additions
and
3 deletions
dune/common/configparser.cc
+
9
−
3
View file @
edb8fd69
...
...
@@ -3,7 +3,8 @@
#include
"configparser.hh"
#include
<cstdlib>
#include
<iostream>
#include
<ostream>
#include
<string>
#include
<sstream>
#include
<fstream>
...
...
@@ -126,20 +127,25 @@ void ConfigParser::report() const
}
void
ConfigParser
::
report
(
const
string
prefix
)
const
{
reportStream
(
std
::
cout
,
prefix
);
}
void
ConfigParser
::
reportStream
(
ostream
&
stream
,
const
string
&
prefix
)
const
{
typedef
map
<
string
,
string
>::
const_iterator
ValueIt
;
ValueIt
vit
=
values
.
begin
();
ValueIt
vend
=
values
.
end
();
for
(;
vit
!=
vend
;
++
vit
)
cout
<<
vit
->
first
<<
" =
\"
"
<<
vit
->
second
<<
"
\"
"
<<
endl
;
stream
<<
vit
->
first
<<
" =
\"
"
<<
vit
->
second
<<
"
\"
"
<<
endl
;
typedef
map
<
string
,
ConfigParser
>::
const_iterator
SubIt
;
SubIt
sit
=
subs
.
begin
();
SubIt
send
=
subs
.
end
();
for
(;
sit
!=
send
;
++
sit
)
{
cout
<<
"[ "
<<
prefix
+
sit
->
first
<<
" ]"
<<
endl
;
stream
<<
"[ "
<<
prefix
+
sit
->
first
<<
" ]"
<<
endl
;
(
sit
->
second
).
report
(
prefix
+
sit
->
first
+
"."
);
}
}
...
...
This diff is collapsed.
Click to expand it.
dune/common/configparser.hh
+
12
−
0
View file @
edb8fd69
...
...
@@ -6,6 +6,7 @@
#include
<istream>
#include
<map>
#include
<ostream>
#include
<vector>
#include
<string>
#include
<iostream>
...
...
@@ -145,6 +146,17 @@ namespace Dune {
void
report
(
const
std
::
string
prefix
)
const
;
/** \brief print distinct substructure to stream
*
* Prints all entries with given prefix.
*
* \param stream Stream to print to
* \param prefix for key and substructure names
*/
void
reportStream
(
std
::
ostream
&
stream
,
const
std
::
string
&
prefix
=
""
)
const
;
/** \brief get substructure by name
*
* \param sub substructure name
...
...
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