QgsStringReplacementCollection class

A collection of string replacements (specified using QgsStringReplacement objects).

Constructors, destructors, conversion operators

QgsStringReplacementCollection(const QList<QgsStringReplacement>& replacements = QList<QgsStringReplacement>())
Constructor for QgsStringReplacementCollection.

Public functions

auto process(const QString& input) const -> QString
Processes a given input string, applying any valid replacements which should be made using QgsStringReplacement objects contained by this collection.
void readXml(const QDomElement& elem)
Reads the collection state from an XML element.
auto replacements() const -> QList<QgsStringReplacement>
Returns the list of string replacements in this collection.
void setReplacements(const QList<QgsStringReplacement>& replacements)
Sets the list of string replacements in this collection.
void writeXml(QDomElement& elem, QDomDocument& doc) const
Writes the collection state to an XML element.

Function documentation

QgsStringReplacementCollection::QgsStringReplacementCollection(const QList<QgsStringReplacement>& replacements = QList<QgsStringReplacement>())

Constructor for QgsStringReplacementCollection.

Parameters
replacements initial list of string replacements

QString QgsStringReplacementCollection::process(const QString& input) const

Processes a given input string, applying any valid replacements which should be made using QgsStringReplacement objects contained by this collection.

Parameters
input input string
Returns input string with any matches replaced by replacement string

Replacements are made in order of the QgsStringReplacement objects contained in the collection.

void QgsStringReplacementCollection::readXml(const QDomElement& elem)

Reads the collection state from an XML element.

Parameters
elem DOM element

QList<QgsStringReplacement> QgsStringReplacementCollection::replacements() const

Returns the list of string replacements in this collection.

void QgsStringReplacementCollection::setReplacements(const QList<QgsStringReplacement>& replacements)

Sets the list of string replacements in this collection.

Parameters
replacements list of string replacements to apply. Replacements are applied in the order they are specified here.

void QgsStringReplacementCollection::writeXml(QDomElement& elem, QDomDocument& doc) const

Writes the collection state to an XML element.

Parameters
elem target DOM element
doc DOM document