PNMFileTypeRegistry

class PNMFileTypeRegistry

This class maintains the set of all known PNMFileTypes in the universe.

Inheritance diagram

Inheritance diagram of PNMFileTypeRegistry

PNMFileTypeRegistry(PNMFileTypeRegistry const&) = default
static PNMFileTypeRegistry *get_global_ptr(void)

Returns a pointer to the global PNMFileTypeRegistry object.

int get_num_types(void) const

Returns the total number of types registered.

PNMFileType *get_type(int n) const

Returns the nth type registered.

PNMFileType *get_type_by_handle(TypeHandle handle) const

Returns the PNMFileType instance stored in the registry for the given TypeHandle, e.g. as retrieved by a previous call to get_type() on the type instance.

PNMFileType *get_type_from_extension(std::string const &filename) const

Tries to determine what the PNMFileType is likely to be for a particular image file based on its extension. Returns a suitable PNMFileType pointer, or NULL if no type can be determined.

PNMFileType *get_type_from_magic_number(std::string const &magic_number) const

Tries to determine what the PNMFileType is likely to be for a particular image file based on its magic number, the first two bytes read from the file. Returns a suitable PNMFileType pointer, or NULL if no type can be determined.

void write(std::ostream &out, int indent_level = 0) const

Writes a list of supported image file types to the indicated output stream, one per line.