![]() |
![]() |
![]() |
Dee Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
FiltersFilters — A suite of simple DeeFilters for use with DeeFilterModels |
#include <dee.h> DeeFilter * dee_filter_new_collator (guint column
); DeeFilter * dee_filter_new_collator_desc (guint column
); DeeFilter * dee_filter_new_for_any_column (guint column
,GVariant *value
); DeeFilter * dee_filter_new_for_key_column (guint column
,const gchar *key
); DeeFilter * dee_filter_new_regex (guint column
,GRegex *regex
);
DeeFilters are used together with DeeFilterModels to build "views" of some original DeeModel. An example could be to build a view of a model that exposes the rows of the original model sorted by a given column (leaving the original model unaltered):
DeeModel *model, *view; DeeFilter *collator; // Create and populate a model with some unsorted rows model = dee_sequence_model_new (); dee_model_set_schema (model, "i", "s", NULL); dee_model_append (model, 27, "Foo"); dee_model_append (model, 68, "Bar"); // Create a collator for column 1 collator = dee_filter_new_collator (1); // Create the sorted view view = dee_filter_model_new (collator, model); g_free (collator); // When accessing the view the row with 'Bar' will be first
DeeFilter * dee_filter_new_collator (guint column
);
Create a DeeFilter that takes string values from a column in the model and builds a DeeFilterModel with the rows sorted according to the collation rules of the current locale.
DeeFilter * dee_filter_new_collator_desc (guint column
);
Create a DeeFilter that takes string values from a column in the model and builds a DeeFilterModel with the rows sorted descending according to the collation rules of the current locale.
DeeFilter * dee_filter_new_for_any_column (guint column
,GVariant *value
);
Create a DeeFilter that only includes rows from the original model which match a variant value in a given column. A DeeFilterModel created with this filter will be ordered in accordance with its parent model.
This method will work on any column, disregarding its schema, since the
value comparison is done using g_variant_equal()
. This means you can use
this filter as a convenient fallback when there is no predefined filter
for your column type if raw performance is not paramount.
|
The index of a column containing the string to match |
|
A GVariant value columns must match exactly.
The matching semantics are those of g_variant_equal() . If value
is floating the ownership will be transfered to the filter. [transfer none]
|
Returns : |
A newly allocated DeeFilter. Do not modify it.
Free with g_free() . [transfer full]
|
DeeFilter * dee_filter_new_for_key_column (guint column
,const gchar *key
);
Create a DeeFilter that only includes rows from the original model which has an exact match on some string column. A DeeFilterModel created with this filter will be ordered in accordance with its parent model.
DeeFilter * dee_filter_new_regex (guint column
,GRegex *regex
);
Create a DeeFilter that only includes rows from the original model which match a regular expression on some string column. A DeeFilterModel created with this filter will be ordered in accordance with its parent model.