mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 18:51:04 +08:00
JSONCPP_OSTRINGSTREAM
This commit is contained in:
parent
724ba29bd3
commit
38bb491400
@ -25,7 +25,7 @@
|
||||
|
||||
# define JSON_FAIL_MESSAGE(message) \
|
||||
{ \
|
||||
std::ostringstream oss; oss << message; \
|
||||
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
||||
Json::throwLogicError(oss.str()); \
|
||||
abort(); \
|
||||
}
|
||||
@ -38,7 +38,7 @@
|
||||
// release builds we abort, for a core-dump or debugger.
|
||||
# define JSON_FAIL_MESSAGE(message) \
|
||||
{ \
|
||||
std::ostringstream oss; oss << message; \
|
||||
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
||||
assert(false && oss.str().c_str()); \
|
||||
abort(); \
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ static std::string useStyledStreamWriter(
|
||||
Json::Value const& root)
|
||||
{
|
||||
Json::StyledStreamWriter writer;
|
||||
std::ostringstream sout;
|
||||
JSONCPP_OSTRINGSTREAM sout;
|
||||
writer.write(sout, root);
|
||||
return sout.str();
|
||||
}
|
||||
|
@ -2010,7 +2010,7 @@ bool parseFromStream(
|
||||
CharReader::Factory const& fact, std::istream& sin,
|
||||
Value* root, std::string* errs)
|
||||
{
|
||||
std::ostringstream ssin;
|
||||
JSONCPP_OSTRINGSTREAM ssin;
|
||||
ssin << sin.rdbuf();
|
||||
std::string doc = ssin.str();
|
||||
char const* begin = doc.data();
|
||||
|
@ -217,7 +217,7 @@ std::string valueToQuotedString(const char* value) {
|
||||
// sequence from occurring.
|
||||
default:
|
||||
if (isControlCharacter(*c)) {
|
||||
std::ostringstream oss;
|
||||
JSONCPP_OSTRINGSTREAM oss;
|
||||
oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
|
||||
<< std::setw(4) << static_cast<int>(*c);
|
||||
result += oss.str();
|
||||
@ -295,7 +295,7 @@ static std::string valueToQuotedStringN(const char* value, unsigned length) {
|
||||
// sequence from occurring.
|
||||
default:
|
||||
if ((isControlCharacter(*c)) || (*c == 0)) {
|
||||
std::ostringstream oss;
|
||||
JSONCPP_OSTRINGSTREAM oss;
|
||||
oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
|
||||
<< std::setw(4) << static_cast<int>(*c);
|
||||
result += oss.str();
|
||||
@ -1200,7 +1200,7 @@ void StreamWriterBuilder::setDefaults(Json::Value* settings)
|
||||
}
|
||||
|
||||
std::string writeString(StreamWriter::Factory const& builder, Value const& root) {
|
||||
std::ostringstream sout;
|
||||
JSONCPP_OSTRINGSTREAM sout;
|
||||
StreamWriterPtr const writer(builder.newStreamWriter());
|
||||
writer->write(root, &sout);
|
||||
return sout.str();
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
// Generic operator that will work with anything ostream can deal with.
|
||||
template <typename T> TestResult& operator<<(const T& value) {
|
||||
std::ostringstream oss;
|
||||
JSONCPP_OSTRINGSTREAM oss;
|
||||
oss.precision(16);
|
||||
oss.setf(std::ios_base::floatfield);
|
||||
oss << value;
|
||||
|
@ -2480,13 +2480,13 @@ JSONTEST_FIXTURE(IteratorTest, const) {
|
||||
|
||||
for(int i = 9; i < 12; ++i)
|
||||
{
|
||||
std::ostringstream out;
|
||||
JSONCPP_OSTRINGSTREAM out;
|
||||
out << std::setw(2) << i;
|
||||
std::string str = out.str();
|
||||
value[str] = str;
|
||||
}
|
||||
|
||||
std::ostringstream out;
|
||||
JSONCPP_OSTRINGSTREAM out;
|
||||
//in old code, this will get a compile error
|
||||
Json::Value::const_iterator iter = value.begin();
|
||||
for(; iter != value.end(); ++iter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user