jsoncpp: Reset existing files to svn-release-0.5.0
This commit is contained in:
Vendored
-7
@@ -234,13 +234,6 @@ namespace Json {
|
|||||||
double asDouble() const;
|
double asDouble() const;
|
||||||
bool asBool() const;
|
bool asBool() const;
|
||||||
|
|
||||||
bool TryGet( std::string &out ) const { if(!isString()) return false; out=asString(); return true; }
|
|
||||||
bool TryGet( int &out ) const { if(!isInt()) return false; out=asInt(); return true; }
|
|
||||||
bool TryGet( UInt &out ) const { if(!isUInt()) return false; out=asUInt(); return true; }
|
|
||||||
bool TryGet( double &out ) const { if(!isDouble()) return false; out=asDouble(); return true; }
|
|
||||||
bool TryGet( float &out ) const { if(!isDouble()) return false; out=(float)asDouble(); return true; }
|
|
||||||
bool TryGet( bool &out ) const { if(!isBool()) return false; out=asBool(); return true; }
|
|
||||||
|
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
bool isBool() const;
|
bool isBool() const;
|
||||||
bool isInt() const;
|
bool isInt() const;
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,5 @@
|
|||||||
#include "json/reader.h"
|
#include <json/reader.h>
|
||||||
#include "json/value.h"
|
#include <json/value.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -877,8 +877,7 @@ std::istream& operator>>( std::istream &sin, Value &root )
|
|||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
bool ok = reader.parse(sin, root, true);
|
bool ok = reader.parse(sin, root, true);
|
||||||
//JSON_ASSERT( ok );
|
//JSON_ASSERT( ok );
|
||||||
// if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages());
|
if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages());
|
||||||
assert(ok);
|
|
||||||
return sin;
|
return sin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "json/value.h"
|
#include <json/value.h>
|
||||||
#include "json/writer.h"
|
#include <json/writer.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define JSON_ASSERT_UNREACHABLE assert( false )
|
#define JSON_ASSERT_UNREACHABLE assert( false )
|
||||||
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
|
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
|
||||||
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) assert(false); /* throw std::runtime_error( message ); */
|
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
#include "json/writer.h"
|
#include <json/writer.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -111,7 +111,7 @@ std::string valueToString( bool value )
|
|||||||
std::string valueToQuotedString( const char *value )
|
std::string valueToQuotedString( const char *value )
|
||||||
{
|
{
|
||||||
// Not sure how to handle unicode...
|
// Not sure how to handle unicode...
|
||||||
if (strpbrk(value, "\"\\\b\f\n\r\t") == nullptr && !containsControlCharacter( value ))
|
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
|
||||||
return std::string("\"") + value + "\"";
|
return std::string("\"") + value + "\"";
|
||||||
// We have to walk value and escape any special characters.
|
// We have to walk value and escape any special characters.
|
||||||
// Appending to std::string is not efficient, but this should be rare.
|
// Appending to std::string is not efficient, but this should be rare.
|
||||||
@@ -542,7 +542,7 @@ StyledWriter::normalizeEOL( const std::string &text )
|
|||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
StyledStreamWriter::StyledStreamWriter( std::string indentation )
|
StyledStreamWriter::StyledStreamWriter( std::string indentation )
|
||||||
: document_(nullptr)
|
: document_(NULL)
|
||||||
, rightMargin_( 74 )
|
, rightMargin_( 74 )
|
||||||
, indentation_( indentation )
|
, indentation_( indentation )
|
||||||
{
|
{
|
||||||
@@ -559,7 +559,7 @@ StyledStreamWriter::write( std::ostream &out, const Value &root )
|
|||||||
writeValue( root );
|
writeValue( root );
|
||||||
writeCommentAfterValueOnSameLine( root );
|
writeCommentAfterValueOnSameLine( root );
|
||||||
*document_ << "\n";
|
*document_ << "\n";
|
||||||
document_ = nullptr; // Forget the stream, for safety.
|
document_ = NULL; // Forget the stream, for safety.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user