NAME

gffdPruneScore, gffdPruneClass, gffdPruneType, gffdPruneMIME - perform pruning operations

SYNOPSIS

#include <gffd/gffd.h>

int gffdPruneScore(gffd_context_t ctx, int score);
int gffdPruneClass(gffd_context_t ctx, const char *class);
int gffdPruneType(gffd_context_t ctx, const char *type);
int gffdPruneMIME(gffd_context_t ctx, const char *MIME);

DESCRIPTION

Pruning operations remove matches from the set of possible matches stored in the matching context. The score values of any matches that remain are unaffected.

gffdPruneScore() is the principle pruning function. It will remove all matches whose current score is less than or equal to the score given as a parameter. Typically the score parameter is 0, which will keep all matches that have a score > 0, i.e. matches which have had at least some degree of success.

gffdPruneClass() will prune all possible matches which do not belong to the specified class (e.g. "image"). This is useful if you already know what kind of file it should be (examples: an image viewer program, or a sound playing program).

gffdPruneType() will prune all possible matches which do not have the specified type. This is generally not very useful, but is provided for completeness.

gffdPruneMIME() will prune all possible matches which do not match the specified MIME type. If the given MIME type contains no `/' character, it is assumed to be a top-level domain (e.g. "text") and matching is done only on the top-level domain component of the MIME types. If the given MIME type does contain `/', it is assumed to be a full MIME type (e.g. "text/plain") and the match must be exact.

RETURN VALUES

On success, each pruning function returns zero, otherwise they return a negative error code.