a firstworks project
Rudiments
About Documentation Download Licensing News

Using the parameterstring class

Sometimes a function needs to take an arbitrary set of parameters. For example, a function for connecting to a database may need host, port, socket, username and password, any of which could be omitted depending on the database. Though C++ support methods which take an arbitrary number of parameters, sometimes it is more convenient to for the method to accept a single string parameter with name/value pairs in it instead.

The parameterstring class provides methods for parsing and accessing a parameter string of the following form:

name1='value1';name2='value2';name3='value3'

The single quotes are optional. If a parameter needs to contain a single quote, then it can be escaped as follows:

name='\'value\''

Backslashes can be similarly escaped:

name='\\value\\'

Coming soon...

int main(int argc, const char **argv) {
	// FIXME: example...
}
Copyright 2017 - David Muse - Contact