• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

Public Member Functions | Static Public Member Functions | List of all members
KateRegExpSearch Class Reference

#include <kateregexpsearch.h>

Public Member Functions

 KateRegExpSearch (KTextEditor::Document *document, Qt::CaseSensitivity caseSensitivity)
 
 ~KateRegExpSearch ()
 
QVector< KTextEditor::Range > search (const QString &pattern, const KTextEditor::Range &inputRange, bool backwards=false)
 

Static Public Member Functions

static QString buildReplacement (const QString &text, const QStringList &capturedTexts, int replacementCounter)
 
static QString escapePlaintext (const QString &text)
 

Detailed Description

Object to help to search for regexp.

This should be NO QObject, it is created to often! I measured that, if you create it 20k times to replace for example " " in a document, that takes seconds on a modern machine!

Definition at line 40 of file kateregexpsearch.h.

Constructor & Destructor Documentation

KateRegExpSearch::KateRegExpSearch ( KTextEditor::Document *  document,
Qt::CaseSensitivity  caseSensitivity 
)
explicit

Definition at line 168 of file kateregexpsearch.cpp.

KateRegExpSearch::~KateRegExpSearch ( )

Definition at line 177 of file kateregexpsearch.cpp.

Member Function Documentation

QString KateRegExpSearch::buildReplacement ( const QString &  text,
const QStringList &  capturedTexts,
int  replacementCounter 
)
static

Returns a modified version of text where.

  • escape sequences are resolved, e.g. "\\n" to "\n",
  • references are resolved, e.g. "\\1" to 1st entry in capturedTexts, and
  • counter sequences are resolved, e.g. "\\#...#" to replacementCounter.
Parameters
texttext containing escape sequences, references, and counter sequences
capturedTextslist of substitutes for references
replacementCountervalue for replacement counter
Returns
resolved text

Definition at line 537 of file kateregexpsearch.cpp.

QString KateRegExpSearch::escapePlaintext ( const QString &  text)
static

Returns a modified version of text where escape sequences are resolved, e.g.

"\\n" to "\n".

Parameters
texttext containing escape sequences
Returns
text with resolved escape sequences

Definition at line 531 of file kateregexpsearch.cpp.

QVector< KTextEditor::Range > KateRegExpSearch::search ( const QString &  pattern,
const KTextEditor::Range &  inputRange,
bool  backwards = false 
)

Search for the regular expression regexp inside the range inputRange.

If backwards is true, the search direction will be reversed.

Parameters
regexptext to search for
inputRangeRange to search in
backwardsif true, the search will be backwards
Returns
Vector of ranges, one for each capture. The first range (index zero) spans the full match. If the pattern does not match the vector has length 1 and holds the invalid range (see Range::isValid()).
See also
KTextEditor::Range, QRegExp

Definition at line 201 of file kateregexpsearch.cpp.


The documentation for this class was generated from the following files:
  • kateregexpsearch.h
  • kateregexpsearch.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:57:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal