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:


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


Backslashes can be similarly escaped:


Coming soon...

int main(int argc, const char **argv) {
        // FIXME: example...