16 #include "qgis_core.h" 20 #include <QDomDocument> 24 #ifndef QGSSTRINGUTILS_H 25 #define QGSSTRINGUTILS_H 48 const QString &replacement,
49 bool caseSensitive =
false,
50 bool wholeWordOnly =
false );
53 QString
match()
const {
return mMatch; }
69 QString process(
const QString &input )
const;
73 return mMatch == other.mMatch
74 && mReplacement == other.mReplacement
75 && mCaseSensitive == other.mCaseSensitive
76 && mWholeWordOnly == other.mWholeWordOnly;
122 : mReplacements( replacements )
129 QList< QgsStringReplacement >
replacements()
const {
return mReplacements; }
139 mReplacements = replacements;
149 QString process(
const QString &input )
const;
157 void writeXml( QDomElement &elem, QDomDocument &doc )
const;
164 void readXml(
const QDomElement &elem );
168 QList< QgsStringReplacement > mReplacements;
187 MixedCase = QFont::MixedCase,
188 AllUppercase = QFont::AllUppercase,
189 AllLowercase = QFont::AllLowercase,
190 ForceFirstLetterToCapital = QFont::Capitalize,
191 TitleCase = QFont::Capitalize + 1000,
192 UpperCamelCase = QFont::Capitalize + 1001,
202 static QString capitalize(
const QString &
string,
Capitalization capitalization );
212 static QString ampersandEncode(
const QString &
string );
223 static int levenshteinDistance(
const QString &string1,
const QString &string2,
bool caseSensitive =
false );
234 static QString longestCommonSubstring(
const QString &string1,
const QString &string2,
bool caseSensitive =
false );
245 static int hammingDistance(
const QString &string1,
const QString &string2,
bool caseSensitive =
false );
253 static QString soundex(
const QString &
string );
263 static QString insertLinks(
const QString &
string,
bool *foundLinks =
nullptr );
277 static QString wordWrap(
const QString &
string,
int length,
bool useMaxLineLength =
true,
const QString &customDelimiter = QString() );
285 static QString substituteVerticalCharacters( QString
string );
293 static QString htmlToMarkdown(
const QString &html );
297 #endif //QGSSTRINGUTILS_H bool operator==(const QgsStringReplacement &other)
A representation of a single string replacement.
bool caseSensitive() const
Returns true if match is case sensitive.
QgsStringReplacementCollection(const QList< QgsStringReplacement > &replacements=QList< QgsStringReplacement >())
Constructor for QgsStringReplacementCollection.
QMap< QString, QString > QgsStringMap
QList< QgsStringReplacement > replacements() const
Returns the list of string replacements in this collection.
QString match() const
Returns the string matched by this object.
QString replacement() const
Returns the string to replace matches with.
Capitalization
Capitalization options.
bool wholeWordOnly() const
Returns true if match only applies to whole words, or false if partial word matches are permitted...
A collection of string replacements (specified using QgsStringReplacement objects).
Utility functions for working with strings.
void setReplacements(const QList< QgsStringReplacement > &replacements)
Sets the list of string replacements in this collection.