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

Public Member Functions

 parameterstring ()
 
 ~parameterstring ()
 
void setDelimiter (char delim)
 
bool parse (const char *string)
 
const char * getValue (const char *name)
 
void clear ()
 

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()

void parameterstring::clear ( )

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

◆ 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.