| Dee Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
DeeTermListDeeTermList — A simple collection type representing a list of indexed terms for a row in a DeeIndex |
#include <dee.h>
DeeTermListClass;
DeeTermList;
DeeTermListPrivate;
const gchar* dee_term_list_get_term (DeeTermList *self,
guint n);
void dee_term_list_add_term (DeeTermList *self,
const gchar *key);
guint dee_term_list_num_terms (DeeTermList *self);
void dee_term_list_clear (DeeTermList *self);
DeeTermList is a simple list type containing the indexed terms of a row in a DeeModel as recorded in a DeeIndex. The terms are extracted from the model by using a DeeAnalyzer.
The default implementation of DeeTermList stores all terms in a string pool
and reuses terms from that string pool for the entire lifetime of the
term list. That is, even if you call dee_term_list_clear() on it. This
behaviour will save a lot of reallocations and g_strdup()s provided
there is reuse in the terms over time.
typedef struct {
GObjectClass parent_class;
const gchar* (* get_term) (DeeTermList *self,
guint n);
void (* add_term) (DeeTermList *self,
const gchar *term);
guint (* num_terms) (DeeTermList *self);
void (* clear) (DeeTermList *self);
} DeeTermListClass;
typedef struct _DeeTermList DeeTermList;
All fields in the DeeTermList structure are private and should never be accessed directly
const gchar* dee_term_list_get_term (DeeTermList *self,guint n);
Get the n'th term in the list.
Note that in the default implementation it is guaranteed that the returned string is valid for the entire lifetime of the DeeTermList.
|
The term list to get the nth term from
|
|
The (zero based) offset into the term list |
Returns : |
The nth string held in the term list
|
void dee_term_list_add_term (DeeTermList *self,const gchar *key);
Add a term to the termlist. Note that it is possible to add a term multiple times. The effect of this is determined by the DeeModelIndex consuming the DeeTermList.
|
The term list to add a term to |
|
guint dee_term_list_num_terms (DeeTermList *self);
|
The term list to check the number of terms in |
Returns : |
The number of terms in the term list |
void dee_term_list_clear (DeeTermList *self);
Remove all terms from a term list making it ready for reuse. Note that term list implementations will often have optimized memory allocation schemes so reuse is often more efficient than allocating a new term list each time you need it.
|
The term list to clear |