• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

KMacroExpanderBase Class Reference

Abstract base class for the worker classes behind the KMacroExpander namespace and the KCharMacroExpander and KWordMacroExpander classes. More...

#include <kmacroexpander.h>

Inheritance diagram for KMacroExpanderBase:

Inheritance graph
[legend]

List of all members.


Public Member Functions

QChar escapeChar () const
void expandMacros (QString &str)
bool expandMacrosShellQuote (QString &str)
bool expandMacrosShellQuote (QString &str, uint &pos)
 KMacroExpanderBase (QChar c= '%')
void setEscapeChar (QChar c)
virtual ~KMacroExpanderBase ()

Protected Member Functions

virtual int expandEscapedMacro (const QString &str, uint pos, QStringList &ret)
virtual int expandPlainMacro (const QString &str, uint pos, QStringList &ret)

Detailed Description

Abstract base class for the worker classes behind the KMacroExpander namespace and the KCharMacroExpander and KWordMacroExpander classes.

Since:
3.1.3
Author:
Oswald Buddenhagen <ossi@kde.org>

Definition at line 37 of file kmacroexpander.h.


Constructor & Destructor Documentation

KMacroExpanderBase::KMacroExpanderBase ( QChar  c = '%'  ) 

Constructor.

Parameters:
c escape char indicating start of macros, or QChar::null for none

Definition at line 28 of file kmacroexpander.cpp.

KMacroExpanderBase::~KMacroExpanderBase (  )  [virtual]

Destructor.

Definition at line 33 of file kmacroexpander.cpp.


Member Function Documentation

QChar KMacroExpanderBase::escapeChar (  )  const

Obtain the macro escape character.

Returns:
escape char indicating start of macros, or QChar::null if none

Definition at line 44 of file kmacroexpander.cpp.

int KMacroExpanderBase::expandEscapedMacro ( const QString &  str,
uint  pos,
QStringList &  ret 
) [protected, virtual]

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 pos witin str is a valid macro and return the substitution value for it if so.

Parameters:
str the input string
pos the offset within str. Note that this is the position of the occurrence of the escape char
ret return value: the string to substitute for the macro
Returns:
if greater than zero, the number of chars at pos in str to substitute with ret (i.e., a valid macro was found). if less than zero, subtract this value from pos (to skip a macro, i.e., substitute it with itself). zero requests no special action.

Reimplemented in KWordMacroExpander, and KCharMacroExpander.

Definition at line 290 of file kmacroexpander.cpp.

void KMacroExpanderBase::expandMacros ( QString &  str  ) 

Perform safe macro expansion (substitution) on a string.

Parameters:
str the string in which macros are expanded in-place

Definition at line 49 of file kmacroexpander.cpp.

bool KMacroExpanderBase::expandMacrosShellQuote ( QString &  str  ) 

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

Definition at line 281 of file kmacroexpander.cpp.

bool KMacroExpanderBase::expandMacrosShellQuote ( QString &  str,
uint &  pos 
)

Definition at line 100 of file kmacroexpander.cpp.

int KMacroExpanderBase::expandPlainMacro ( const QString &  str,
uint  pos,
QStringList &  ret 
) [protected, virtual]

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 pos within str is a valid macro and return the substitution value for it if so.

Parameters:
str the input string
pos the offset within str
ret return value: the string to substitute for the macro
Returns:
if greater than zero, the number of chars at pos in str to substitute with ret (i.e., a valid macro was found). if less than zero, subtract this value from pos (to skip a macro, i.e., substitute it with itself). zero requests no special action.

Reimplemented in KWordMacroExpander, and KCharMacroExpander.

Definition at line 287 of file kmacroexpander.cpp.

void KMacroExpanderBase::setEscapeChar ( QChar  c  ) 

Set the macro escape character.

Parameters:
c escape char indicating start of macros, or QChar::null if none

Definition at line 38 of file kmacroexpander.cpp.


The documentation for this class was generated from the following files:
  • kmacroexpander.h
  • kmacroexpander.cpp

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal