mirror of https://github.com/vitalif/grive2
added template contructor for object
parent
0b2a8c0a54
commit
bec8362639
|
@ -101,6 +101,17 @@ Json::Json( const bool& b ) :
|
||||||
BOOST_THROW_EXCEPTION( Error() << expt::ErrMsg( "cannot create json bool" ) ) ;
|
BOOST_THROW_EXCEPTION( Error() << expt::ErrMsg( "cannot create json bool" ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
Json::Json( const Object& obj ) :
|
||||||
|
m_json( ::json_object_new_object() )
|
||||||
|
{
|
||||||
|
if ( m_json == 0 )
|
||||||
|
BOOST_THROW_EXCEPTION( Error() << expt::ErrMsg( "cannot create json object" ) ) ;
|
||||||
|
|
||||||
|
for ( Object::const_iterator i = obj.begin() ; i != obj.end() ; ++i )
|
||||||
|
Add( i->first, i->second ) ;
|
||||||
|
}
|
||||||
|
|
||||||
Json::Json( struct json_object *json, NotOwned ) :
|
Json::Json( struct json_object *json, NotOwned ) :
|
||||||
m_json( json )
|
m_json( json )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue