This class maintains the set of all known PNMFileTypes in the universe. More...
#include "pnmFileTypeRegistry.h"
Public Member Functions | |
int | get_num_types () const |
PNMFileType * | get_type (int n) const |
PNMFileType * | get_type_by_handle (TypeHandle handle) const |
Returns the PNMFileType instance stored in the registry for the given TypeHandle, e.g. More... | |
PNMFileType * | get_type_from_extension (const std::string &filename) const |
Tries to determine what the PNMFileType is likely to be for a particular image file based on its extension. More... | |
PNMFileType * | get_type_from_magic_number (const std::string &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. More... | |
void | register_type (PNMFileType *type) |
Defines a new PNMFileType in the universe. More... | |
void | unregister_type (PNMFileType *type) |
Removes a PNMFileType previously passed to register_type. More... | |
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. More... | |
Static Public Member Functions | |
static PNMFileTypeRegistry * | get_global_ptr () |
Returns a pointer to the global PNMFileTypeRegistry object. More... | |
Public Attributes | |
get_num_types | |
Returns the total number of types registered. More... | |
get_type | |
Returns the nth type registered. More... | |
This class maintains the set of all known PNMFileTypes in the universe.
Definition at line 28 of file pnmFileTypeRegistry.h.
|
static |
Returns a pointer to the global PNMFileTypeRegistry object.
Definition at line 277 of file pnmFileTypeRegistry.cxx.
Referenced by TexturePool::get_texture_type(), init_libpnmimagetypes(), PNMImageHeader::make_writer(), and TexturePool::write_texture_types().
PNMFileType * PNMFileTypeRegistry::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.
Definition at line 233 of file pnmFileTypeRegistry.cxx.
PNMFileType * PNMFileTypeRegistry::get_type_from_extension | ( | const std::string & | 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.
Definition at line 147 of file pnmFileTypeRegistry.cxx.
References downcase().
Referenced by TexturePool::get_texture_type(), PNMImageHeader::make_writer(), and TexturePool::write_texture_types().
PNMFileType * PNMFileTypeRegistry::get_type_from_magic_number | ( | const std::string & | 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.
Definition at line 210 of file pnmFileTypeRegistry.cxx.
References PNMFileType::has_magic_number(), and PNMFileType::matches_magic_number().
void PNMFileTypeRegistry::register_type | ( | PNMFileType * | type | ) |
Defines a new PNMFileType in the universe.
Definition at line 47 of file pnmFileTypeRegistry.cxx.
References PNMFileType::get_num_extensions.
Referenced by init_libpnmimagetypes().
void PNMFileTypeRegistry::unregister_type | ( | PNMFileType * | type | ) |
Removes a PNMFileType previously passed to register_type.
Definition at line 94 of file pnmFileTypeRegistry.cxx.
void PNMFileTypeRegistry::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.
Definition at line 248 of file pnmFileTypeRegistry.cxx.
References PNMFileType::get_extension, PNMFileType::get_num_extensions, and indent().
Referenced by TexturePool::write_texture_types().
int PNMFileTypeRegistry::get_num_types |
Returns the total number of types registered.
Definition at line 41 of file pnmFileTypeRegistry.h.
PNMFileType * PNMFileTypeRegistry::get_type |
Returns the nth type registered.
Definition at line 41 of file pnmFileTypeRegistry.h.