Re: Operation options (filtering, sorting and more)



On Tue, 2011-03-15 at 16:43 +0100, Iago Toral Quiroga wrote:
> > Juan's branch have them merged, but I feel this makes some structure
> > members, and some APIs have names that aren't as simple and obvious
> as
> > they could.
> 
> Since I have not looked at the code this explanation is a bit too
> abstract for me to align with one option or the other, can you or juan
> drop a couple of significant examples here? 

Sure.

Firstly note that I will only refer to filtering, and I was focusing on
this work.

The GrlFilter API is divided in two kinds:

- One for handling filter capabilities (that is, what the source is able
to do)

- Another for handling the options itself (that is, what the client
demands).

So the API I have is:

/* Set source capabilities */
void grl_filter_caps_set_type (GrlFilter *filter,
                               GrlFilterTypeFilter type);

void grl_filter_caps_set_keys (GrlFilter *filter,
                               GList *keys);

/* Check source capabilites */
gboolean grl_filter_caps_type (GrlFilter *filter,
                               GrlFilterTypeFilter type);

gboolean grl_filter_caps_key (GrlFilter *filter,
                              GrlKeyID key);

gboolean grl_filter_caps_supports_type (GrlFilter *filter);

gboolean grl_filter_caps_supports_key (GrlFilter *filter);

/* Set options */
void grl_filter_set_type (GrlFilter *filter,
                          GrlFilterTypeFilter type);

void grl_filter_set_key_string (GrlFilter *filter,
                                GrlKeyID key,
                                const gchar *value);

void grl_filter_set_key_int (GrlFilter *filter,
                             GrlKeyID key,
                             gint value);

void
grl_filter_set_key_valist (GrlFilter *filter,
                           va_list args);

void
grl_filter_set_key (GrlFilter *filter,
                    ...);

/* Check options */
gboolean grl_filter_supports_type (GrlFilter *filter,
                                   GrlFilterTypeFilter type);

GList *grl_filter_get_keys (GrlFilter *filter);

gboolean grl_filter_supports_key_string (GrlFilter *filter,
                                         GrlKeyID key,
                                         gchar **value);

gboolean grl_filter_supports_key (GrlFilter *filter,
                                  ...);

gboolean grl_filter_validate (GrlFilter *filter,
                              GError **error);




Some of the functions are used by clients, while other functions are
used by plugins, to check what users want.


	J.A.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]