QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Static Public Member Functions | List of all members
QgsStringReplacement Class Reference

A representation of a single string replacement. More...

#include <qgsstringutils.h>

Public Member Functions

 QgsStringReplacement (const QString &match, const QString &replacement, bool caseSensitive=false, bool wholeWordOnly=false)
 Constructor for QgsStringReplacement. More...
 
bool caseSensitive () const
 Returns true if match is case sensitive. More...
 
QString match () const
 Returns the string matched by this object. More...
 
bool operator== (const QgsStringReplacement &other) const
 
QString process (const QString &input) const
 Processes a given input string, applying any valid replacements which should be made. More...
 
QgsStringMap properties () const
 Returns a map of the replacement properties. More...
 
QString replacement () const
 Returns the string to replace matches with. More...
 
bool wholeWordOnly () const
 Returns true if match only applies to whole words, or false if partial word matches are permitted. More...
 

Static Public Member Functions

static QgsStringReplacement fromProperties (const QgsStringMap &properties)
 Creates a new QgsStringReplacement from an encoded properties map. More...
 

Detailed Description

A representation of a single string replacement.

Definition at line 37 of file qgsstringutils.h.

Constructor & Destructor Documentation

◆ QgsStringReplacement()

QgsStringReplacement::QgsStringReplacement ( const QString &  match,
const QString &  replacement,
bool  caseSensitive = false,
bool  wholeWordOnly = false 
)

Constructor for QgsStringReplacement.

Parameters
matchstring to match
replacementstring to replace match with
caseSensitiveset to true for a case sensitive match
wholeWordOnlyset to true to match complete words only, or false to allow partial word matches

Definition at line 748 of file qgsstringutils.cpp.

Member Function Documentation

◆ caseSensitive()

bool QgsStringReplacement::caseSensitive ( ) const
inline

Returns true if match is case sensitive.

Definition at line 61 of file qgsstringutils.h.

◆ fromProperties()

QgsStringReplacement QgsStringReplacement::fromProperties ( const QgsStringMap properties)
static

Creates a new QgsStringReplacement from an encoded properties map.

See also
properties()

Definition at line 784 of file qgsstringutils.cpp.

◆ match()

QString QgsStringReplacement::match ( ) const
inline

Returns the string matched by this object.

Definition at line 55 of file qgsstringutils.h.

◆ operator==()

bool QgsStringReplacement::operator== ( const QgsStringReplacement other) const
inline

Definition at line 73 of file qgsstringutils.h.

◆ process()

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

Processes a given input string, applying any valid replacements which should be made.

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

Definition at line 761 of file qgsstringutils.cpp.

◆ properties()

QgsStringMap QgsStringReplacement::properties ( ) const

Returns a map of the replacement properties.

See also
fromProperties()

Definition at line 774 of file qgsstringutils.cpp.

◆ replacement()

QString QgsStringReplacement::replacement ( ) const
inline

Returns the string to replace matches with.

Definition at line 58 of file qgsstringutils.h.

◆ wholeWordOnly()

bool QgsStringReplacement::wholeWordOnly ( ) const
inline

Returns true if match only applies to whole words, or false if partial word matches are permitted.

Definition at line 64 of file qgsstringutils.h.


The documentation for this class was generated from the following files: