2006-08-01 06:36:16 -05:00
|
|
|
/*
|
|
|
|
* mootextsearch-private.h
|
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2006-08-01 06:36:16 -05:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* This file is part of medit. medit is free software; you can
|
|
|
|
* redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License,
|
|
|
|
* or (at your option) any later version.
|
2006-08-01 06:36:16 -05:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
2006-08-01 06:36:16 -05:00
|
|
|
*/
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#ifndef MOO_TEXT_SEARCH_PRIVATE_H
|
|
|
|
#define MOO_TEXT_SEARCH_PRIVATE_H
|
2006-08-01 06:36:16 -05:00
|
|
|
|
|
|
|
#include <mooedit/mootextsearch.h>
|
2015-12-25 18:07:33 -08:00
|
|
|
#include <mooglib/moo-glib.h>
|
2006-08-01 06:36:16 -05:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2007-12-01 00:16:55 -06:00
|
|
|
typedef struct MooRegex {
|
|
|
|
GRegex *re;
|
|
|
|
int n_lines;
|
|
|
|
int ref_count_;
|
|
|
|
} MooRegex;
|
|
|
|
|
|
|
|
typedef enum /*< enum >*/
|
|
|
|
{
|
|
|
|
MOO_TEXT_REPLACE_STOP = 0,
|
|
|
|
MOO_TEXT_REPLACE_SKIP = 1,
|
|
|
|
MOO_TEXT_REPLACE_DO_REPLACE = 2,
|
|
|
|
MOO_TEXT_REPLACE_ALL = 3
|
|
|
|
} MooTextReplaceResponse;
|
|
|
|
|
2006-08-01 06:36:16 -05:00
|
|
|
/* replacement is evaluated in case of regex */
|
|
|
|
typedef MooTextReplaceResponse (*MooTextReplaceFunc) (const char *text,
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *regex,
|
2006-08-01 06:36:16 -05:00
|
|
|
const char *replacement,
|
|
|
|
const GtkTextIter *to_replace_start,
|
|
|
|
const GtkTextIter *to_replace_end,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *_moo_regex_new (GRegex *regex);
|
|
|
|
MooRegex *_moo_regex_compile (const char *pattern,
|
|
|
|
GRegexCompileFlags compile_options,
|
|
|
|
GRegexMatchFlags match_options,
|
|
|
|
GError **error);
|
|
|
|
MooRegex *_moo_regex_ref (MooRegex *regex);
|
|
|
|
void _moo_regex_unref (MooRegex *regex);
|
2006-08-01 06:36:16 -05:00
|
|
|
|
|
|
|
gboolean _moo_text_search_regex_forward (const GtkTextIter *start,
|
|
|
|
const GtkTextIter *end,
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *regex,
|
2006-08-01 06:36:16 -05:00
|
|
|
GtkTextIter *match_start,
|
|
|
|
GtkTextIter *match_end,
|
|
|
|
char **string,
|
|
|
|
int *match_offset,
|
2007-05-30 04:37:41 -05:00
|
|
|
int *match_len,
|
|
|
|
GMatchInfo **match_info);
|
2006-08-01 06:36:16 -05:00
|
|
|
gboolean _moo_text_search_regex_backward (const GtkTextIter *start,
|
|
|
|
const GtkTextIter *end,
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *regex,
|
2006-08-01 06:36:16 -05:00
|
|
|
GtkTextIter *match_start,
|
|
|
|
GtkTextIter *match_end,
|
|
|
|
char **string,
|
|
|
|
int *match_offset,
|
2007-05-30 04:37:41 -05:00
|
|
|
int *match_len,
|
|
|
|
GMatchInfo **match_info);
|
2006-08-01 06:36:16 -05:00
|
|
|
|
|
|
|
int _moo_text_replace_regex_all (GtkTextIter *start,
|
|
|
|
GtkTextIter *end,
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *regex,
|
2006-08-01 06:36:16 -05:00
|
|
|
const char *replacement,
|
|
|
|
gboolean replacement_literal);
|
|
|
|
|
|
|
|
int _moo_text_replace_regex_all_interactive
|
|
|
|
(GtkTextIter *start,
|
|
|
|
GtkTextIter *end,
|
2007-12-01 00:16:55 -06:00
|
|
|
MooRegex *regex,
|
2006-08-01 06:36:16 -05:00
|
|
|
const char *replacement,
|
|
|
|
gboolean replacement_literal,
|
|
|
|
MooTextReplaceFunc func,
|
|
|
|
gpointer func_data);
|
|
|
|
int _moo_text_replace_all_interactive (GtkTextIter *start,
|
|
|
|
GtkTextIter *end,
|
|
|
|
const char *text,
|
|
|
|
const char *replacement,
|
|
|
|
MooTextSearchFlags flags,
|
|
|
|
MooTextReplaceFunc func,
|
|
|
|
gpointer func_data);
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#endif /* MOO_TEXT_SEARCH_PRIVATE_H */
|