KMacroExpander Namespace Reference
Detailed Description
A group of functions providing macro expansion (substitution) in strings, optionally with quoting appropriate for shell execution.
- Since:
- 3.1.3
Enumerations | |
| enum | Quoting { noquote, singlequote, doublequote, dollarquote, paren, subst, group, math } |
Functions | |
| QString | expandMacros (const QString &ostr, const QMap< QChar, QString > &map, QChar c) |
| QString | expandMacrosShellQuote (const QString &ostr, const QMap< QChar, QString > &map, QChar c) |
Enumeration Type Documentation
|
|
Definition at line 85 of file kmacroexpander.cpp. |
Function Documentation
|
||||||||||||||||
|
Perform safe macro expansion (substitution) on a string. The escape char must be quoted with itself to obtain its literal representation in the resulting string.
// Code example QMap<QChar,QString> map; map.insert('u', "/tmp/myfile.txt"); map.insert('n', "My File"); QString s = "%% Title: %u:%n"; s = KMacroExpander::expandMacros(s, map); // s is now "% Title: /tmp/myfile.txt:My File"; Definition at line 520 of file kmacroexpander.cpp. |
|
||||||||||||||||
|
Perform safe macro expansion (substitution) on a string for use in shell commands. The escape char must be quoted with itself to obtain its literal representation in the resulting string.
// Code example QMap<QChar,QString> map; map.insert('u', "/tmp/myfile.txt"); map.insert('n', "My File"); QString s = "kedit --caption %n %u"; s = KMacroExpander::expandMacrosShellQuote(s, map); // s is now "kedit --caption 'My File' '/tmp/myfile.txt'"; system(QFile::encodeName(s)); Definition at line 521 of file kmacroexpander.cpp. |

