![]() |
PVL: Parameter Value Language
|
An Integer implements a Value with an integer datum. More...
#include <Value.hh>
Public Member Functions | |
Integer * | clone () const |
Constructs a clone of this Integer. | |
int | compare (const Value &value) const |
This Integer is compared to another Value. | |
Integer (const Integer_type datum, const int base, const int digits=0) | |
Constructs an Integer from an Integer_type datum. | |
Integer (const Unsigned_Integer_type datum, const int base, const int digits=0) | |
Constructs an Integer from an Unsigned_Integer_type datum. | |
Integer (const unsigned int datum, const int base, const int digits=0) | |
Constructs an Integer from an unsigned int datum. | |
Integer (const Real_type datum, const bool is_signed=SIGNED, const int base=10, const int digits=0) | |
Constructs an Integer from a Real_type datum. | |
Integer (const int datum, const bool is_signed=SIGNED, const int base=10, const int digits=0) | |
Constructs an Integer from an int datum. | |
Integer (const Real_type datum, const int base, const int digits=0) | |
Constructs an Integer from a Real_type datum. | |
Integer (const String_type &datum, const bool is_signed=SIGNED, const int base=0, const int digits=0) | |
Constructs an Integer from a String_type value representation. | |
Integer (const Integer_type datum=0, const bool is_signed=SIGNED, const int base=10, const int digits=0) | |
Constructs an Integer from an Integer_type datum. | |
Integer (const int datum, const int base, const int digits=0) | |
Constructs an Integer from an int datum. | |
Integer (const String_type &datum, const int base, const int digits=0) | |
Constructs an Integer from a String_type value representation. | |
Integer (const Integer &value) | |
Constructs an Integer as a copy of another Integer. | |
Integer (const Unsigned_Integer_type datum, const bool is_signed=UNSIGNED, const int base=10, const int digits=0) | |
Constructs an Integer from an Unsigned_Integer_type datum. | |
Integer (const Value &value) | |
Constructs an Integer from another Value. | |
Integer (const unsigned int datum, const bool is_signed=UNSIGNED, const int base=10, const int digits=0) | |
Constructs an Integer from an unsigned int datum. | |
bool | is_Integer () const |
Asserts that the Integer is an INTEGER Type. | |
bool | is_Numeric () const |
Asserts that the Integer is a NUMERIC Type. | |
bool | is_signed () const |
Tests if the Integer is to be treated as a signed value. | |
Integer & | is_signed (const bool sign) |
Sets the signed-ness of the Value. | |
operator int () const | |
Casts the Integer to an int type. | |
operator Integer_type () const | |
Casts the Integer to an Integer_type. | |
operator Real_type () const | |
Casts the Integer to a Real_type. | |
operator String_type () const | |
Casts the Integer to a String_type. | |
Integer | operator+ (const Value &value) const |
Adds this Integer and another Value. | |
Integer & | operator+= (const Value &value) |
Adds another Value to this Value. | |
Integer & | operator= (const unsigned int value) |
Assigns an unsigned int type value to this Integer. | |
Integer & | operator= (const Real_type value) |
Assigns a Real_type value to this Integer. | |
Integer & | operator= (const Value &value) |
Assigns a Value to this Integer. | |
Integer & | operator= (const Integer_type value) |
Assigns an Integer_type value to this Integer. | |
Integer & | operator= (const int value) |
Assigns an int type value to this Integer. | |
Integer & | operator= (const String_type &value) |
Assigns a string representation of a value to this Integer. | |
Integer & | operator= (const char *value) |
Assigns a string representation of a value to this Integer. | |
Type | type () const |
Gets the INTEGER Type code. | |
std::string | type_name () const |
Gets the name string for the INTEGER Type. |
An Integer implements a Value with an integer datum.
An Integer may be treated as signed or unsigned.
An Integer may always be cast to either a Real or String Value.
Integer | ( | const Integer_type | datum = 0 , |
const bool | is_signed = SIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs an Integer from an Integer_type datum.
datum | The Integer_type datum to be assigned the initial value of the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer | ( | const Integer_type | datum, |
const int | base, | ||
const int | digits = 0 |
||
) |
Constructs an Integer from an Integer_type datum.
Integer | ( | const Unsigned_Integer_type | datum, |
const bool | is_signed = UNSIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs an Integer from an Unsigned_Integer_type datum.
datum | The Unsigned_Integer_type datum to be assigned the initial value of the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer | ( | const Unsigned_Integer_type | datum, |
const int | base, | ||
const int | digits = 0 |
||
) |
Constructs an Integer from an Unsigned_Integer_type datum.
Integer | ( | const int | datum, |
const bool | is_signed = SIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs an Integer from an int datum.
datum | The int datum to be assigned the initial value of the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer | ( | const int | datum, |
const int | base, | ||
const int | digits = 0 |
||
) |
Constructs an Integer from an int datum.
Integer | ( | const unsigned int | datum, |
const bool | is_signed = UNSIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs an Integer from an unsigned int datum.
datum | The unsigned int datum to be assigned the initial value of the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer | ( | const unsigned int | datum, |
const int | base, | ||
const int | digits = 0 |
||
) |
Constructs an Integer from an unsigned int datum.
Integer | ( | const Real_type | datum, |
const bool | is_signed = SIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) | [explicit] |
Constructs an Integer from a Real_type datum.
datum | The Real_type datum, cast to an Integer_type, to be assigned the initial value of the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Constructs an Integer from a Real_type datum.
Integer | ( | const String_type & | datum, |
const bool | is_signed = SIGNED , |
||
const int | base = 0 , |
||
const int | digits = 0 |
||
) | [explicit] |
Constructs an Integer from a String_type value representation.
The intial value of the Integer will be taken from the conversion of the string representation to an integer.
datum | The String_type representation of the initial value to be assigned to the Integer. |
is_signed | true (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise. |
base | The numeric base to be used for a string representation of the Integer. If this is 0 it will be intuited from the string representation. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer | ( | const String_type & | datum, |
const int | base, | ||
const int | digits = 0 |
||
) | [explicit] |
Constructs an Integer from a String_type value representation.
The intial value of the Integer will be taken from the conversion of the string representation to an integer.
The Integer is marked as SIGNED.
datum | The String_type value representation. |
base | The numeric base to be used for a string representation of the Integer. If this is 0 it will be intuited from the string representation. |
digits | The minimum number of digits to be used for a string representation; 0 padding is used. |
Integer* clone | ( | ) | const [inline, virtual] |
operator int | ( | ) | const [inline, virtual] |
operator Integer_type | ( | ) | const [inline, virtual] |
operator Real_type | ( | ) | const [virtual] |
Casts the Integer to a Real_type.
If the Integer is unsigned the Real_type value will be cast from the Integer cast to an unsigned Integer_type.
Implements Value.
operator String_type | ( | ) | const [virtual] |
Casts the Integer to a String_type.
The String_type representation of the datum is produced. Whether the value is_signed, its radix base and the number of digits for the representation are used.
Implements Value.
bool is_signed | ( | ) | const [inline, virtual] |
Integer& is_signed | ( | const bool | sign | ) | [inline, virtual] |
bool is_Numeric | ( | ) | const [inline, virtual] |
bool is_Integer | ( | ) | const [inline, virtual] |
Type type | ( | ) | const [inline, virtual] |
Gets the INTEGER Type code.
Implements Value.
References Value::INTEGER.
std::string type_name | ( | ) | const [inline, virtual] |
Gets the name string for the INTEGER Type.
Implements Value.
References Value::INTEGER, and Value::type_name().
Assigns a Value to this Integer.
The datum for this Integer is the Value cast to an Integer_type.
If the base of the Value is 0 and the Value is a String, then the base is intuited from the String characters.
All other characteristics of the Value, except its parent, are assigned directly.
value | The Value to be assigned. |
Invalid_Argument | If the Value can not be cast to an Integer_Type. |
Implements Value.
Integer& operator= | ( | const int | value | ) | [inline, virtual] |
Integer& operator= | ( | const unsigned int | value | ) | [inline, virtual] |
Integer& operator= | ( | const Integer_type | value | ) | [inline, virtual] |
Integer& operator= | ( | const String_type & | value | ) | [virtual] |
Assigns a string representation of a value to this Integer.
If the base of the string representation can be intuited, it is assigned as the Base of this Integer.
The datum for this Integer is assigned the value of the string representation parsed as an integer value.
value | The String_type value to be assigned. |
Invalid_Argument | If the string representation can not be parsed as an integer value. |
Implements Value.
Integer& operator= | ( | const char * | value | ) | [virtual] |
Assigns a string representation of a value to this Integer.
If the character string is non-NULL, an assignment of the character string as a String_type is done. Otherwise an assignment of an emtpy String_type is done.
value | A pointer to a character string (C-string). |
Implements Value.
Adds this Integer and another Value.
This Integer is copied, onto the stack, and the Value is added to it. The temporary copy of the stack value that is returned is expected to be immediately assigned or otherwise used.
value | The Value to be used in the addition operation. |
int compare | ( | const Value & | value | ) | const [virtual] |
This Integer is compared to another Value.
An attempt is made to compare the Values numerically by casting both to Real_type values. If that fails, because the other Value can not be cast to a Real_type, then the comparison is made lexicographically by casting both Values to a String_type.
Note: An Array always compares greater than other types of Values.
value | The Value to be compared against. |
Implements Value.