• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Member Functions | Protected Member Functions | List of all members
KCharMacroExpander Class Referenceabstract

#include <kmacroexpander.h>

Inheritance diagram for KCharMacroExpander:
KMacroExpanderBase

Public Member Functions

 KCharMacroExpander (TQChar c='%')
 
- Public Member Functions inherited from KMacroExpanderBase
 KMacroExpanderBase (TQChar c='%')
 
virtual ~KMacroExpanderBase ()
 
void expandMacros (TQString &str)
 
bool expandMacrosShellQuote (TQString &str, uint &pos)
 
bool expandMacrosShellQuote (TQString &str)
 
void setEscapeChar (TQChar c)
 
TQChar escapeChar () const
 

Protected Member Functions

virtual int expandPlainMacro (const TQString &str, uint pos, TQStringList &ret)
 
virtual int expandEscapedMacro (const TQString &str, uint pos, TQStringList &ret)
 
virtual bool expandMacro (TQChar chr, TQStringList &ret)=0
 
virtual int expandPlainMacro (const TQString &str, uint pos, TQStringList &ret)
 
virtual int expandEscapedMacro (const TQString &str, uint pos, TQStringList &ret)
 

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@.nosp@m.kde..nosp@m.org

Definition at line 224 of file kmacroexpander.h.

Constructor & Destructor Documentation

◆ KCharMacroExpander()

KCharMacroExpander::KCharMacroExpander ( TQChar  c = '%')
inline

Constructor.

Parameters
cescape char indicating start of macros, or TQChar::null for none

Definition at line 231 of file kmacroexpander.h.

Member Function Documentation

◆ expandEscapedMacro()

int KCharMacroExpander::expandEscapedMacro ( const TQString &  str,
uint  pos,
TQStringList &  ret 
)
protectedvirtual

This function is called every time the escape char is found if it is not TQChar::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
strthe input string
posthe offset within str. Note that this is the position of the occurrence of the escape char
retreturn 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.

◆ expandMacro()

virtual bool KCharMacroExpander::expandMacro ( TQChar  chr,
TQStringList &  ret 
)
protectedpure virtual

Return substitution list ret for single-character macro chr.

Parameters
chrthe macro to expand
retreturn variable reference. It is guaranteed to be empty when expandMacro is entered.
Returns
true iff chr was a recognized macro name

◆ expandPlainMacro()

int KCharMacroExpander::expandPlainMacro ( const TQString &  str,
uint  pos,
TQStringList &  ret 
)
protectedvirtual

This function is called for every single char within the string if the escape char is TQChar::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
strthe input string
posthe offset within str
retreturn 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.


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

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.