idaeim studio
 PVL: Parameter Value Language

Public Member Functions | Static Public Member Functions
String Class Reference

A String implements a Value with a character string datum. More...

#include <Value.hh>

Inheritance diagram for String:
Inheritance graph
[legend]
Collaboration diagram for String:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Stringclone () 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.
Stringoperator+= (const Value &value)
 Adds another Value to this Value.
Stringoperator= (const String_type &value)
 Assigns a String_type value to this String.
Stringoperator= (const Integer_type value)
 Assigns an Integer_type value to this String.
Stringoperator= (const Value &value)
 Assigns a Value to this String.
Stringoperator= (const int value)
 Assigns an int value to this String.
Stringoperator= (const unsigned int value)
 Assigns an unsigned int value to this String.
Stringoperator= (const Real_type value)
 Assigns a Real_type value to this String.
Stringoperator= (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.
Stringtype (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.

Detailed Description

A String implements a Value with a character string datum.


Constructor & Destructor Documentation

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.

Parameters:
datumThe String_type datum to be assigned the initial value of the String.
See also:
type(String_type&)
string_numeric_base
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.

Parameters:
datumThe String_type datum to be assigned the initial value of the String.
typeThe specific Type of the String.
See also:
type(const Type)
string_numeric_base
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.

Parameters:
datumThe Integer_type value to be used in creating the string representation to be assigned to the String.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for the string representation of the datum. If this is 0 decimal (10) will be used.
digitsThe minimum number of digits to be used for the string representation; 0 padding is used.
See also:
integer_to_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.

The intial value of the String will be the string representation of the integer value.

Parameters:
datumThe int value to be used in creating the string representation to be assigned to the String.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for the string representation of the datum. If this is 0 decimal (10) will be used.
digitsThe minimum number of digits to be used for the string representation; 0 padding is used.
See also:
integer_to_string
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.

Parameters:
datumThe unsigned int value to be used in creating the string representation to be assigned to the String.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for the string representation of the datum. If this is 0 decimal (10) will be used.
digitsThe minimum number of digits to be used for the string representation; 0 padding is used.
See also:
integer_to_string
String ( const Real_type  datum,
const int  digits = 0 
)

Constructs a String from a Real_type value.

The intial value of the String will be the string representation of the floating point value.

Parameters:
datumThe Real_type value to be used in creating the string representation to be assigned to the String.
digitsThe number of precision digits to be used for the string representation. The default_format_flags will also be applied.
See also:
real_to_string
String ( const String value)

Constructs a String as a copy of another String.

The parent is not copied; the new String has no parent.

Parameters:
valueThe String to copy.
String ( const Value value)

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.

Parameters:
valueThe Value to be used to derive this String.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to a String_type.

Member Function Documentation

String* clone ( ) const [inline, virtual]

Constructs a clone of this String.

A clone is a copy constructed on the heap.

Returns:
A pointer to the new String clone.

Implements Value.

operator int ( ) const [inline, virtual]

Casts the String to an int.

Returns:
The int value of the string datum representation.
See also:
operator Integer_type() const

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.

Returns:
The Integer_type value of the string datum representation.
See also:
string_to_integer

Implements Value.

operator Real_type ( ) const [virtual]

Casts the String to a Real_type.

Returns:
The Real_type value of the string datum representation.
See also:
string_to_real

Implements Value.

operator String_type ( ) const [inline, virtual]

Casts the String to a String_type.

Returns:
The string datum.

Implements Value.

bool is_String ( ) const [inline, virtual]

Asserts that the String is a STRING Type.

Returns:
Always returns true.

Reimplemented from Value.

bool is_Identifier ( ) const [inline, virtual]

Tests if the String is an IDENTIFIER Type.

Returns:
true if the Type of this String is IDENTIFIER.

Reimplemented from Value.

References Value::IDENTIFIER.

bool is_Symbol ( ) const [inline, virtual]

Tests if the String is an SYMBOL Type.

Returns:
true if the Type of this String is SYMBOL.

Reimplemented from Value.

References Value::SYMBOL.

bool is_Text ( ) const [inline, virtual]

Tests if the String is an TEXT Type.

Returns:
true if the Type of this String is TEXT.

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.

Returns:
true if the Type of this String is DATE_TIME.

Reimplemented from Value.

References Value::DATE_TIME.

Type type ( ) const [inline, virtual]

Gets the specific String Type.

Returns:
The Type code of this String.

Implements Value.

String& type ( const Type  type_code)

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.

Parameters:
type_codeA STRING Type code, which must be one of IDENTIFIER, TEXT, SYMBOL or DATE_TIME.
Exceptions:
Invalid_Argumentif the type_code is not one of the STRING Type values.
std::string type_name ( ) const [inline, virtual]

Gets the name string for the String Type.

Returns:
The type_name of the String Type.

Implements Value.

References Value::type_name().

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.

Parameters:
charactersThe String_type characters to be examined. N.B.: May be modified.
Returns:
The STRING Type.
String& operator= ( const Value value) [virtual]

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.

Parameters:
valueThe Value to be assigned.
Returns:
This String.
Exceptions:
Invalid_ArgumentIf 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.

Parameters:
valueThe int value to be assigned.
Returns:
This String.
See also:
operator=(Integer_type)

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.

Parameters:
valueThe unsigned int value to be assigned.
Returns:
This String.
See also:
integer_to_string

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.

Parameters:
valueThe Integer_type value to be assigned.
Returns:
This String.
See also:
integer_to_string

Implements Value.

String& operator= ( const Real_type  value) [virtual]

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.

Parameters:
valueThe Real_type value to be assigned.
Returns:
This String.
See also:
real_to_string

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.

Parameters:
valueThe String_type value to be assigned.
Returns:
This String.
See also:
type(String_type&)

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.

Parameters:
valueA pointer to a character string (C-string).
Returns:
This String.
See also:
operator=(const String_type&)

Implements Value.

String& operator+= ( const Value value) [virtual]

Adds another Value to this Value.

The Value cast to a String_type is appended to the datum of this String.

Parameters:
valueThe Value to be appended to this String.
Returns:
This String.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to a String_type.

Implements Value.

String operator+ ( const Value value) const

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.

Parameters:
valueThe Value to be used in the addition operation.
Returns:
A temporary String.
See also:
operator+=(const Value&)
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.

Parameters:
valueThe Value to be compared against.
Returns:
An int that is less than, equal to, or greater than 0 if this String is logically less than, equal to, or greater than, respectively, the other Value.

Implements Value.


The documentation for this class was generated from the following file: