Value: Add type check functions.

This commit is contained in:
Peter Johnson
2015-07-24 22:11:57 -07:00
parent 63dd895e6d
commit ae070aca70

View File

@@ -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
*/