KCharMacroExpander Class

Header: #include <KMacroExpander>
CMake: find_package(KF6 REQUIRED COMPONENTS CoreAddons)
target_link_libraries(mytarget PRIVATE KF6::CoreAddons)
Inherits: KMacroExpanderBase

Public Functions

KCharMacroExpander(QChar c = QLatin1Char('%'))

Protected Functions

virtual bool expandMacro(QChar chr, QStringList &ret) = 0

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.

Member Function Documentation

[explicit] KCharMacroExpander::KCharMacroExpander(QChar c = QLatin1Char('%'))

Constructor.

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

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

Return substitution list ret for single-character macro chr.

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