From 8694b95cecd6a51580789233c392867f2db0ed1a Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 4 Jul 2016 15:45:38 +1000 Subject: [PATCH] json/tree: add is_integer query --- json/tree.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/json/tree.hpp b/json/tree.hpp index acb2a78b..2170ff0b 100644 --- a/json/tree.hpp +++ b/json/tree.hpp @@ -90,6 +90,7 @@ namespace json { namespace tree { virtual bool is_array (void) const { return false; } virtual bool is_string (void) const { return false; } virtual bool is_number (void) const { return false; } + virtual bool is_integer (void) const { return false; } virtual bool is_boolean (void) const { return false; } virtual bool is_null (void) const { return false; } @@ -267,6 +268,7 @@ namespace json { namespace tree { virtual const number& as_number (void) const& override { return *this; } virtual number& as_number (void) & override { return *this; } virtual bool is_number (void) const override { return true; } + virtual bool is_integer (void) const override { return repr () == UINT || repr () == SINT; } virtual type_t type (void) const override { return NUMBER; } virtual repr_t repr (void) const { return m_repr; }