Functions | |
| QString | expandMacros (const QString &str, const QMap< QChar, QString > &map, QChar c= '%') |
| QString | expandMacrosShellQuote (const QString &str, const QMap< QChar, QString > &map, QChar c= '%') |
| QString | expandMacros (const QString &str, const QMap< QString, QString > &map, QChar c= '%') |
| QString | expandMacrosShellQuote (const QString &str, const QMap< QString, QString > &map, QChar c= '%') |
| QString | expandMacros (const QString &str, const QMap< QChar, QStringList > &map, QChar c= '%') |
|
||||||||||||||||
|
Same as above, except that the macros expand to string lists that are simply join(" ")ed together. |
|
||||||||||||||||
|
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. Macro names can consist of chars in the range [A-Za-z0-9_]; use braces to delimit macros from following words starting with these chars, or to use other chars for macro names.
// Code example QMap<QString,QString> map; map.insert("url", "/tmp/myfile.txt"); map.insert("name", "My File"); QString s = "Title: %{url}-%name"; s = KMacroExpander::expandMacros(s, map); // s is now "Title: /tmp/myfile.txt-My File"; |
|
||||||||||||||||
|
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"; |
|
||||||||||||||||
|
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. Macro names can consist of chars in the range [A-Za-z0-9_]; use braces to delimit macros from following words starting with these chars, or to use other chars for macro names.
// Code example QMap<QString,QString> map; map.insert("url", "/tmp/myfile.txt"); map.insert("name", "My File"); QString s = "kedit --caption %name %{url}"; s = KMacroExpander::expandMacrosShellQuote(s, map); // s is now "kedit --caption 'My File' '/tmp/myfile.txt'"; system(QFile::encodeName(s)); |
|
||||||||||||||||
|
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)); |
1.2.18