Commit 6cb1f39f authored by Jelte Jansen's avatar Jelte Jansen

changed stringstream argument in toJSON to the more general ostream


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac172@2123 e5f2f494-b856-4b98-b285-d166d9295462
parent 90c2af0b
......@@ -615,19 +615,19 @@ Element::fromJSON(const std::string &in) {
// to JSON format
void
IntElement::toJSON(std::stringstream& ss)
IntElement::toJSON(std::ostream& ss)
{
ss << intValue();
}
void
DoubleElement::toJSON(std::stringstream& ss)
DoubleElement::toJSON(std::ostream& ss)
{
ss << doubleValue();
}
void
BoolElement::toJSON(std::stringstream& ss)
BoolElement::toJSON(std::ostream& ss)
{
if (b) {
ss << "true";
......@@ -637,13 +637,13 @@ BoolElement::toJSON(std::stringstream& ss)
}
void
NullElement::toJSON(std::stringstream& ss)
NullElement::toJSON(std::ostream& ss)
{
ss << "null";
}
void
StringElement::toJSON(std::stringstream& ss)
StringElement::toJSON(std::ostream& ss)
{
ss << "\"";
ss << stringValue();
......@@ -651,7 +651,7 @@ StringElement::toJSON(std::stringstream& ss)
}
void
ListElement::toJSON(std::stringstream& ss)
ListElement::toJSON(std::ostream& ss)
{
ss << "[ ";
......@@ -667,7 +667,7 @@ ListElement::toJSON(std::stringstream& ss)
}
void
MapElement::toJSON(std::stringstream& ss)
MapElement::toJSON(std::ostream& ss)
{
ss << "{ ";
......
......@@ -118,7 +118,7 @@ public:
/// Converts the Element to JSON format and appends it to
/// the given stringstream.
virtual void toJSON(std::stringstream& ss) = 0;
virtual void toJSON(std::ostream& ss) = 0;
/// \name Type-specific getters
///
......@@ -355,7 +355,7 @@ public:
bool getValue(int& t) { t = i; return true; };
using Element::setValue;
bool setValue(const int v) { i = v; return true; };
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
......@@ -369,7 +369,7 @@ public:
bool getValue(double& t) { t = d; return true; };
using Element::setValue;
bool setValue(const double v) { d = v; return true; };
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
......@@ -383,14 +383,14 @@ public:
bool getValue(bool& t) { t = b; return true; };
using Element::setValue;
bool setValue(const bool v) { b = v; return true; };
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
class NullElement : public Element {
public:
NullElement() : Element(null) {};
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
......@@ -404,7 +404,7 @@ public:
bool getValue(std::string& t) { t = s; return true; };
using Element::setValue;
bool setValue(const std::string& v) { s = v; return true; };
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
......@@ -425,7 +425,7 @@ public:
void add(ElementPtr e) { l.push_back(e); };
using Element::remove;
void remove(int i) { l.erase(l.begin() + i); };
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
size_t size() { return l.size(); }
bool equals(ElementPtr other);
};
......@@ -448,7 +448,7 @@ public:
using Element::remove;
void remove(const std::string& s) { m.erase(s); }
bool contains(const std::string& s) { return m.find(s) != m.end(); }
void toJSON(std::stringstream& ss);
void toJSON(std::ostream& ss);
// we should name the two finds better...
// find the element at id; raises TypeError if one of the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment