Rudiments
Public Member Functions | List of all members
parameterstring Class Reference

#include <parameterstring.h>

Inherits object.

Public Member Functions

 parameterstring ()
 
 ~parameterstring ()
 
void setDelimiter (char delim)
 
bool parse (const char *string)
 
const chargetValue (const char *name)
 
bool clear ()
 
dictionary< char *, char * > * getDictionary ()
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

The parameterstring class provides methods for parsing and accessing name/value pairs in so-called "parameter strings" formatted like this:

char *string="name1=value1;name2='value2';name3=value3";

Parameter strings are often used to define connections to servers, databases or for other similar things.

Constructor & Destructor Documentation

◆ parameterstring()

parameterstring::parameterstring ( )

Creates an instance of the parameterstring class.

◆ ~parameterstring()

parameterstring::~parameterstring ( )

Deletes this instance of the parameterstring class.

Member Function Documentation

◆ clear()

bool parameterstring::clear ( )

Clears the stored set of names and values. After a call to clear(), getValue() will return NULL until parse() is called again.

Always returns true.

◆ getDictionary()

dictionary< char *, char * > * parameterstring::getDictionary ( )

Returns the dictionary used internally by this instance of the parameterstring class.

◆ getValue()

const char * parameterstring::getValue ( const char * name)

Returns the corresponding value for "name". parse() must have been called already or this method will return NULL.

◆ parse()

bool parameterstring::parse ( const char * string)

Parses "string" and extracts the names and values.

◆ setDelimiter()

void parameterstring::setDelimiter ( char delim)

Defines the delimiter separating the parameters. The default is a semicolon.