update save to file to take fc::path
This commit is contained in:
parent
4ea60ef088
commit
a792cfaca7
2 changed files with 10 additions and 3 deletions
|
|
@ -25,7 +25,14 @@ namespace fc
|
||||||
static variant from_string( const string& utf8_str );
|
static variant from_string( const string& utf8_str );
|
||||||
static string to_string( const variant& v );
|
static string to_string( const variant& v );
|
||||||
static string to_pretty_string( const variant& v );
|
static string to_pretty_string( const variant& v );
|
||||||
static void save_to_file( const variant& v, const string& fi, bool pretty = true );
|
|
||||||
|
template<typename T>
|
||||||
|
static void save_to_file( const T& v, const fc::path& fi, bool pretty = true )
|
||||||
|
{
|
||||||
|
save_to_file( variant(v), fi, pretty );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void save_to_file( const variant& v, const fc::path& fi, bool pretty = true );
|
||||||
static variant from_file( const fc::path& p );
|
static variant from_file( const fc::path& p );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
||||||
|
|
@ -533,9 +533,9 @@ namespace fc
|
||||||
return pretty_print(to_string(v), 2);
|
return pretty_print(to_string(v), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void json::save_to_file( const variant& v, const string& fi, bool pretty )
|
void json::save_to_file( const variant& v, const fc::path& fi, bool pretty )
|
||||||
{
|
{
|
||||||
fc::ofstream o( fi.c_str() );
|
fc::ofstream o( fi.generic_string().c_str() );
|
||||||
fc::to_stream( o, v );
|
fc::to_stream( o, v );
|
||||||
}
|
}
|
||||||
variant json::from_file( const fc::path& p )
|
variant json::from_file( const fc::path& p )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue