\section{KMacro\-Expander\-Base Class Reference}
\label{classKMacroExpanderBase}\index{KMacroExpanderBase@{KMacroExpanderBase}}
Abstract base class for the worker classes behind the {\bf KMacro\-Expander}{\rm (p.\,\pageref{namespaceKMacroExpander})} namespace and the {\bf KChar\-Macro\-Expander}{\rm (p.\,\pageref{classKCharMacroExpander})} and {\bf KWord\-Macro\-Expander}{\rm (p.\,\pageref{classKWordMacroExpander})} classes.  


{\tt \#include $<$kmacroexpander.h$>$}

Inheritance diagram for KMacro\-Expander\-Base:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=142pt]{classKMacroExpanderBase__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KMacro\-Expander\-Base:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=76pt]{classKMacroExpanderBase__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KMacro\-Expander\-Base} ({\bf QChar} c= '\%')
\item 
virtual {\bf $\sim$KMacro\-Expander\-Base} ()
\item 
void {\bf expand\-Macros} ({\bf QString} \&str)
\item 
bool {\bf expand\-Macros\-Shell\-Quote} ({\bf QString} \&str, uint \&pos)\label{classKMacroExpanderBase_a3}

\item 
bool {\bf expand\-Macros\-Shell\-Quote} ({\bf QString} \&str)
\item 
void {\bf set\-Escape\-Char} ({\bf QChar} c)
\item 
{\bf QChar} {\bf escape\-Char} () const 
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual int {\bf expand\-Plain\-Macro} (const {\bf QString} \&str, uint pos, {\bf QString\-List} \&ret)
\item 
virtual int {\bf expand\-Escaped\-Macro} (const {\bf QString} \&str, uint pos, {\bf QString\-List} \&ret)
\end{CompactItemize}


\subsection{Detailed Description}
Abstract base class for the worker classes behind the {\bf KMacro\-Expander}{\rm (p.\,\pageref{namespaceKMacroExpander})} namespace and the {\bf KChar\-Macro\-Expander}{\rm (p.\,\pageref{classKCharMacroExpander})} and {\bf KWord\-Macro\-Expander}{\rm (p.\,\pageref{classKWordMacroExpander})} classes. 

\begin{Desc}
\item[Since:]3.1.3 \end{Desc}
\begin{Desc}
\item[Author:]Oswald Buddenhagen $<${\tt ossi@kde.org}$>$ \end{Desc}




Definition at line 37 of file kmacroexpander.h.

\subsection{Constructor \& Destructor Documentation}
\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!KMacroExpanderBase@{KMacroExpanderBase}}
\index{KMacroExpanderBase@{KMacroExpanderBase}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMacro\-Expander\-Base::KMacro\-Expander\-Base ({\bf QChar} {\em c} = {\tt '\%'})}\label{classKMacroExpanderBase_a0}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em c}]escape char indicating start of macros, or QChar::null for none \end{description}
\end{Desc}


Definition at line 28 of file kmacroexpander.cpp.\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!~KMacroExpanderBase@{$\sim$KMacroExpanderBase}}
\index{~KMacroExpanderBase@{$\sim$KMacroExpanderBase}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMacro\-Expander\-Base::$\sim${\bf KMacro\-Expander\-Base} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKMacroExpanderBase_a1}


Destructor. 



Definition at line 33 of file kmacroexpander.cpp.

\subsection{Member Function Documentation}
\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!expandMacros@{expandMacros}}
\index{expandMacros@{expandMacros}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMacro\-Expander\-Base::expand\-Macros ({\bf QString} \& {\em str})}\label{classKMacroExpanderBase_a2}


Perform safe macro expansion (substitution) on a string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string in which macros are expanded in-place \end{description}
\end{Desc}


Definition at line 49 of file kmacroexpander.cpp.

References expand\-Escaped\-Macro(), expand\-Plain\-Macro(), QString\-List::join(), and QString::length().\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!expandMacrosShellQuote@{expandMacrosShellQuote}}
\index{expandMacrosShellQuote@{expandMacrosShellQuote}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMacro\-Expander\-Base::expand\-Macros\-Shell\-Quote ({\bf QString} \& {\em str})}\label{classKMacroExpanderBase_a4}


Same as above, but always starts at position 0, and unmatched closing parens and braces are treated as errors. 



Definition at line 280 of file kmacroexpander.cpp.\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!setEscapeChar@{setEscapeChar}}
\index{setEscapeChar@{setEscapeChar}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMacro\-Expander\-Base::set\-Escape\-Char ({\bf QChar} {\em c})}\label{classKMacroExpanderBase_a5}


Set the macro escape character. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em c}]escape char indicating start of macros, or QChar::null if none \end{description}
\end{Desc}


Definition at line 38 of file kmacroexpander.cpp.\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!escapeChar@{escapeChar}}
\index{escapeChar@{escapeChar}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QChar} KMacro\-Expander\-Base::escape\-Char () const}\label{classKMacroExpanderBase_a6}


Obtain the macro escape character. 

\begin{Desc}
\item[Returns:]escape char indicating start of macros, or QChar::null if none \end{Desc}


Definition at line 44 of file kmacroexpander.cpp.

Referenced by KWord\-Macro\-Expander::expand\-Escaped\-Macro(), and KChar\-Macro\-Expander::expand\-Escaped\-Macro().\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!expandPlainMacro@{expandPlainMacro}}
\index{expandPlainMacro@{expandPlainMacro}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KMacro\-Expander\-Base::expand\-Plain\-Macro (const {\bf QString} \& {\em str}, uint {\em pos}, {\bf QString\-List} \& {\em ret})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMacroExpanderBase_b0}


This function is called for every single char within the string if the escape char is QChar::null. 

It should determine whether the string starting at {\tt pos} within {\tt str} is a valid macro and return the substitution value for it if so. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the input string \item[{\em pos}]the offset within {\tt str} \item[{\em ret}]return value: the string to substitute for the macro \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]if greater than zero, the number of chars at {\tt pos} in {\tt str} to substitute with {\tt ret} (i.e., a valid macro was found). if less than zero, subtract this value from {\tt pos} (to skip a macro, i.e., substitute it with itself). zero requests no special action. \end{Desc}


Reimplemented in {\bf KWord\-Macro\-Expander} {\rm (p.\,\pageref{classKWordMacroExpander_b0})}, and {\bf KChar\-Macro\-Expander} {\rm (p.\,\pageref{classKCharMacroExpander_b0})}.

Definition at line 286 of file kmacroexpander.cpp.

Referenced by expand\-Macros().\index{KMacroExpanderBase@{KMacro\-Expander\-Base}!expandEscapedMacro@{expandEscapedMacro}}
\index{expandEscapedMacro@{expandEscapedMacro}!KMacroExpanderBase@{KMacro\-Expander\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KMacro\-Expander\-Base::expand\-Escaped\-Macro (const {\bf QString} \& {\em str}, uint {\em pos}, {\bf QString\-List} \& {\em ret})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMacroExpanderBase_b1}


This function is called every time the escape char is found if it is not QChar::null. 

It should determine whether the string starting at {\tt pos} witin {\tt str} is a valid macro and return the substitution value for it if so. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the input string \item[{\em pos}]the offset within {\tt str}. Note that this is the position of the occurrence of the escape char \item[{\em ret}]return value: the string to substitute for the macro \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]if greater than zero, the number of chars at {\tt pos} in {\tt str} to substitute with {\tt ret} (i.e., a valid macro was found). if less than zero, subtract this value from {\tt pos} (to skip a macro, i.e., substitute it with itself). zero requests no special action. \end{Desc}


Reimplemented in {\bf KWord\-Macro\-Expander} {\rm (p.\,\pageref{classKWordMacroExpander_b1})}, and {\bf KChar\-Macro\-Expander} {\rm (p.\,\pageref{classKCharMacroExpander_b1})}.

Definition at line 289 of file kmacroexpander.cpp.

Referenced by expand\-Macros().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmacroexpander.h\item 
kmacroexpander.cpp\end{CompactItemize}
