|
CNVList
Name/value string pair list management class | [Previous] [Main] [Next] |
| CNVList is a general-purpose, standalone class that provides management, storage, retrieval, and enumeration of name/value string pairs. Many aspects of HTML involve name/value pairs (e.g., forms, configuration files). This class is provided as a convenience to the developer.
| |
|
| |
| #include <dcmicro/htmlpp/nvlist.h>
| |
|
| |
|
| |
| None.
| |
|
| |
| None.
| |
|
| |
| CNVList()
| |
| Constructs an empty object.
| |
|
| |
| CNVList( const CNVList& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~CNVList()
| |
| Destroys the object.
| |
|
| |
| = | CNVList& operator= ( const CNVList& rhs )
| |
| Replaces list contents with a copy of rhs and returns a reference to the list.
| |
|
| |
| ( ) | String& operator ( ) ( const String& name )
| |
| Accepts a name string and returns a reference to the appropriate value string object, creating one if it doesn't exist. This makes it very convenient to create name/value pairs on-the-fly for use in the left side of an assignment.
| |
|
| |
| Value | CNVList& Value( const String& name, const String& value )
| |
| Adds or replaces name in the list, associating string value with it.
| |
|
| |
| Value | CNVList& Value( const String& name, int value )
| |
| Adds or replaces name in the list, converting value to a string and associating it with name.
| |
|
| |
| Value | String Value( const String& name ) const
| |
| Retrieve a copy of the value associated with name from the list as a string (empty string if not found).
| |
|
| |
| ValueAsInt | int ValueAsInt( const String& name ) const
| |
| Retrieve the value associated with name from the list as an integer (zero if not found).
| |
|
| |
| Exists | Boolean Exists( const String& name ) const
| |
| Returns TRUE if a value exists for name in the list, FALSE if no value exists.
| |
|
| |
| Enumerate | Boolean Enumerate( String& name, String& value, Boolean first = FALSE )
| |
| Consecutively traverses all name/value pairs stored in the list. Returns TRUE as long as there are values to enumerate, returning the strings in name and value. If first is TRUE, traversal will begin at the start of the list. Otherwise, traversal resumes from the list position at the last call.
| |
|
| |
| EnumerateName String EnumerateName( const String& starting_name
| |
| ) const
| |
| Similar to Enumerate, consecutively traversing the list of name/value pairs. It differs in that the return parameter is a string containing the next name in the list, and the starting_name argument represents the point in the list at which searching begins. If starting_name is an empty string (e.g., "") searching will start at the first item in the list. EnumerateName will continue returning string names as long as there are name/value pairs to enumerate.
| |
|
| |
| The value associated with the returned name can be obtained using the Value() method or the () operator. An empty string is returned when the end of the list is reached.
| |
|
| |
| Count | int Count() const
| |
| Returns the number of name/value pairs stored in the list.
| |
|
| |
| Reset | void Reset()
| |
| Empties the list of all name/value pairs.
| |
|
| |
|
| |
| See the example in Tutorial : Using html++ : CNVList
| |
|
| |
