![]() |
PVL: Parameter Value Language
|
A String implements a Value with a character string datum. More...
#include <Value.hh>
Public Member Functions | |
String * | clone () const |
Constructs a clone of this String. | |
int | compare (const Value &value) const |
This String is compared to another Value. | |
bool | is_Date_Time () const |
Tests if the String is an DATE_TIME Type. | |
bool | is_Identifier () const |
Tests if the String is an IDENTIFIER Type. | |
bool | is_String () const |
Asserts that the String is a STRING Type. | |
bool | is_Symbol () const |
Tests if the String is an SYMBOL Type. | |
bool | is_Text () const |
Tests if the String is an TEXT Type. | |
operator int () const | |
Casts the String to an int. | |
operator Integer_type () const | |
Casts the String to an Integer_type. | |
operator Real_type () const | |
Casts the String to a Real_type. | |
operator String_type () const | |
Casts the String to a String_type. | |
String | operator+ (const Value &value) const |
Adds this String and another Value. | |
String & | operator+= (const Value &value) |
Adds another Value to this Value. | |
String & | operator= (const String_type &value) |
Assigns a String_type value to this String. | |
String & | operator= (const Integer_type value) |
Assigns an Integer_type value to this String. | |
String & | operator= (const Value &value) |
Assigns a Value to this String. | |
String & | operator= (const int value) |
Assigns an int value to this String. | |
String & | operator= (const unsigned int value) |
Assigns an unsigned int value to this String. | |
String & | operator= (const Real_type value) |
Assigns a Real_type value to this String. | |
String & | operator= (const char *value) |
Assigns a character string to this String. | |
String (const String_type &datum, const Type type) | |
Constructs a String from a String_type datum. | |
String (const Real_type datum, const int digits=0) | |
Constructs a String from a Real_type value. | |
String (const unsigned int datum, const bool is_signed=UNSIGNED, const int base=10, const int digits=0) | |
Constructs a String from an unsigned int value. | |
String (const Value &value) | |
Constructs a String from another Value. | |
String (const Integer_type datum, const bool is_signed=SIGNED, const int base=10, const int digits=0) | |
Constructs a String from an Integer_type value. | |
String (const String &value) | |
Constructs a String as a copy of another String. | |
String (const int datum, const bool is_signed=SIGNED, const int base=10, const int digits=0) | |
Constructs a String from an int value. | |
String (const String_type &datum="") | |
Constructs a String from a String_type datum. | |
Type | type () const |
Gets the specific String Type. | |
String & | type (const Type type_code) |
Sets the specific String Type. | |
std::string | type_name () const |
Gets the name string for the String Type. | |
Static Public Member Functions | |
static Type | type (String_type &characters) |
Determines the String Type of a string. |
String | ( | const String_type & | datum = "" | ) |
Constructs a String from a String_type datum.
The Type of the String is intuited by examining the String_type datum.
The numeric base for a String that represents an integer value will be intuited be examining the String_type datum.
datum | The String_type datum to be assigned the initial value of the String. |
String | ( | const String_type & | datum, |
const Type | type | ||
) |
Constructs a String from a String_type datum.
The numeric base for a String that represents an integer value will be intuited be examining the String_type datum.
datum | The String_type datum to be assigned the initial value of the String. |
type | The specific Type of the String. |
String | ( | const Integer_type | datum, |
const bool | is_signed = SIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs a String from an Integer_type value.
The intial value of the String will be the string representation of the integer value.
datum | The Integer_type value to be used in creating the string representation to be assigned to the String. |
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 the string representation of the datum. If this is 0 decimal (10) will be used. |
digits | The minimum number of digits to be used for the string representation; 0 padding is used. |
String | ( | const int | datum, |
const bool | is_signed = SIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs a String from an int value.
The intial value of the String will be the string representation of the integer value.
datum | The int value to be used in creating the string representation to be assigned to the String. |
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 the string representation of the datum. If this is 0 decimal (10) will be used. |
digits | The minimum number of digits to be used for the string representation; 0 padding is used. |
String | ( | const unsigned int | datum, |
const bool | is_signed = UNSIGNED , |
||
const int | base = 10 , |
||
const int | digits = 0 |
||
) |
Constructs a String from an unsigned int value.
The intial value of the String will be the string representation of the integer value.
datum | The unsigned int value to be used in creating the string representation to be assigned to the String. |
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 the string representation of the datum. If this is 0 decimal (10) will be used. |
digits | The minimum number of digits to be used for the string representation; 0 padding is used. |
Constructs a String from a Real_type value.
The intial value of the String will be the string representation of the floating point value.
datum | The Real_type value to be used in creating the string representation to be assigned to the String. |
digits | The number of precision digits to be used for the string representation. The default_format_flags will also be applied. |
Constructs a String from another Value.
All characteristics of the Value, except its parent, are copied. If the Value is not a String its Type is set to IDENTIFIER.
The initial value of the String is the Value cast to a String_type.
Invalid_Argument | If the Value can not be cast to a String_type. |
String* clone | ( | ) | const [inline, virtual] |
operator int | ( | ) | const [inline, virtual] |
Casts the String to an int.
Implements Value.
References Value::operator Integer_type().
operator Integer_type | ( | ) | const [virtual] |
Casts the String to an Integer_type.
The numeric base will be used when converting the String representation. A base of 0 impliles that it should be intuited from the representation.
A floating point number representation has its decimal portion truncated.
Implements Value.
operator Real_type | ( | ) | const [virtual] |
Casts the String to a Real_type.
Implements Value.
operator String_type | ( | ) | const [inline, virtual] |
bool is_String | ( | ) | const [inline, virtual] |
bool is_Identifier | ( | ) | const [inline, virtual] |
Tests if the String is an IDENTIFIER Type.
Reimplemented from Value.
References Value::IDENTIFIER.
bool is_Symbol | ( | ) | const [inline, virtual] |
Tests if the String is an SYMBOL Type.
Reimplemented from Value.
References Value::SYMBOL.
bool is_Text | ( | ) | const [inline, virtual] |
Tests if the String is an TEXT Type.
Reimplemented from Value.
References Value::TEXT.
bool is_Date_Time | ( | ) | const [inline, virtual] |
Tests if the String is an DATE_TIME Type.
N.B.: Having a DATE_TIME Type does not guarantee that the String contents complies with any particular format requirements. This is considered to be an application issue.
Reimplemented from Value.
References Value::DATE_TIME.
Type type | ( | ) | const [inline, virtual] |
Sets the specific String Type.
Note: A String may be set to the DATE_TIME Type without any format requirements on the String contents. This is considered to be an application issue.
type_code | A STRING Type code, which must be one of IDENTIFIER, TEXT, SYMBOL or DATE_TIME. |
Invalid_Argument | if the type_code is not one of the STRING Type values. |
std::string type_name | ( | ) | const [inline, virtual] |
static Type type | ( | String_type & | characters | ) | [static] |
Determines the String Type of a string.
The string is checked for special characters associated with a specific String Value Type, and any enclosing quotes are removed. N.B.: Using this function will modify its argument if it is found to have enclosing quotes.
If the string begins with the Parser::TEXT_DELIMITER character then the Value Type is TEXT. If the string begins with the Parser::SYMBOL_DELIMITER character then the Value Type is SYMBOL. In either of these cases the leading and trailing (if present) delimiter characters are removed from the string. By default the Value Type is IDENTIFIER.
characters | The String_type characters to be examined. N.B.: May be modified. |
Assigns a Value to this String.
The datum for this String is the Value cast to a String_type.
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 a String_Type. |
Implements Value.
String& operator= | ( | const int | value | ) | [inline, virtual] |
Assigns an int value to this String.
The datum for this String is assigned the string representation of the signed integer value. The representation will be in the base of the String and will be padded with 0's, if needed, to produce a representation at least digits in length.
value | The int value to be assigned. |
Implements Value.
References Value::operator=().
String& operator= | ( | const unsigned int | value | ) | [virtual] |
Assigns an unsigned int value to this String.
The datum for this String is assigned the string representation of the unsigned integer value. The representation will be in the base of the String and will be padded with 0's, if needed, to produce a representation at least digits in length.
value | The unsigned int value to be assigned. |
Implements Value.
String& operator= | ( | const Integer_type | value | ) | [virtual] |
Assigns an Integer_type value to this String.
The datum for this String is assigned the string representation of the signed integer value. The representation will be in the base of the String and will be padded with 0's, if needed, to produce a representation at least digits in length.
value | The Integer_type value to be assigned. |
Implements Value.
Assigns a Real_type value to this String.
The datum for this String is assigned the string representation of the Real_type value. The digits of the String determines its precision. The default_format_flags are also applied.
value | The Real_type value to be assigned. |
Implements Value.
String& operator= | ( | const String_type & | value | ) | [virtual] |
Assigns a String_type value to this String.
The datum for this String is assigned the String_type value.
If this String is an IDENTIFIER Type the new datum is examined for special characters and its Type changed if they are present. Note: To assign a quoted string to a String and retain the enclosing quote characters, first set the Type of the String to TEXT (to encapsulate a single quoted string) or SYMBOL (to encapsulate a double quoted string) before assigning the quoted string.
value | The String_type value to be assigned. |
Implements Value.
String& operator= | ( | const char * | value | ) | [virtual] |
Assigns a character string to this String.
The datum for this String is assigned the String_type value.
If this String is an IDENTIFIER Type the new datum is examined for special characters and its Type changed if they are present. Note: To assign a quoted string to a String and retain the enclosing quote characters, first set the Type of the String to TEXT (to encapsulate a single quoted string) or SYMBOL (to encapsulate a double quoted string) before assigning the quoted string.
value | A pointer to a character string (C-string). |
Implements Value.
Adds this String and another Value.
This String is copied, onto the stack, and the Value is appended 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 String is compared to another Value.
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.