added template contructor for object

pull/40/head
Nestal Wan 2012-07-30 16:43:36 +08:00
parent 0b2a8c0a54
commit bec8362639
1 changed files with 12 additions and 1 deletions

View File

@ -101,6 +101,17 @@ Json::Json( const bool& b ) :
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 ) :
m_json( json )
{