VIPER REFERENCE MANUAL


NAME
iflDatabase - access to image file format database

HEADER FILE
#include <ifl/iflDatabase.h>

PUBLIC METHOD SUMMARY

   Format Lookup
static iflDatabase* findNext ( int& index);
static iflDatabase* findByMagic ( int fd);
static iflDatabase* findByFormatName ( const char* formatName);
static iflDatabase* findByFileName ( const char* fileName, int noMatchRule=TRUE);

   Attribute queries
const char* getName (  );
const char* getDefaultSuffix (  );
const char* getDescription (  );

   Capabilities of the format
int accessModeIsSupported ( int mode);

   DSO and inst related info
const char* getDSOName (  );
const char* getInstSubSystem (  );

   Conversion to iflFormat
iflFormat* getFormat ( int openDSOifNecessary=TRUE);

CLASS DESCRIPTION
iflDatabase is a lightweight version of the iflFormat class, with abbreviated functionality. Basically, the information here is what can be obtained from variables in the file format database without opening the specific DSO. Looking up an object of this class will never cause a DSO to be opened. The intended use is by apps who know they only need the restricted methods provided here.

Refer to iflFormat(3) for more detail on iflFormat functionality.

METHOD DESCRIPTIONS

   accessModeIsSupported()
int accessModeIsSupported ( int mode);

This member function tells whether the given access mode (which must be one of O_RDONLY, O_WRONLY, or O_RDWR) is supported by the subclass.

   findByFileName()
static iflDatabase* findByFileName ( const char* fileName, int noMatchRule=TRUE);

This static class member function is used to look up an image file format by file name, where the file name is given by the fileName argument. This is accomplished by matching the tail end of fileName against each value of the suffixes variable given for each image file format in the FTR database. The noMatchRule argument can be used to limit searching to those formats that have no match rule.

   findByFormatName()
static iflDatabase* findByFormatName ( const char* formatName);

This static class member function is used to look up an image file format by name, where the name is given by the formatName argument.

   findByMagic()
static iflDatabase* findByMagic ( int fd);

This static class member function is used to look up an image file format by magic number of a given file that is open for reading with the file descriptor, fd.

   findNext()
static iflDatabase* findNext ( int& index);

This static class member function is used to step through the (static, lazily created) list of supported file formats.

To start searching initialize the index paramter to zero. It will be automatically updated by each call so that successive calls will iterate through all available formats. If there are no more formats, the function returns NULL.

The following example prints the names of all supported formats:
    iflDatabase *db;
    int index = 0;
    while ((db = iflDatabase::findNext(index)) != NULL)
        printf("%s\n", db->getName());

   getDSOName()
const char* getDSOName (  );

This member function returns the 'soname' for the DSO that implements this format (used internally to pass to dlopen()).

   getDefaultSuffix()
const char* getDefaultSuffix (  );

This member function returns the default filename suffix (the first suffix listed in the suffixes declaration for a format in the IFL format database). The returned value is a pointer to a static string that is valid forever. Note that the returned value may be NULL.

   getDescription()
const char* getDescription (  );

This member function returns the format description, or NULL if there is none.

   getFormat()
iflFormat* getFormat ( int openDSOifNecessary=TRUE);

This method returns the full iflFormat correspnding to this iflDatabase object. This may involve some overhead the first time a particular format is accessed (opening the DSO and such).

   getInstSubSystem()
const char* getInstSubSystem (  );

This member function returns the inst sub-system that must be installed to use this format. This is used internally to format error messages.

   getName()
const char* getName (  );

This member function returns the format name, which is a pointer to a static string that is valid forever.

SEE ALSO
dlopen, iflFormat(3)