ZeitgeistResultSet

ZeitgeistResultSet — Cursor-like interface for results sets

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── ZeitgeistResultSet

Prerequisites

ZeitgeistResultSet requires GObject.

Known Implementations

ZeitgeistResultSet is implemented by ZeitgeistSimpleResultSet.

Description

include: zeitgeist.h

Interface for results returned by zeitgeist_log_find_events(), zeitgeist_log_get_events(), and zeitgeist_index_search().

This interface utilizes a cursor-like metaphor. You advance the cursor by calling zeitgeist_result_set_next() or adjust it manually by calling zeitgeist_result_set_seek().

Calling zeitgeist_result_set_next() will also return the event at the current cursor position. You may retrieve the current event without advancing the cursor by calling zeitgeist_result_set_peek().

Functions

zeitgeist_result_set_size ()

guint
zeitgeist_result_set_size (ZeitgeistResultSet *self);

Get the number of ZeitgeistEvent<!-- -->s held in a ZeitgeistResultSet. Unlike the number obtained from zeitgeist_result_set_estimated_matches() the size of the result set is always equal to the number of times you can call zeitgeist_result_set_next().

Parameters

self

the ZeitgeistResultSet instance

 

Returns

The number of events held in the result set


zeitgeist_result_set_estimated_matches ()

guint
zeitgeist_result_set_estimated_matches
                               (ZeitgeistResultSet *self);

Get the total number of matches that would have been for the query that generated the result set had it not been restricted in size. For FTS the number of matches is estimated.

For zeitgeist_log_find_events() and zeitgeist_log_get_events() this will always be the same as zeitgeist_result_set_size(). For cases like zeitgeist_index_search() where you specify a subset of the hits to retrieve the estimated match count will often be bigger than the result set size.

Parameters

self

the ZeitgeistResultSet instance

 

Returns

The number of events that matched the query


zeitgeist_result_set_next_value ()

ZeitgeistEvent *
zeitgeist_result_set_next_value (ZeitgeistResultSet *self);

Get the current event from the result set and advance the cursor. To ensure that calls to this method will succeed you can call zeitgeist_result_set_has_next().

Parameters

self

the ZeitgeistResultSet instance

 

Returns

The ZeitgeistEvent at the current cursor position, or NULL if there are no events left.


zeitgeist_result_set_has_next ()

gboolean
zeitgeist_result_set_has_next (ZeitgeistResultSet *self);

Check if a call to zeitgeist_result_set_next() will succeed.

Parameters

self

the ZeitgeistResultSet instance

 

Returns

TRUE if and only if more events can be retrieved by calling zeitgeist_result_set_next()


zeitgeist_result_set_tell ()

guint
zeitgeist_result_set_tell (ZeitgeistResultSet *self);

Get the current position of the cursor.

Parameters

self

the ZeitgeistResultSet instance

 

Returns

The current position of the cursor


zeitgeist_result_set_reset ()

void
zeitgeist_result_set_reset (ZeitgeistResultSet *self);

Resets the result set to start iterating it again from scratch.

Parameters

self

the ZeitgeistResultSet instance

 

zeitgeist_result_set_iterator ()

ZeitgeistResultSet *
zeitgeist_result_set_iterator (ZeitgeistResultSet *self);

Do not use this method! It is only for use by Vala.

Parameters

self

the ZeitgeistResultSet instance

 

Types and Values

ZeitgeistResultSet

typedef struct _ZeitgeistResultSet ZeitgeistResultSet;

Cursor-like interface for results sets

include: zeitgeist.h

Interface for results returned by zeitgeist_log_find_events(), zeitgeist_log_get_events(), and zeitgeist_index_search().

This interface utilizes a cursor-like metaphor. You advance the cursor by calling zeitgeist_result_set_next() or adjust it manually by calling zeitgeist_result_set_seek().

Calling zeitgeist_result_set_next() will also return the event at the current cursor position. You may retrieve the current event without advancing the cursor by calling zeitgeist_result_set_peek().


struct ZeitgeistResultSetIface

struct ZeitgeistResultSetIface {
	GTypeInterface parent_iface;
	guint (*size) (ZeitgeistResultSet* self);
	guint (*estimated_matches) (ZeitgeistResultSet* self);
	ZeitgeistEvent* (*next_value) (ZeitgeistResultSet* self);
	gboolean (*has_next) (ZeitgeistResultSet* self);
	guint (*tell) (ZeitgeistResultSet* self);
	void (*reset) (ZeitgeistResultSet* self);
};

Interface for creating ZeitgeistResultSet implementations.

Members

GTypeInterface parent_iface;

the parent interface structure

 

size ()

virtual method called by zeitgeist_result_set_size()

 

estimated_matches ()

virtual method called by zeitgeist_result_set_estimated_matches()

 

next_value ()

virtual method called by zeitgeist_result_set_next_value()

 

has_next ()

virtual method called by zeitgeist_result_set_has_next()

 

tell ()

virtual method called by zeitgeist_result_set_tell()

 

reset ()

virtual method called by zeitgeist_result_set_reset()