\section{KMacro\-Expander Namespace Reference}
\label{namespaceKMacroExpander}\index{KMacroExpander@{KMacroExpander}}
A group of functions providing macro expansion (substitution) in strings, optionally with quoting appropriate for shell execution.  


\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum {\bf Quoting} \{ \par
{\bf noquote}, 
{\bf singlequote}, 
{\bf doublequote}, 
{\bf dollarquote}, 
\par
{\bf paren}, 
{\bf subst}, 
{\bf group}, 
{\bf math}
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf QString} {\bf expand\-Macros} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QChar}, {\bf QString} $>$ \&map, {\bf QChar} c)
\begin{CompactList}\small\item\em Perform safe macro expansion (substitution) on a string. \item\end{CompactList}\item 
{\bf QString} {\bf expand\-Macros\-Shell\-Quote} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QChar}, {\bf QString} $>$ \&map, {\bf QChar} c)
\begin{CompactList}\small\item\em Perform safe macro expansion (substitution) on a string for use in shell commands. \item\end{CompactList}\item 
{\bf QString} {\bf expand\-Macros} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&map, {\bf QChar} c)
\begin{CompactList}\small\item\em Perform safe macro expansion (substitution) on a string. \item\end{CompactList}\item 
{\bf QString} {\bf expand\-Macros\-Shell\-Quote} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&map, {\bf QChar} c)
\begin{CompactList}\small\item\em Perform safe macro expansion (substitution) on a string for use in shell commands. \item\end{CompactList}\item 
{\bf QString} {\bf expand\-Macros} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QChar}, {\bf QString\-List} $>$ \&map, {\bf QChar} c)
\begin{CompactList}\small\item\em Same as above, except that the macros expand to string lists that are simply join(\char`\"{} \char`\"{})ed together. \item\end{CompactList}\item 
{\bf QString} {\bf expand\-Macros\-Shell\-Quote} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QChar}, {\bf QString\-List} $>$ \&map, {\bf QChar} c)\label{namespaceKMacroExpander_a13}

\item 
{\bf QString} {\bf expand\-Macros} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QString}, {\bf QString\-List} $>$ \&map, {\bf QChar} c)\label{namespaceKMacroExpander_a14}

\item 
{\bf QString} {\bf expand\-Macros\-Shell\-Quote} (const  {\bf QString} \&ostr, const  {\bf QMap}$<$ {\bf QString}, {\bf QString\-List} $>$ \&map, {\bf QChar} c)\label{namespaceKMacroExpander_a15}

\end{CompactItemize}


\subsection{Detailed Description}
A group of functions providing macro expansion (substitution) in strings, optionally with quoting appropriate for shell execution. 

\begin{Desc}
\item[Since:]3.1.3 \end{Desc}




\subsection{Function Documentation}
\index{KMacroExpander@{KMacro\-Expander}!expandMacros@{expandMacros}}
\index{expandMacros@{expandMacros}!KMacroExpander@{KMacro\-Expander}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMacro\-Expander::expand\-Macros (const {\bf QString} \& {\em str}, const {\bf QMap}$<$ {\bf QChar}, {\bf QString} $>$ \& {\em map}, {\bf QChar} {\em c} = '\%')}\label{namespaceKMacroExpander_a8}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]The string to expand \item[{\em map}]map with substitutions \item[{\em c}]escape char indicating start of macro, or QChar::null if none \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the string with all valid macros expanded\end{Desc}


\footnotesize\begin{verbatim} // 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";
\end{verbatim}\normalsize


Definition at line 448 of file kmacroexpander.cpp.\index{KMacroExpander@{KMacro\-Expander}!expandMacrosShellQuote@{expandMacrosShellQuote}}
\index{expandMacrosShellQuote@{expandMacrosShellQuote}!KMacroExpander@{KMacro\-Expander}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMacro\-Expander::expand\-Macros\-Shell\-Quote (const {\bf QString} \& {\em str}, const {\bf QMap}$<$ {\bf QChar}, {\bf QString} $>$ \& {\em map}, {\bf QChar} {\em c} = '\%')}\label{namespaceKMacroExpander_a9}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]The string to expand \item[{\em map}]map with substitutions \item[{\em c}]escape char indicating start of macro, or QChar::null if none \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the string with all valid macros expanded, or a null string if a shell syntax error was detected in the command\end{Desc}


\footnotesize\begin{verbatim} // 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));
\end{verbatim}\normalsize


Definition at line 449 of file kmacroexpander.cpp.\index{KMacroExpander@{KMacro\-Expander}!expandMacros@{expandMacros}}
\index{expandMacros@{expandMacros}!KMacroExpander@{KMacro\-Expander}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMacro\-Expander::expand\-Macros (const {\bf QString} \& {\em str}, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em map}, {\bf QChar} {\em c} = '\%')}\label{namespaceKMacroExpander_a10}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]The string to expand \item[{\em map}]map with substitutions \item[{\em c}]escape char indicating start of macro, or QChar::null if none \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the string with all valid macros expanded\end{Desc}


\footnotesize\begin{verbatim} // 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";
\end{verbatim}\normalsize


Definition at line 450 of file kmacroexpander.cpp.\index{KMacroExpander@{KMacro\-Expander}!expandMacrosShellQuote@{expandMacrosShellQuote}}
\index{expandMacrosShellQuote@{expandMacrosShellQuote}!KMacroExpander@{KMacro\-Expander}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMacro\-Expander::expand\-Macros\-Shell\-Quote (const {\bf QString} \& {\em str}, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em map}, {\bf QChar} {\em c} = '\%')}\label{namespaceKMacroExpander_a11}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]The string to expand \item[{\em map}]map with substitutions \item[{\em c}]escape char indicating start of macro, or QChar::null if none \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the string with all valid macros expanded, or a null string if a shell syntax error was detected in the command\end{Desc}


\footnotesize\begin{verbatim} // 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));
\end{verbatim}\normalsize


Definition at line 451 of file kmacroexpander.cpp.\index{KMacroExpander@{KMacro\-Expander}!expandMacros@{expandMacros}}
\index{expandMacros@{expandMacros}!KMacroExpander@{KMacro\-Expander}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMacro\-Expander::expand\-Macros (const {\bf QString} \& {\em str}, const {\bf QMap}$<$ {\bf QChar}, {\bf QString\-List} $>$ \& {\em map}, {\bf QChar} {\em c} = '\%')}\label{namespaceKMacroExpander_a12}


Same as above, except that the macros expand to string lists that are simply join(\char`\"{} \char`\"{})ed together. 



Definition at line 452 of file kmacroexpander.cpp.