diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-23 19:15:17 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-23 19:15:17 +0100 |
commit | fd4b89e797c1efc73304fa4da073fb31f55527f1 (patch) | |
tree | 71979801338b2e5a6e25fa2f300c5edd5ba70551 /src/symbols.h | |
parent | 1b636e3cc7326e9139ff107b2818703181c6e7f7 (diff) | |
download | sciteco-fd4b89e797c1efc73304fa4da073fb31f55527f1.tar.gz |
fixed symbol lists: sort order must correspond with search order (determined by comparision function)
* lists were sorted lexicographically (like strcmp()), but searched caseless (like strcasecmp())
* lists are now sorted with strcasecmp()-like comparision
* caselessness is thus a property of the SymbolList
* use new language features in symbols-extract.tes
Diffstat (limited to 'src/symbols.h')
-rw-r--r-- | src/symbols.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/symbols.h b/src/symbols.h index bc4a291..bb27d01 100644 --- a/src/symbols.h +++ b/src/symbols.h @@ -18,6 +18,7 @@ #ifndef __SYMBOLS_H #define __SYMBOLS_H +#include <string.h> #include <glib.h> class SymbolList { @@ -31,19 +32,26 @@ public: gint size; private: + int (*cmp_fnc)(const char *, const char *, size_t); + /* for auto-completions */ GList *list; public: - SymbolList(const Entry *_entries = NULL, gint _size = 0) - : entries(_entries), size(_size), list(NULL) {} + SymbolList(const Entry *_entries = NULL, gint _size = 0, + bool case_sensitive = false) + : entries(_entries), size(_size), list(NULL) + { + cmp_fnc = case_sensitive ? strncmp + : g_ascii_strncasecmp; + } + ~SymbolList() { g_list_free(list); } - gint lookup(const gchar *name, const gchar *prefix = "", - bool case_sensitive = false); + gint lookup(const gchar *name, const gchar *prefix = ""); GList *get_glist(void); }; |