Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sébastien Villemot
preprocessor
Commits
3947903f
Verified
Commit
3947903f
authored
Apr 12, 2019
by
Houtan Bastani
Browse files
add JSON output for shock_groups
parent
1edc9af7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Shocks.cc
View file @
3947903f
...
...
@@ -635,3 +635,38 @@ ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool
}
}
}
void
ShockGroupsStatement
::
writeJsonOutput
(
ostream
&
output
)
const
{
output
<<
R"({"statementName": "shock_groups", "name": ")"
<<
name
<<
R"(", "groups": {)"
;
bool
unique_label
=
true
;
bool
printed_group
=
false
;
for
(
auto
it
=
shock_groups
.
begin
();
it
!=
shock_groups
.
end
();
it
++
,
unique_label
=
true
)
{
for
(
auto
it1
=
it
+
1
;
it1
!=
shock_groups
.
end
();
it1
++
)
if
(
it
->
name
==
it1
->
name
)
{
unique_label
=
false
;
break
;
}
if
(
unique_label
)
{
if
(
printed_group
)
output
<<
", "
;
else
printed_group
=
true
;
output
<<
R"("group_name": ")"
<<
it
->
name
<<
R"(",)"
<<
R"("shocks": [)"
;
for
(
auto
it1
=
it
->
list
.
begin
();
it1
!=
it
->
list
.
end
();
it1
++
)
{
if
(
it1
!=
it
->
list
.
begin
())
output
<<
", "
;
output
<<
R"(")"
<<
*
it1
<<
R"(")"
;
}
output
<<
"]"
;
}
}
output
<<
"}}"
;
}
src/Shocks.hh
View file @
3947903f
...
...
@@ -163,6 +163,7 @@ private:
public:
ShockGroupsStatement
(
group_t
shock_groups_arg
,
string
name_arg
);
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
override
;
void
writeJsonOutput
(
ostream
&
output
)
const
override
;
};
#endif
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