DeeTermList

DeeTermList — A simple collection type representing a list of indexed terms for a row in a DeeIndex

Synopsis

#include <dee.h>

struct              DeeTermList;
struct              DeeTermListClass;
const gchar *          dee_term_list_get_term           (DeeTermList *self,
                                                         guint n);
void                dee_term_list_add_term              (DeeTermList *self,
                                                         const gchar *term);
guint               dee_term_list_num_terms             (DeeTermList *self);
void                dee_term_list_clear                 (DeeTermList *self);
                    DeeTermListPrivate;

Object Hierarchy

  GObject
   +----DeeTermList

Description

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.

Details

struct DeeTermList

struct DeeTermList;

All fields in the DeeTermList structure are private and should never be accessed directly


struct DeeTermListClass

struct DeeTermListClass {
  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);
};


dee_term_list_get_term ()

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.

self :

The term list to get the nth term from

n :

The (zero based) offset into the term list

Returns :

The nth string held in the term list

dee_term_list_add_term ()

void                dee_term_list_add_term              (DeeTermList *self,
                                                         const gchar *term);

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.

self :

The term list to add a term to

term :

The term to add

dee_term_list_num_terms ()

guint               dee_term_list_num_terms             (DeeTermList *self);

self :

The term list to check the number of terms in

Returns :

The number of terms in the term list

dee_term_list_clear ()

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.

self :

The term list to clear

DeeTermListPrivate

typedef struct _DeeTermListPrivate DeeTermListPrivate;

Ignore this structure.