.TH "KMacroExpanderBase" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMacroExpanderBase \- Abstract base class for the worker classes behind the \fBKMacroExpander\fP namespace and the \fBKCharMacroExpander\fP and \fBKWordMacroExpander\fP classes.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kmacroexpander.h>\fP
.PP
Inherited by \fBKCharMacroExpander\fP, KMacroMapExpander< KT, VT >, KMacroMapExpander< QChar, VT >, KMacroMapExpander< QString, VT >, and \fBKWordMacroExpander\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMacroExpanderBase\fP (\fBQChar\fP c= '%')"
.br
.ti -1c
.RI "virtual \fB~KMacroExpanderBase\fP ()"
.br
.ti -1c
.RI "void \fBexpandMacros\fP (\fBQString\fP &str)"
.br
.ti -1c
.RI "bool \fBexpandMacrosShellQuote\fP (\fBQString\fP &str, uint &pos)"
.br
.ti -1c
.RI "bool \fBexpandMacrosShellQuote\fP (\fBQString\fP &str)"
.br
.ti -1c
.RI "void \fBsetEscapeChar\fP (\fBQChar\fP c)"
.br
.ti -1c
.RI "\fBQChar\fP \fBescapeChar\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual int \fBexpandPlainMacro\fP (const \fBQString\fP &str, uint pos, \fBQStringList\fP &ret)"
.br
.ti -1c
.RI "virtual int \fBexpandEscapedMacro\fP (const \fBQString\fP &str, uint pos, \fBQStringList\fP &ret)"
.br
.in -1c
.SH "Detailed Description"
.PP 
Abstract base class for the worker classes behind the \fBKMacroExpander\fP namespace and the \fBKCharMacroExpander\fP and \fBKWordMacroExpander\fP classes. 

\fBSince:\fP
.RS 4
3.1.3 
.RE
.PP
\fBAuthor:\fP
.RS 4
Oswald Buddenhagen <ossi@kde.org> 
.RE
.PP

.PP
Definition at line 37 of file kmacroexpander.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KMacroExpanderBase::KMacroExpanderBase (\fBQChar\fP c = \fC'%'\fP)"
.PP
Constructor. 
.PP
\fBParameters:\fP
.RS 4
\fIc\fP escape char indicating start of macros, or QChar::null for none 
.RE
.PP

.PP
Definition at line 28 of file kmacroexpander.cpp.
.SS "KMacroExpanderBase::~\fBKMacroExpanderBase\fP ()\fC [virtual]\fP"
.PP
Destructor. 
.PP
Definition at line 33 of file kmacroexpander.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KMacroExpanderBase::expandMacros (\fBQString\fP & str)"
.PP
Perform safe macro expansion (substitution) on a string. 
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP the string in which macros are expanded in-place 
.RE
.PP

.PP
Definition at line 49 of file kmacroexpander.cpp.
.PP
References expandEscapedMacro(), expandPlainMacro(), QStringList::join(), and QString::length().
.SS "bool KMacroExpanderBase::expandMacrosShellQuote (\fBQString\fP & str)"
.PP
Same as above, but always starts at position 0, and unmatched closing parens and braces are treated as errors. 
.PP
Definition at line 280 of file kmacroexpander.cpp.
.SS "void KMacroExpanderBase::setEscapeChar (\fBQChar\fP c)"
.PP
Set the macro escape character. 
.PP
\fBParameters:\fP
.RS 4
\fIc\fP escape char indicating start of macros, or QChar::null if none 
.RE
.PP

.PP
Definition at line 38 of file kmacroexpander.cpp.
.SS "\fBQChar\fP KMacroExpanderBase::escapeChar () const"
.PP
Obtain the macro escape character. 
.PP
\fBReturns:\fP
.RS 4
escape char indicating start of macros, or QChar::null if none 
.RE
.PP

.PP
Definition at line 44 of file kmacroexpander.cpp.
.PP
Referenced by KWordMacroExpander::expandEscapedMacro(), and KCharMacroExpander::expandEscapedMacro().
.SS "int KMacroExpanderBase::expandPlainMacro (const \fBQString\fP & str, uint pos, \fBQStringList\fP & ret)\fC [protected, virtual]\fP"
.PP
This function is called for every single char within the string if the escape char is QChar::null. 
.PP
It should determine whether the string starting at \fCpos\fP within \fCstr\fP is a valid macro and return the substitution value for it if so. 
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP the input string 
.br
\fIpos\fP the offset within \fCstr\fP 
.br
\fIret\fP return value: the string to substitute for the macro 
.RE
.PP
\fBReturns:\fP
.RS 4
if greater than zero, the number of chars at \fCpos\fP in \fCstr\fP to substitute with \fCret\fP (i.e., a valid macro was found). if less than zero, subtract this value from \fCpos\fP (to skip a macro, i.e., substitute it with itself). zero requests no special action. 
.RE
.PP

.PP
Reimplemented in \fBKWordMacroExpander\fP, and \fBKCharMacroExpander\fP.
.PP
Definition at line 286 of file kmacroexpander.cpp.
.PP
Referenced by expandMacros().
.SS "int KMacroExpanderBase::expandEscapedMacro (const \fBQString\fP & str, uint pos, \fBQStringList\fP & ret)\fC [protected, virtual]\fP"
.PP
This function is called every time the escape char is found if it is not QChar::null. 
.PP
It should determine whether the string starting at \fCpos\fP witin \fCstr\fP is a valid macro and return the substitution value for it if so. 
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP the input string 
.br
\fIpos\fP the offset within \fCstr\fP. Note that this is the position of the occurrence of the escape char 
.br
\fIret\fP return value: the string to substitute for the macro 
.RE
.PP
\fBReturns:\fP
.RS 4
if greater than zero, the number of chars at \fCpos\fP in \fCstr\fP to substitute with \fCret\fP (i.e., a valid macro was found). if less than zero, subtract this value from \fCpos\fP (to skip a macro, i.e., substitute it with itself). zero requests no special action. 
.RE
.PP

.PP
Reimplemented in \fBKWordMacroExpander\fP, and \fBKCharMacroExpander\fP.
.PP
Definition at line 289 of file kmacroexpander.cpp.
.PP
Referenced by expandMacros().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
