class ref name: namevalue_pair
category-group: strings
layer: 6
header file: z_nameval.h

synopsis.
the namevalue_pair_o class is a very simple way of maintaining a name-value pair. the namevalue_set_o class maintains a collection of these objects. This class is designed to be an assistant to the namevalue_set object . Please refer to it for the full explanation of how to use these two classes and examples.

member functions (primary)

namevalue_pair_o()
SIGNATURE: namevalue_pair_o ()
SYNOPSIS: creates a a new namevalue_pair object. the name and the value are empty.
 

namevalue_pair_o(namevalue_pair_o)
SIGNATURE: namevalue_pair_o (const namevalue_pair_o &rhs)
SYNOPSIS:
creates a a new namevalue_pair object, based on the object represented by "rhs". The contents of "rhs" will be copied to the current object.
 

operator = (namevalue_pair_o)
SIGNATURE: const namevalue_pair_o &operator = (const namevalue_pair_o &rhs)
SYNOPSIS: the current object's contents is replaced with that of "rhs".
 

destructor
SIGNATURE: ~namevalue_pair_o ()
SYNOPSIS: virtual destructor: this destroys the class object instance.
 

name()
SIGNATURE: const string_o &name () const
SYNOPSIS: returns a string containing the name of the item stored.
 

value()
SIGNATURE: const string_o &value () const
SYNOPSIS: return a string containing the object's "value"
 

operator ==()
SIGNATURE: int operator == (const namevalue_pair_o &rhs) const
SYNOPSIS: return 0 or 1, depending if the name of the current object matches the name of "rhs".
RETURNS:
1: equal (identical) names
0: names are different
 

operator !=()
SIGNATURE: int operator != (const namevalue_pair_o &rhs) const
SYNOPSIS: return 0 or 1, depending if the name of the current object matches the name of "rhs".
RETURNS:
1: names are different
0: equal (identical) names
 

operator <()
SIGNATURE: int operator < (const namevalue_pair_o &rhs) const
SYNOPSIS: return 0 or 1, depending if the name of the current object is "less than" that of object 'rhs'.
RETURNS:
1: objects's name is "less than" that of rhs
0: otherwise
 

reset()
SIGNATURE: int reset
SYNOPSIS: resets the object
DESCRIPTION: the name and value are set to empty
RETURNS: 0 (always)
 

set_name()
SIGNATURE: void set_name (const string_o &new_nam)
SYNOPSIS: sets the name string.
 

set_value()
SIGNATURE: void set_value (const string_o &new_val)
SYNOPSIS: sets the value string.
 

print()
SIGNATURE: string_o print() const
SYNOPSIS: prints the value out
DESCRIPTION:
this returns a string object with the item printed (assuming it has been set to a valid name-value pair). The format of the string is "[name]=[value];" (the square brackets here are not printed, they are used to show the fields). The equals ('=') is always used. If [value] is not a simple "word" type (eg letters and/or numbers and/or '_'), it is enclosed in double-quotes. A terminator, or object separator, is always appended at the end. In this case, it is a semi-coloon (";"). The separator can be any string. Its value is namevalue_set_o::separator(). This value can be changed from the default of a single semi-colon character.