json/tree: add as_bool native accessor

This commit is contained in:
Danny Robson 2015-03-23 18:41:07 +11:00
parent 585a0b464c
commit d102410567
2 changed files with 10 additions and 0 deletions

View File

@ -268,6 +268,15 @@ json::tree::node::as_null (void)
///////////////////////////////////////////////////////////////////////////////
bool
json::tree::node::as_bool (void) const
{
return !!as_boolean ();
}
//-----------------------------------------------------------------------------
float
json::tree::node::as_float (void) const
{

View File

@ -70,6 +70,7 @@ namespace json { namespace tree {
virtual boolean& as_boolean (void);
virtual null& as_null (void);
virtual bool as_bool (void) const;
virtual float as_float (void) const;
virtual double as_double (void) const;
virtual size_t as_uint (void) const;