mirror of https://github.com/lukechilds/komodo.git
Gavin Andresen
11 years ago
18 changed files with 697 additions and 398 deletions
@ -1,95 +1,96 @@ |
|||
// Copyright John W. Wilkinson 2007 - 2009.
|
|||
// Copyright John W. Wilkinson 2007 - 2013
|
|||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
|||
|
|||
// json spirit version 4.03
|
|||
// json spirit version 4.06
|
|||
|
|||
#include "json_spirit_writer.h" |
|||
#include "json_spirit_writer_template.h" |
|||
|
|||
void json_spirit::write( const Value& value, std::ostream& os ) |
|||
using namespace json_spirit; |
|||
|
|||
#ifdef JSON_SPIRIT_VALUE_ENABLED |
|||
void json_spirit::write( const Value& value, std::ostream& os, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, false ); |
|||
write_stream( value, os, options ); |
|||
} |
|||
|
|||
void json_spirit::write_formatted( const Value& value, std::ostream& os ) |
|||
std::string json_spirit::write( const Value& value, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, true ); |
|||
return write_string( value, options ); |
|||
} |
|||
|
|||
std::string json_spirit::write( const Value& value ) |
|||
void json_spirit::write_formatted( const Value& value, std::ostream& os ) |
|||
{ |
|||
return write_string( value, false ); |
|||
write_stream( value, os, pretty_print ); |
|||
} |
|||
|
|||
std::string json_spirit::write_formatted( const Value& value ) |
|||
{ |
|||
return write_string( value, true ); |
|||
return write_string( value, pretty_print ); |
|||
} |
|||
#endif |
|||
|
|||
#ifndef BOOST_NO_STD_WSTRING |
|||
|
|||
void json_spirit::write( const wValue& value, std::wostream& os ) |
|||
#ifdef JSON_SPIRIT_MVALUE_ENABLED |
|||
void json_spirit::write( const mValue& value, std::ostream& os, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, false ); |
|||
write_stream( value, os, options ); |
|||
} |
|||
|
|||
void json_spirit::write_formatted( const wValue& value, std::wostream& os ) |
|||
std::string json_spirit::write( const mValue& value, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, true ); |
|||
return write_string( value, options ); |
|||
} |
|||
|
|||
std::wstring json_spirit::write( const wValue& value ) |
|||
void json_spirit::write_formatted( const mValue& value, std::ostream& os ) |
|||
{ |
|||
return write_string( value, false ); |
|||
write_stream( value, os, pretty_print ); |
|||
} |
|||
|
|||
std::wstring json_spirit::write_formatted( const wValue& value ) |
|||
std::string json_spirit::write_formatted( const mValue& value ) |
|||
{ |
|||
return write_string( value, true ); |
|||
return write_string( value, pretty_print ); |
|||
} |
|||
|
|||
#endif |
|||
|
|||
void json_spirit::write( const mValue& value, std::ostream& os ) |
|||
#if defined( JSON_SPIRIT_WVALUE_ENABLED ) && !defined( BOOST_NO_STD_WSTRING ) |
|||
void json_spirit::write( const wValue& value, std::wostream& os, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, false ); |
|||
write_stream( value, os, options ); |
|||
} |
|||
|
|||
void json_spirit::write_formatted( const mValue& value, std::ostream& os ) |
|||
std::wstring json_spirit::write( const wValue& value, unsigned int options ) |
|||
{ |
|||
write_stream( value, os, true ); |
|||
return write_string( value, options ); |
|||
} |
|||
|
|||
std::string json_spirit::write( const mValue& value ) |
|||
void json_spirit::write_formatted( const wValue& value, std::wostream& os ) |
|||
{ |
|||
return write_string( value, false ); |
|||
write_stream( value, os, pretty_print ); |
|||
} |
|||
|
|||
std::string json_spirit::write_formatted( const mValue& value ) |
|||
std::wstring json_spirit::write_formatted( const wValue& value ) |
|||
{ |
|||
return write_string( value, true ); |
|||
return write_string( value, pretty_print ); |
|||
} |
|||
#endif |
|||
|
|||
#ifndef BOOST_NO_STD_WSTRING |
|||
|
|||
void json_spirit::write( const wmValue& value, std::wostream& os ) |
|||
#if defined( JSON_SPIRIT_WMVALUE_ENABLED ) && !defined( BOOST_NO_STD_WSTRING ) |
|||
void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) |
|||
{ |
|||
write_stream( value, os, false ); |
|||
write_stream( value, os, pretty_print ); |
|||
} |
|||
|
|||
void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) |
|||
std::wstring json_spirit::write_formatted( const wmValue& value ) |
|||
{ |
|||
write_stream( value, os, true ); |
|||
return write_string( value, pretty_print ); |
|||
} |
|||
|
|||
std::wstring json_spirit::write( const wmValue& value ) |
|||
void json_spirit::write( const wmValue& value, std::wostream& os, unsigned int options ) |
|||
{ |
|||
return write_string( value, false ); |
|||
write_stream( value, os, options ); |
|||
} |
|||
|
|||
std::wstring json_spirit::write_formatted( const wmValue& value ) |
|||
std::wstring json_spirit::write( const wmValue& value, unsigned int options ) |
|||
{ |
|||
return write_string( value, true ); |
|||
return write_string( value, options ); |
|||
} |
|||
|
|||
#endif |
|||
|
@ -0,0 +1,33 @@ |
|||
#ifndef JSON_SPIRIT_WRITER_OPTIONS |
|||
#define JSON_SPIRIT_WRITER_OPTIONS |
|||
|
|||
// Copyright John W. Wilkinson 2007 - 2013
|
|||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
|||
|
|||
// json spirit version 4.06
|
|||
|
|||
#if defined(_MSC_VER) && (_MSC_VER >= 1020) |
|||
# pragma once |
|||
#endif |
|||
|
|||
namespace json_spirit |
|||
{ |
|||
enum Output_options{ pretty_print = 0x01, // Add whitespace to format the output nicely.
|
|||
|
|||
raw_utf8 = 0x02, // This prevents non-printable characters from being escapted using "\uNNNN" notation.
|
|||
// Note, this is an extension to the JSON standard. It disables the escaping of
|
|||
// non-printable characters allowing UTF-8 sequences held in 8 bit char strings
|
|||
// to pass through unaltered.
|
|||
|
|||
remove_trailing_zeros = 0x04, |
|||
// outputs e.g. "1.200000000000000" as "1.2"
|
|||
single_line_arrays = 0x08, |
|||
// pretty printing except that arrays printed on single lines unless they contain
|
|||
// composite elements, i.e. objects or arrays
|
|||
always_escape_nonascii = 0x10, |
|||
// all unicode wide characters are escaped, i.e. outputed as "\uXXXX", even if they are
|
|||
// printable under the current locale, ascii printable chars are not escaped
|
|||
}; |
|||
} |
|||
|
|||
#endif |
Loading…
Reference in new issue