.TH "KMacroExpander" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMacroExpander \- A group of functions providing macro expansion (substitution) in strings, optionally with quoting appropriate for shell execution.  

.PP
.SH SYNOPSIS
.br
.PP
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBQuoting\fP { \fBnoquote\fP, \fBsinglequote\fP, \fBdoublequote\fP, \fBdollarquote\fP, \fBparen\fP, \fBsubst\fP, \fBgroup\fP, \fBmath\fP }"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "\fBQString\fP \fBexpandMacros\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQChar\fP, \fBQString\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacrosShellQuote\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQChar\fP, \fBQString\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacros\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQString\fP, \fBQString\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacrosShellQuote\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQString\fP, \fBQString\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacros\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQChar\fP, \fBQStringList\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacrosShellQuote\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQChar\fP, \fBQStringList\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacros\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQString\fP, \fBQStringList\fP > &map, \fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQString\fP \fBexpandMacrosShellQuote\fP (const \fBQString\fP &ostr, const \fBQMap\fP< \fBQString\fP, \fBQStringList\fP > &map, \fBQChar\fP c)"
.br
.in -1c
.SH "Detailed Description"
.PP 
A group of functions providing macro expansion (substitution) in strings, optionally with quoting appropriate for shell execution. 

\fBSince:\fP
.RS 4
3.1.3 
.RE
.PP

.PP
.SH "Function Documentation"
.PP 
.SS "KDECORE_EXPORT \fBQString\fP KMacroExpander::expandMacros (const \fBQString\fP & str, const \fBQMap\fP< \fBQChar\fP, \fBQString\fP > & map, \fBQChar\fP c = \fC'%'\fP)"
.PP
Perform safe macro expansion (substitution) on a string. 
.PP
The escape char must be quoted with itself to obtain its literal representation in the resulting string.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP The string to expand 
.br
\fImap\fP map with substitutions 
.br
\fIc\fP escape char indicating start of macro, or QChar::null if none 
.RE
.PP
\fBReturns:\fP
.RS 4
the string with all valid macros expanded
.RE
.PP
.PP
.nf
 // 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';
.fi
.PP
 
.PP
Definition at line 519 of file kmacroexpander.cpp.
.PP
Referenced by KApplication::invokeMailer().
.SS "KDECORE_EXPORT \fBQString\fP KMacroExpander::expandMacrosShellQuote (const \fBQString\fP & str, const \fBQMap\fP< \fBQChar\fP, \fBQString\fP > & map, \fBQChar\fP c = \fC'%'\fP)"
.PP
Perform safe macro expansion (substitution) on a string for use in shell commands. 
.PP
The escape char must be quoted with itself to obtain its literal representation in the resulting string.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP The string to expand 
.br
\fImap\fP map with substitutions 
.br
\fIc\fP escape char indicating start of macro, or QChar::null if none 
.RE
.PP
\fBReturns:\fP
.RS 4
the string with all valid macros expanded, or a null string if a shell syntax error was detected in the command
.RE
.PP
.PP
.nf
 // 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));
.fi
.PP
 
.PP
Definition at line 520 of file kmacroexpander.cpp.
.SS "KDECORE_EXPORT \fBQString\fP KMacroExpander::expandMacros (const \fBQString\fP & str, const \fBQMap\fP< \fBQString\fP, \fBQString\fP > & map, \fBQChar\fP c = \fC'%'\fP)"
.PP
Perform safe macro expansion (substitution) on a string. 
.PP
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.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP The string to expand 
.br
\fImap\fP map with substitutions 
.br
\fIc\fP escape char indicating start of macro, or QChar::null if none 
.RE
.PP
\fBReturns:\fP
.RS 4
the string with all valid macros expanded
.RE
.PP
.PP
.nf
 // 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';
.fi
.PP
 
.PP
Definition at line 521 of file kmacroexpander.cpp.
.SS "KDECORE_EXPORT \fBQString\fP KMacroExpander::expandMacrosShellQuote (const \fBQString\fP & str, const \fBQMap\fP< \fBQString\fP, \fBQString\fP > & map, \fBQChar\fP c = \fC'%'\fP)"
.PP
Perform safe macro expansion (substitution) on a string for use in shell commands. 
.PP
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.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP The string to expand 
.br
\fImap\fP map with substitutions 
.br
\fIc\fP escape char indicating start of macro, or QChar::null if none 
.RE
.PP
\fBReturns:\fP
.RS 4
the string with all valid macros expanded, or a null string if a shell syntax error was detected in the command
.RE
.PP
.PP
.nf
 // 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));
.fi
.PP
 
.PP
Definition at line 522 of file kmacroexpander.cpp.
.SS "KDECORE_EXPORT \fBQString\fP KMacroExpander::expandMacros (const \fBQString\fP & str, const \fBQMap\fP< \fBQChar\fP, \fBQStringList\fP > & map, \fBQChar\fP c = \fC'%'\fP)"
.PP
Same as above, except that the macros expand to string lists that are simply join(' ')ed together. 
.PP
Definition at line 523 of file kmacroexpander.cpp.
.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
