Represents an integer value. More...
#include "api/value.h"
Public Member Functions | |
CIntegerValue (int value) | |
type | get_type () const |
Get this value's type (see type) | |
operator int () const | |
Cast to an integer. More... | |
const CIntegerValue & | operator= (const CIntegerValue &to_copy) |
CValue * | clone () const |
Creates copy of value. More... | |
void | convert (CValue &conversion_target) const |
Converts value into another type. More... | |
bool | is_equal (const CValue &other) const |
Compares values. More... | |
float | get_distance (const CValue &other) const |
Obtain an arbitrary measure of magnitude of different between values. More... | |
string | get_as_string () const |
Convert value to string. | |
void | set_from_string (const string &source) |
Set value from string. More... | |
![]() | |
virtual | operator float () const |
Cast to a float. More... | |
virtual | operator const string & () const |
Cast to a string. More... | |
CValue * | transmogrify (type new_type) const |
Copy into new value of different type. More... | |
Additional Inherited Members | |
![]() | |
enum | type { INTEGER, FLOAT, STRING } |
![]() | |
static CValue * | factory (type new_type) |
Create new CValue of specified type. More... | |
static const char * | get_type_name (type value_type) |
Get string representation of value type. | |
static int | type_to_ixd_code (type value_type) |
convert value type to ixd code More... | |
static type | ixd_code_to_type (int ixd_code) |
convert ixd code to value type More... | |
Represents an integer value.
|
virtual |
Creates copy of value.
Creates a CValue of same type and value, allocated on the heap with new
Implements integra_api::CValue.
|
virtual |
Converts value into another type.
Copies value into conversion_target, retaining as much information as possible when types differ
Implements integra_api::CValue.
|
virtual |
Obtain an arbitrary measure of magnitude of different between values.
Expects types to be the same. For numeric types, distance is actually abs( difference ) For strings, distance is taken as the levenshtein_distance (http://en.wikipedia.org/wiki/Levenshtein_distance
other | Value to compare |
Implements integra_api::CValue.
|
virtual |
Compares values.
other | Value to compare |
Implements integra_api::CValue.
|
virtual |
Cast to an integer.
These cast operations are provided in CValue to minimise clutter in the calling code by removing the need for dynamic downcasting to query the value of subclasses. However, it is the caller's responsibilty to ensure that only the right downcast operator is used. For example, the caller ,ust only ever cast a CFloatValue to float, and so on. Type-incorrect casting will cause libIntegra to trace an error and throw an assertion failure.
Reimplemented from integra_api::CValue.
|
virtual |
Set value from string.
Implements integra_api::CValue.