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

kdecore

KCharMacroExpander Class Reference

#include <kmacroexpander.h>

Inheritance diagram for KCharMacroExpander:

KMacroExpanderBase

List of all members.


Detailed Description

Abstract base class for single char macro substitutors.

Use this instead of the functions in the KMacroExpander namespace if speculatively pre-filling the substitution map would be too expensive.

See KWordMacroExpander for a sample application.

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

Definition at line 224 of file kmacroexpander.h.


Public Member Functions

 KCharMacroExpander (QChar c= '%')

Protected Member Functions

virtual int expandPlainMacro (const QString &str, uint pos, QStringList &ret)
virtual int expandEscapedMacro (const QString &str, uint pos, QStringList &ret)
virtual bool expandMacro (QChar chr, QStringList &ret)=0

Constructor & Destructor Documentation

KCharMacroExpander::KCharMacroExpander ( QChar  c = '%'  )  [inline]

Constructor.

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

Definition at line 231 of file kmacroexpander.h.


Member Function Documentation

int KCharMacroExpander::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 from KMacroExpanderBase.

Definition at line 435 of file kmacroexpander.cpp.

int KCharMacroExpander::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 from KMacroExpanderBase.

Definition at line 443 of file kmacroexpander.cpp.

virtual bool KCharMacroExpander::expandMacro ( QChar  chr,
QStringList &  ret 
) [protected, pure virtual]

Return substitution list ret for single-character macro chr.

Parameters:
chr the macro to expand
ret return variable reference. It is guaranteed to be empty when expandMacro is entered.
Returns:
true iff chr was a recognized macro name


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

@topname@

Skip menu "@topname@"
  •     kdnssd-avahi
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for @topname@ by doxygen 1.5.5
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