diff options
Diffstat (limited to 'src/value.h')
-rw-r--r-- | src/value.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/value.h b/src/value.h index f001a4aa..51b5be22 100644 --- a/src/value.h +++ b/src/value.h @@ -187,6 +187,9 @@ class value_t return *this; } + bool is_boolean() const { + return type == BOOLEAN; + } bool& as_boolean() { assert(type == BOOLEAN); return *(bool *) data; @@ -195,6 +198,10 @@ class value_t assert(type == BOOLEAN); return *(bool *) data; } + + bool is_long() const { + return type == INTEGER; + } long& as_long() { assert(type == INTEGER); return *(long *) data; @@ -203,6 +210,10 @@ class value_t assert(type == INTEGER); return *(long *) data; } + + bool is_datetime() const { + return type == DATETIME; + } moment_t& as_datetime() { assert(type == DATETIME); return *(moment_t *) data; @@ -211,6 +222,10 @@ class value_t assert(type == DATETIME); return *(moment_t *) data; } + + bool is_amount() const { + return type == AMOUNT; + } amount_t& as_amount() { assert(type == AMOUNT); return *(amount_t *) data; @@ -219,6 +234,10 @@ class value_t assert(type == AMOUNT); return *(amount_t *) data; } + + bool is_balance() const { + return type == BALANCE; + } balance_t& as_balance() { assert(type == BALANCE); return *(balance_t *) data; @@ -227,6 +246,10 @@ class value_t assert(type == BALANCE); return *(balance_t *) data; } + + bool is_balance_pair() const { + return type == BALANCE_PAIR; + } balance_pair_t& as_balance_pair() { assert(type == BALANCE_PAIR); return *(balance_pair_t *) data; @@ -235,6 +258,10 @@ class value_t assert(type == BALANCE_PAIR); return *(balance_pair_t *) data; } + + bool is_string() const { + return type == STRING; + } string& as_string() { assert(type == STRING); return *(string *) data; @@ -243,6 +270,10 @@ class value_t assert(type == STRING); return *(string *) data; } + + bool is_sequence() const { + return type == SEQUENCE; + } sequence_t& as_sequence() { assert(type == SEQUENCE); return *(sequence_t *) data; @@ -252,6 +283,9 @@ class value_t return *(sequence_t *) data; } + bool is_xml_node() const { + return type == XML_NODE; + } xml::node_t *& as_xml_node() { assert(type == XML_NODE); return *(xml::node_t **) data; @@ -260,6 +294,10 @@ class value_t assert(type == XML_NODE); return *(xml::node_t **) data; } + + bool is_pointer() const { + return type == POINTER; + } void *& as_pointer() { assert(type == POINTER); return *(void **) data; |