Beaver
0.4.1
|
#include <glib.h>
#include <gtk/gtk.h>
#include <string.h>
#include "../struct.h"
#include "../search.h"
#include "beaver.h"
#include "api.h"
Macros | |
#define | SEARCH_ALPHABET_SIZE 256 |
Functions | |
void | beaver_text_insert_string_impl (const gchar *text) |
BeaverTextSelection * | beaver_text_selection_position_impl (void) |
gchar * | beaver_text_selection_get_impl (void) |
void | beaver_text_selection_set_impl (const gchar *text) |
enum BeaverTextFormat | beaver_text_format_impl (void) |
void | beaver_text_replace_impl (const gchar *needle, const gchar *substitute, gboolean sensitive) |
gboolean | beaver_text_find_impl (const gchar *needle, guint offset, gboolean sensitive) |
Variables | |
GtkWidget * | MainNotebook |
gint | OpenedFilesCnt |
GArray * | FileProperties |
Implementation for text manipulations for plugins.
gboolean beaver_text_find_impl | ( | const gchar * | needle, |
guint | offset, | ||
gboolean | sensitive | ||
) |
Searches for a needle in the text. When found the text will be selected at the position and TRUE will be returned. If nothing was found, then nothing will be selected and FALSE will be returned. The selected text can be altered via beaver_text_selection_get/set.
The search is done via Boyer-Moore-Horspool's Algorithm. See http://www-igm.univ-mlv.fr/~lecroq/string/node18.html for more explanation about it.
needle | the string to search for |
offset | where in the text to begin to search (0 for beginning of text) |
sensitive | wheter or not to search case sensitive |
true | needle was found in text |
false | otherwise |
enum BeaverTextFormat beaver_text_format_impl | ( | void | ) |
Returns the format of the text. The format revers to the line-break type of the different OS's.
0 | UNIX line-break |
2 | DOS line-break |
1 | MAC line-break |
-1 | Unknown or error |
void beaver_text_insert_string_impl | ( | const gchar * | text | ) |
Insert text at current cursos position. If no text/cursor position is avaible then ignore insert. Also if text is read-only, ignore the call.
text | string to be inserted |
void beaver_text_replace_impl | ( | const gchar * | needle, |
const gchar * | substitute, | ||
gboolean | sensitive | ||
) |
Searches for needle in the text and replaces it with subsitute. Replaces all occurences of needle.
needle | the search string to replace |
substitute | the replacement of found needle |
sensitive | wheter or not to search case sensitive |
gchar* beaver_text_selection_get_impl | ( | void | ) |
Get the text that was selected. Returns NULL if no text was selected or if no text is avaiable. The returned string should be freed after usage.
BeaverTextSelection* beaver_text_selection_position_impl | ( | void | ) |
void beaver_text_selection_set_impl | ( | const gchar * | text | ) |
Overwrites the selection with the given text. If no text is selected then just insert the text at the current cursor position. If no text is avaiable or text is read-only then ignore the call.
text | the text to be inserted into the selection |