1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
<!ENTITY tutorial SYSTEM "lang-tutorial.sgml">
<!ENTITY reference SYSTEM "lang-reference.sgml">
]>
<refentry id="gtksourceview-20-Searching-in-a-GtkSourceBuffer">
<refmeta>
<refentrytitle role="top_of_page" id="gtksourceview-20-Searching-in-a-GtkSourceBuffer.top_of_page">Searching in a GtkSourceBuffer</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTKSOURCEVIEW-2.0 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Searching in a GtkSourceBuffer</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv id="gtksourceview-20-Searching-in-a-GtkSourceBuffer.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#include <gtksourceview/gtksourceiter.h>
enum <link linkend="GtkSourceSearchFlags">GtkSourceSearchFlags</link>;
<link linkend="gboolean">gboolean</link> <link linkend="gtk-source-iter-backward-search">gtk_source_iter_backward_search</link> (const <link linkend="GtkTextIter">GtkTextIter</link> *iter,
const <link linkend="gchar">gchar</link> *str,
<link linkend="GtkSourceSearchFlags">GtkSourceSearchFlags</link> flags,
<link linkend="GtkTextIter">GtkTextIter</link> *match_start,
<link linkend="GtkTextIter">GtkTextIter</link> *match_end,
const <link linkend="GtkTextIter">GtkTextIter</link> *limit);
<link linkend="gboolean">gboolean</link> <link linkend="gtk-source-iter-forward-search">gtk_source_iter_forward_search</link> (const <link linkend="GtkTextIter">GtkTextIter</link> *iter,
const <link linkend="gchar">gchar</link> *str,
<link linkend="GtkSourceSearchFlags">GtkSourceSearchFlags</link> flags,
<link linkend="GtkTextIter">GtkTextIter</link> *match_start,
<link linkend="GtkTextIter">GtkTextIter</link> *match_end,
const <link linkend="GtkTextIter">GtkTextIter</link> *limit);
</synopsis>
</refsynopsisdiv>
<refsect1 id="gtksourceview-20-Searching-in-a-GtkSourceBuffer.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>
<refsect1 id="gtksourceview-20-Searching-in-a-GtkSourceBuffer.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GtkSourceSearchFlags" role="enum">
<title>enum GtkSourceSearchFlags</title>
<indexterm zone="GtkSourceSearchFlags"><primary>GtkSourceSearchFlags</primary></indexterm><programlisting>typedef enum
{
GTK_SOURCE_SEARCH_VISIBLE_ONLY = 1 << 0,
GTK_SOURCE_SEARCH_TEXT_ONLY = 1 << 1,
GTK_SOURCE_SEARCH_CASE_INSENSITIVE = 1 << 2
/* Possible future plans: SEARCH_REGEXP */
} GtkSourceSearchFlags;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="gtk-source-iter-backward-search" role="function">
<title>gtk_source_iter_backward_search ()</title>
<indexterm zone="gtk-source-iter-backward-search"><primary>gtk_source_iter_backward_search</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> gtk_source_iter_backward_search (const <link linkend="GtkTextIter">GtkTextIter</link> *iter,
const <link linkend="gchar">gchar</link> *str,
<link linkend="GtkSourceSearchFlags">GtkSourceSearchFlags</link> flags,
<link linkend="GtkTextIter">GtkTextIter</link> *match_start,
<link linkend="GtkTextIter">GtkTextIter</link> *match_end,
const <link linkend="GtkTextIter">GtkTextIter</link> *limit);</programlisting>
<para>
Same as <link linkend="gtk-text-iter-backward-search"><function>gtk_text_iter_backward_search()</function></link>, but supports case insensitive
searching.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>iter</parameter> :</term>
<listitem><simpara> a <link linkend="GtkTextIter"><type>GtkTextIter</type></link> where the search begins.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> search string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> bitmask of flags affecting the search.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_start</parameter> :</term>
<listitem><simpara> return location for start of match, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_end</parameter> :</term>
<listitem><simpara> return location for end of match, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>limit</parameter> :</term>
<listitem><simpara> location of last possible <parameter>match_start</parameter>, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link> for start of buffer.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> whether a match was found.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-source-iter-forward-search" role="function">
<title>gtk_source_iter_forward_search ()</title>
<indexterm zone="gtk-source-iter-forward-search"><primary>gtk_source_iter_forward_search</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> gtk_source_iter_forward_search (const <link linkend="GtkTextIter">GtkTextIter</link> *iter,
const <link linkend="gchar">gchar</link> *str,
<link linkend="GtkSourceSearchFlags">GtkSourceSearchFlags</link> flags,
<link linkend="GtkTextIter">GtkTextIter</link> *match_start,
<link linkend="GtkTextIter">GtkTextIter</link> *match_end,
const <link linkend="GtkTextIter">GtkTextIter</link> *limit);</programlisting>
<para>
Searches forward for <parameter>str</parameter>. Any match is returned by setting
<parameter>match_start</parameter> to the first character of the match and <parameter>match_end</parameter> to the
first character after the match. The search will not continue past
<parameter>limit</parameter>. Note that a search is a linear or O(n) operation, so you
may wish to use <parameter>limit</parameter> to avoid locking up your UI on large
buffers.
</para>
<para>
If the <link linkend="GTK-SOURCE-SEARCH-VISIBLE-ONLY:CAPS"><type>GTK_SOURCE_SEARCH_VISIBLE_ONLY</type></link> flag is present, the match may
have invisible text interspersed in <parameter>str</parameter>. i.e. <parameter>str</parameter> will be a
possibly-noncontiguous subsequence of the matched range. similarly,
if you specify <link linkend="GTK-SOURCE-SEARCH-TEXT-ONLY:CAPS"><type>GTK_SOURCE_SEARCH_TEXT_ONLY</type></link>, the match may have
pixbufs or child widgets mixed inside the matched range. If these
flags are not given, the match must be exact; the special 0xFFFC
character in <parameter>str</parameter> will match embedded pixbufs or child widgets.
If you specify the <link linkend="GTK-SOURCE-SEARCH-CASE-INSENSITIVE:CAPS"><type>GTK_SOURCE_SEARCH_CASE_INSENSITIVE</type></link> flag, the text will
be matched regardless of what case it is in.
</para>
<para>
Same as <link linkend="gtk-text-iter-forward-search"><function>gtk_text_iter_forward_search()</function></link>, but supports case insensitive
searching.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>iter</parameter> :</term>
<listitem><simpara> start of search.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> a search string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> flags affecting how the search is done.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_start</parameter> :</term>
<listitem><simpara> return location for start of match, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_end</parameter> :</term>
<listitem><simpara> return location for end of match, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>limit</parameter> :</term>
<listitem><simpara> bound for the search, or %<link linkend="NULL:CAPS"><literal>NULL</literal></link> for the end of the buffer.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> whether a match was found.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|