| Dee Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
Model ReadersModel Readers — Extracting strings from DeeModels |
#include <dee.h>
DeeFilter;
DeeModelReader;
gchar * (*DeeModelReaderFunc) (DeeModel *model,
DeeModelIter *iter,
gpointer userdata);
void dee_model_reader_destroy (DeeModelReader *reader);
void dee_model_reader_new (DeeModelReaderFunc reader_func,
gpointer userdata,
GDestroyNotify destroy,
DeeModelReader *out_reader);
void dee_model_reader_new_for_int32_column
(guint column,
DeeModelReader *out_reader);
void dee_model_reader_new_for_string_column
(guint column,
DeeModelReader *out_reader);
void dee_model_reader_new_for_uint32_column
(guint column,
DeeModelReader *out_reader);
gchar * dee_model_reader_read (DeeModelReader *self,
DeeModel *model,
DeeModelIter *iter);
The purpose of a DeeModelReader is to extract string from a DeeModel. These strings are usually passed through a DeeAnalyzer on into a DeeIndex.
Most readers will extract a value of a given type from a given column, but it must be noted that this is not a requirement. The strings may be built from several columns.
typedef struct {
DeeFilterMapFunc map_func;
DeeFilterMapNotify map_notify;
GDestroyNotify destroy;
gpointer userdata;
} DeeFilter;
Structure encapsulating the mapping logic used to construct a DeeFilterModel
typedef struct {
DeeModelReaderFunc reader_func;
gpointer userdata;
GDestroyNotify destroy;
} DeeModelReader;
Structure encapsulating the information needed to read strings from a model. Used for example by DeeIndex.
DeeModelReaderFunc |
The DeeModelReaderFunc used to extract string from a model. [scope notified] |
gpointer |
user data to pass to reader_func. [closure]
|
GDestroyNotify |
Called when the reader is destroyed |
gchar * (*DeeModelReaderFunc) (DeeModel *model,DeeModelIter *iter,gpointer userdata);
Extracts a string from a row in a model.
|
The model being indexed |
|
The row to extract terms for |
|
The data set when registering the reader. [closure] |
Returns : |
A newly allocated string with the row data to be indexed.
Free with g_free(). |
void dee_model_reader_destroy (DeeModelReader *reader);
Release resources associated with reader, but does not free the
DeeModelReader structure itself.
This will call the destroy() function registered with the reader
if it is set.
|
The reader to destroy |
void dee_model_reader_new (DeeModelReaderFunc reader_func,gpointer userdata,GDestroyNotify destroy,DeeModelReader *out_reader);
Create a new DeeModelReader with the given parameters. This call will zero
the out_reader struct.
|
The DeeModelReaderFunc to use for the reader. [scope notified] |
|
The user data to pass to reader_func. [closure][allow-none]
|
|
The GDestroyNotify to call on
userdata when disposing of the reader. [allow-none]
|
|
A pointer to an uninitialized DeeModelReader struct. [out] |
void dee_model_reader_new_for_int32_column (guint column,DeeModelReader *out_reader);
A DeeModelReader reading a gint32 from a DeeModel at a given column
|
The column index to read a gint32 from |
|
A pointer to a DeeModelReader instance which will have all fields initialized appropriately. [out] |
void dee_model_reader_new_for_string_column (guint column,DeeModelReader *out_reader);
A DeeModelReader reading a string from a DeeModel at a given column
|
The column index to read a string from |
|
A pointer to a DeeModelReader instance which will have all fields initialized appropriately. [out] |
void dee_model_reader_new_for_uint32_column (guint column,DeeModelReader *out_reader);
A DeeModelReader reading a guint32 from a DeeModel at a given column
|
The column index to read a guint32 from |
|
A pointer to a DeeModelReader instance which will have all fields initialized appropriately. [out] |
gchar * dee_model_reader_read (DeeModelReader *self,DeeModel *model,DeeModelIter *iter);
Read data from a row in a DeeModel and extract a string representation from it.
Note that generally a DeeModelReader need not be confined to reading from one specific column, although in practice most are.
|
The DeeModelReader used to read model
|
|
The DeeModel to read a string from |
|
The row to read a string from |
Returns : |
A newly allocated string. Free with g_free(). |