<?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>
</refnamediv>

<refsynopsisdiv id="gtksourceview-20-Searching-in-a-GtkSourceBuffer.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gtksourceview/gtksourceiter.h&gt;

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 sortas="GtkSourceSearchFlags">GtkSourceSearchFlags</primary></indexterm><programlisting>typedef enum
{
	GTK_SOURCE_SEARCH_VISIBLE_ONLY		 = 1 &lt;&lt; 0,
	GTK_SOURCE_SEARCH_TEXT_ONLY		 = 1 &lt;&lt; 1,
	GTK_SOURCE_SEARCH_CASE_INSENSITIVE	 = 1 &lt;&lt; 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 sortas="gtk_source_iter_backward_search">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>&#160;:</term>
<listitem><simpara> a <link linkend="GtkTextIter"><type>GtkTextIter</type></link> where the search begins.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> search string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara> bitmask of flags affecting the search.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_start</parameter>&#160;:</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>&#160;:</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>&#160;:</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>&#160;:</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 sortas="gtk_source_iter_forward_search">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>&#160;:</term>
<listitem><simpara> start of search.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a search string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara> flags affecting how the search is done.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>match_start</parameter>&#160;:</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>&#160;:</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>&#160;:</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>&#160;:</term><listitem><simpara> whether a match was found.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
