Skip to content

Commit ef406a0

Browse files
author
martin
committed
Move the default implementations of output_json and output_xml into ai.cpp.
This means that <sstream> is no longer included in ai.h as requested in review.
1 parent 7468205 commit ef406a0

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

src/analyses/ai.cpp

+46
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Author: Daniel Kroening, [email protected]
88

99
#include <cassert>
1010
#include <memory>
11+
#include <sstream>
1112

1213
#include <util/std_expr.h>
1314
#include <util/std_code.h>
@@ -18,6 +19,51 @@ Author: Daniel Kroening, [email protected]
1819

1920
/*******************************************************************\
2021
22+
Function: ai_domain_baset::output_json
23+
24+
Inputs:
25+
26+
Outputs:
27+
28+
Purpose:
29+
30+
\*******************************************************************/
31+
32+
jsont ai_domain_baset::output_json(
33+
const ai_baset &ai,
34+
const namespacet &ns) const
35+
{
36+
std::ostringstream out;
37+
output(out, ai, ns);
38+
json_stringt json(out.str());
39+
return json;
40+
}
41+
42+
/*******************************************************************\
43+
44+
Function: ai_domain_baset::output_xml
45+
46+
Inputs:
47+
48+
Outputs:
49+
50+
Purpose:
51+
52+
\*******************************************************************/
53+
54+
xmlt ai_domain_baset::output_xml(
55+
const ai_baset &ai,
56+
const namespacet &ns) const
57+
{
58+
std::ostringstream out;
59+
output(out, ai, ns);
60+
xmlt xml("domain");
61+
xml.data=out.str();
62+
return xml;
63+
}
64+
65+
/*******************************************************************\
66+
2167
Function: ai_baset::output
2268
2369
Inputs:

src/analyses/ai.h

+2-16
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include <map>
1313
#include <iosfwd>
14-
#include <sstream>
1514

1615
#include <util/json.h>
1716
#include <util/xml.h>
@@ -59,24 +58,11 @@ class ai_domain_baset
5958

6059
virtual jsont output_json(
6160
const ai_baset &ai,
62-
const namespacet &ns) const
63-
{
64-
std::ostringstream out;
65-
output(out, ai, ns);
66-
json_stringt json(out.str());
67-
return json;
68-
}
61+
const namespacet &ns) const;
6962

7063
virtual xmlt output_xml(
7164
const ai_baset &ai,
72-
const namespacet &ns) const
73-
{
74-
std::ostringstream out;
75-
output(out, ai, ns);
76-
xmlt xml("domain");
77-
xml.data=out.str();
78-
return xml;
79-
}
65+
const namespacet &ns) const;
8066

8167
// no states
8268
virtual void make_bottom()=0;

0 commit comments

Comments
 (0)