|
rambrain
|
Class to handle regex matching used for parsing configuration files. More...
#include <regexmatcher.h>
Public Types | |
| enum | matchType { integer = 1 << 0, floating = 1 << 1, units = 1 << 2, text = 1 << 3, alphanumtext = 1 << 4, boolean = 1 << 5, swapfilename = 1 << 6 } |
| An enum to caracterise what shall be matched in a specific case; flaggy. More... | |
Public Member Functions | |
| regexMatcher () | |
| Create a new regex handler, basically a dummy. More... | |
| bool | matchConfigBlock (const string &str, const string &blockname="default") const |
| Checks if a string matches the header of a configuration block. More... | |
| pair< string, string > | matchKeyEqualsValue (const string &str, int valueType=alphanumtext) const |
| Checks if a string matches something like key = value. More... | |
| pair< string, string > | matchKeyEqualsValue (const string &str, const string &key, int valueType=alphanumtext) const |
| Checks if a string matches something like key = value. More... | |
| pair< double, string > | splitDoubleValueUnit (const string &str) const |
| Split a string containing value and possibly unit into both parts. More... | |
| pair< long long int, string > | splitIntegerValueUnit (const string &str) const |
| Split a string containing value and possibly unit into both parts. More... | |
| string | substituteHomeDir (const string &source, const string &homedir) const |
| Replace all occurences of a ~ by the absolute home directory. More... | |
Private Member Functions | |
| string | createRegexMatching (int type) const |
| Create a matching regex for a certain type. More... | |
Class to handle regex matching used for parsing configuration files.
Definition at line 35 of file regexmatcher.h.
An enum to caracterise what shall be matched in a specific case; flaggy.
| Enumerator | |
|---|---|
| integer | |
| floating | |
| units | |
| text | |
| alphanumtext | |
| boolean | |
| swapfilename | |
Definition at line 44 of file regexmatcher.h.
| rambrain::regexMatcher::regexMatcher | ( | ) |
Create a new regex handler, basically a dummy.
Definition at line 40 of file regexmatcher.cpp.
|
private |
Create a matching regex for a certain type.
| type | The type |
Definition at line 69 of file regexmatcher.cpp.
| bool rambrain::regexMatcher::matchConfigBlock | ( | const string & | str, |
| const string & | blockname = "default" |
||
| ) | const |
Checks if a string matches the header of a configuration block.
| str | The source string |
| blockname | The config block name to check for |
Definition at line 44 of file regexmatcher.cpp.
| pair<string, string> rambrain::regexMatcher::matchKeyEqualsValue | ( | const string & | str, |
| int | valueType = alphanumtext |
||
| ) | const |
Checks if a string matches something like key = value.
| str | The source string |
| valueType | Which matchType the value should be, does not match otherwise |
| pair<string, string> rambrain::regexMatcher::matchKeyEqualsValue | ( | const string & | str, |
| const string & | key, | ||
| int | valueType = alphanumtext |
||
| ) | const |
Checks if a string matches something like key = value.
| str | The source string |
| key | Which key to match |
| valueType | Which matchType the value should be, does not match otherwise |
| pair< double, string > rambrain::regexMatcher::splitDoubleValueUnit | ( | const string & | str | ) | const |
Split a string containing value and possibly unit into both parts.
| str | The string containing double and unit |
Definition at line 106 of file regexmatcher.cpp.
| pair< long long, string > rambrain::regexMatcher::splitIntegerValueUnit | ( | const string & | str | ) | const |
Split a string containing value and possibly unit into both parts.
| str | The string containing integer and unit |
Definition at line 122 of file regexmatcher.cpp.
| string rambrain::regexMatcher::substituteHomeDir | ( | const string & | source, |
| const string & | homedir | ||
| ) | const |
Replace all occurences of a ~ by the absolute home directory.
| source | The input string |
| homedir | The home directory |
Definition at line 138 of file regexmatcher.cpp.