#include <kmacroexpander.h>
Public Member Functions | |
| 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) |
Detailed Description
Abstract base class for the worker classes behind the KMacroExpander namespace and the KCharMacroExpander and KWordMacroExpander classes.
- Since
- 3.1.3
Definition at line 37 of file kmacroexpander.h.
Constructor & Destructor Documentation
◆ KMacroExpanderBase()
| KMacroExpanderBase::KMacroExpanderBase | ( | TQChar | c = '%' | ) |
Constructor.
- Parameters
-
c escape char indicating start of macros, or TQChar::null for none
Definition at line 28 of file kmacroexpander.cpp.
◆ ~KMacroExpanderBase()
|
virtual |
Destructor.
Definition at line 33 of file kmacroexpander.cpp.
Member Function Documentation
◆ escapeChar()
| TQChar KMacroExpanderBase::escapeChar | ( | ) | const |
Obtain the macro escape character.
- Returns
- escape char indicating start of macros, or TQChar::null if none
Definition at line 44 of file kmacroexpander.cpp.
◆ expandEscapedMacro()
|
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
-
str the input string pos the offset within str. Note that this is the position of the occurrence of the escape charret return value: the string to substitute for the macro
- Returns
- if greater than zero, the number of chars at
posinstrto substitute withret(i.e., a valid macro was found). if less than zero, subtract this value frompos(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.
◆ expandMacros()
| void KMacroExpanderBase::expandMacros | ( | TQString & | 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.
◆ expandMacrosShellQuote() [1/2]
| bool KMacroExpanderBase::expandMacrosShellQuote | ( | TQString & | 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.
◆ expandMacrosShellQuote() [2/2]
| bool KMacroExpanderBase::expandMacrosShellQuote | ( | TQString & | str, |
| uint & | pos | ||
| ) |
Definition at line 100 of file kmacroexpander.cpp.
◆ expandPlainMacro()
|
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
-
str the input string pos the offset within strret return value: the string to substitute for the macro
- Returns
- if greater than zero, the number of chars at
posinstrto substitute withret(i.e., a valid macro was found). if less than zero, subtract this value frompos(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.
◆ setEscapeChar()
| void KMacroExpanderBase::setEscapeChar | ( | TQChar | c | ) |
Set the macro escape character.
- Parameters
-
c escape char indicating start of macros, or TQChar::null if none
Definition at line 38 of file kmacroexpander.cpp.
The documentation for this class was generated from the following files:
Trinity API Reference