KDE 4.9 PyKDE API Reference

- KDE's Python API

# SearchInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Search interface extension for the Document.

Introduction

The SearchInterface provides methods to search for a given text pattern in a Document. You can either search for a simple text or for a regular expression, see searchText.

Accessing the SearchInterface

The SearchInterface is supposed to be an extension interface for a Document, i.e. the Document inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:

     // doc is of type KTextEditor.Document*
     KTextEditor.SearchInterface *iface =
         qobject_cast<KTextEditor.SearchInterface*>( doc );

     if( iface ) {
         // the implementation supports the interface
         // do stuff
     }

See also:
  KTextEditor.Document

Author:
  Christoph Cullmann <cullmann@kde.org>

## Methods
| __init__ (self)
QVector | searchText (self, KTextEditor.Range range, QString pattern, KTextEditor.Search.SearchOptions options=KTextEditor.Search.Default)
KTextEditor.Search.SearchOptions | supportedSearchOptions (self)

## Method Documentation

__init__ | ( |  | self ) |

Constructor.

QVector searchText | ( | self, |
|  | KTextEditor.Range | range,
|  | QString | pattern,
|  | KTextEditor.Search.SearchOptions | options=KTextEditor.Search.Default
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Searches the given input range for a text pattern.

Searches for a text pattern within the given input range. The kind of search performed depends on the <code>options</code> used. Use this function for plaintext searches as well as regular expression searches. Query supportedSearchOptions to find out, which options the current implementation does support. If no match is found the first (and only) element in the vector return is the invalid range. When searching for regular expressions, the first element holds the range of the full match, the subsequent elements hold the ranges of the capturing parentheses.

Parameters:

  | range | Input range to search in

Parameters:

  | pattern | Text pattern to search for

Parameters:

  | options | Combination of search flags

Returns:
  List of ranges (length >=1)

See also:
  Search.SearchOptionsEnum

Author:
  Sebastian Pipping <webmaster@hartwork.org>

KTextEditor.Search.SearchOptions supportedSearchOptions | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Specifies all options supported by searchText.

Returns:
  Combination of all flags supported by searchText

See also:
  Search.SearchOptionsEnum

Author:
  Sebastian Pipping <webmaster@hartwork.org>