From ae070aca707385d077688bce22db15232de6fd5f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 24 Jul 2015 22:11:57 -0700 Subject: [PATCH] Value: Add type check functions. --- include/nt_Value.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/nt_Value.h b/include/nt_Value.h index 0b5a1b16d5..d99f8ea89b 100644 --- a/include/nt_Value.h +++ b/include/nt_Value.h @@ -36,6 +36,18 @@ class Value { const NT_Value& value() const { return m_val; } unsigned long long last_change() const { return m_val.last_change; } + /* + * Type Checkers + */ + bool IsBoolean() const { return m_val.type == NT_BOOLEAN; } + bool IsDouble() const { return m_val.type == NT_DOUBLE; } + bool IsString() const { return m_val.type == NT_STRING; } + bool IsRaw() const { return m_val.type == NT_RAW; } + bool IsRpc() const { return m_val.type == NT_RPC; } + bool IsBooleanArray() const { return m_val.type == NT_BOOLEAN_ARRAY; } + bool IsDoubleArray() const { return m_val.type == NT_DOUBLE_ARRAY; } + bool IsStringArray() const { return m_val.type == NT_STRING_ARRAY; } + /* * Type-Safe Getters */