NAME

gffdGetCount, gffdGetMatchScore, gffdGetMatchClass, gffdGetMatchType, gffdGetMatchMIME - query the current set of possible matches

SYNOPSIS

#include <gffd/gffd.h>

int gffdGetCount(gffd_context_t ctx);
int gffdGetMatchScore(gffd_context_t ctx, int index);

const char *gffdGetMatchClass(gffd_context_t ctx, int index);
const char *gffdGetMatchType(gffd_context_t ctx, int index);
const char *gffdGetMatchMIME(gffd_context_t ctx, int index);

DESCRIPTION

gffdGetCount() returns the number of possible matches currently stored in the matching context. This could be as low as zero, meaning that there were no successful matches at all, and the file's format is unknown. Typically only the first match (which has the highest score) is queried, but applications are free to query all matches and take special action when there are multiple matches.

gffdGetMatchScore() queries the score value of the specified match. The index value ranges from 0 to (Count - 1). Score values are non-negative integers, 0 is the lowest possible score and better scores have higher values (as of writing, 150 is the highest possible score, but this value is implementation-dependent and may change).

gffdGetMatchClass() queries the class of the specified match. The class defines the overall kind of file, e.g. "image" for an image file (e.g. jpeg), "audio" for a sound file (e.g. aiff), "archive" for an archive file (e.g. tar), etc...

gffdGetMatchType() queries the type of the specified match. The type defines the specific kind of file within the class, e.g. "gif", "jpeg", "png" and "bmp" are different types belonging to the image class.

gffdGetMatchMIME() queries the MIME type of the specified match, for example "application/x-tar" for a tar archive.

RETURN VALUES

gffdGetCount() returns the number of matches on success, otherwise a negative error code.

gffdGetMatchScore() returns the score on success, otherwise a negative error code, such as GFFD_E_INVALUD if the index value is out of range.

gffdGetMatchClass() and gffdGetMatchType() return a string on success, otherwise they return NULL on error.

gffdGetMatchMIME() returns a string on success, otherwise it returns NULL on error or if the file format has no known MIME type.