KWordMacroExpander Class Reference
Abstract base class for simple word macro substitutors. More...
#include <kmacroexpander.h>
Inheritance diagram for KWordMacroExpander:


Public Member Functions | |
KWordMacroExpander (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 (const QString &str, QStringList &ret)=0 |
Detailed Description
Abstract base class for simple word macro substitutors.Use this instead of the functions in the KMacroExpander namespace if speculatively pre-filling the substitution map would be too expensive.
A typical application:
class MyClass { ... private: QString m_str; ... friend class MyExpander; }; class MyExpander : public KWordMacroExpander { public: MyExpander( MyClass *_that ) : KWordMacroExpander(), that( _that ) {} protected: virtual bool expandMacro( const QString &str, QStringList &ret ); private: MyClass *that; }; bool MyExpander::expandMacro( const QString &str, QStringList &ret ) { if (str == "macro") { ret += complexOperation( that->m_str ); return true; } return false; } ... MyClass::...(...) { QString str; ... MyExpander mx( this ); mx.expandMacrosShellQuote( str ); ... }
Alternatively MyClass could inherit from KWordMacroExpander directly.
- Since:
- 3.3
- Author:
- Oswald Buddenhagen <ossi@kde.org>
Definition at line 191 of file kmacroexpander.h.
Constructor & Destructor Documentation
|
Constructor.
Definition at line 198 of file kmacroexpander.h. |
Member Function Documentation
|
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
Reimplemented from KMacroExpanderBase. Definition at line 454 of file kmacroexpander.cpp. References expandMacro(), and expandPlainMacro(). Referenced by expandPlainMacro(). |
|
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
Reimplemented from KMacroExpanderBase. Definition at line 468 of file kmacroexpander.cpp. References KMacroExpanderBase::escapeChar(), expandEscapedMacro(), and expandMacro(). Referenced by expandEscapedMacro(). |
|
Return substitution list
Referenced by expandEscapedMacro(), and expandPlainMacro(). |
The documentation for this class was generated from the following files: