class KeyValueParser

KeyValueParser is a class for parsing "key=value"-style lines, like those which would come from a configuration file. More...

Definition#include <fun/KeyValueParser.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

KeyValueParser is a class for parsing "key=value"-style lines, like those which would come from a configuration file.

 KeyValueParser ( const string &line = "" )

KeyValueParser

 ~KeyValueParser ()

~KeyValueParser

[virtual]

friend std::ostream &  operator << (std::ostream &os, const KeyValueParser &)

operator <<

bool  parse ( const string &line, const string & alternateDelimiter = "" )

parse

Parses 'line' into a key/value pair. To be parseable the line must be in the form: key=value Extra whitespace around the '=' are considered to be part of the key and/or value, but this is a bug/missing feature. If alternateDelimiter is a non-empty string then a line in the format: key{alternateDelimiter}value... (minus the braces) is also accepted as parseable. A key=value form always has precedence, however, so keys with spaces in them will work: some key=some value Note: the alternateDelimiter feature is Largely Untested. This function returns false if it does not consider the line to be parseable. Use getKey() and getValue() to get the parsed values. Use getLine() to get the whole string passed to parse (as if you'd ever need it, though subclasses might). Note that getLine() is set regardless of whether this function returns true or false, but the key and value are only set if this function returns true. This function will return false if a line contains no key (like '=value').

const string & getKey ()

getKey

[const]

const string & getValue ()

getValue

[const]

const string & getLine ()

getLine

[const]


Generated by: stephan on cheyenne on Mon Aug 11 14:06:52 2003, using kdoc 2.0a54.