Panda3D
Public Member Functions | Static Public Member Functions | List of all members
PNMFileTypeRegistry Class Reference

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

#include "pnmFileTypeRegistry.h"

Public Member Functions

int get_num_types () const
 Returns the total number of types registered. More...
 
PNMFileTypeget_type (int n) const
 Returns the nth type registered. More...
 
PNMFileTypeget_type_by_handle (TypeHandle handle) const
 Returns the PNMFileType instance stored in the registry for the given TypeHandle, e.g. More...
 
PNMFileTypeget_type_from_extension (const string &filename) const
 Tries to determine what the PNMFileType is likely to be for a particular image file based on its extension. More...
 
PNMFileTypeget_type_from_magic_number (const 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...
 
 MAKE_SEQ (get_types, get_num_types, get_type)
 
void register_type (PNMFileType *type)
 Defines a new PNMFileType in the universe. More...
 
void write (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 PNMFileTypeRegistryget_global_ptr ()
 Returns a pointer to the global PNMFileTypeRegistry object. More...
 

Detailed Description

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

Definition at line 31 of file pnmFileTypeRegistry.h.

Member Function Documentation

◆ get_global_ptr()

PNMFileTypeRegistry * PNMFileTypeRegistry::get_global_ptr ( )
static

◆ get_num_types()

int PNMFileTypeRegistry::get_num_types ( ) const

Returns the total number of types registered.

Definition at line 98 of file pnmFileTypeRegistry.cxx.

References get_type().

Referenced by register_type().

◆ get_type()

PNMFileType * PNMFileTypeRegistry::get_type ( int  n) const

Returns the nth type registered.

Definition at line 111 of file pnmFileTypeRegistry.cxx.

References get_type_from_extension().

Referenced by get_num_types().

◆ get_type_by_handle()

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 218 of file pnmFileTypeRegistry.cxx.

References write().

Referenced by get_type_from_magic_number(), and PNMFileTypePfm::register_with_read_factory().

◆ get_type_from_extension()

PNMFileType * PNMFileTypeRegistry::get_type_from_extension ( const 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 125 of file pnmFileTypeRegistry.cxx.

References get_type_from_magic_number().

Referenced by AssimpLoader::build_graph(), ProgramBase::get_exec_command(), TexturePool::get_texture_type(), get_type(), PNMImageHeader::make_reader(), PNMImageHeader::make_writer(), x11GraphicsWindow::set_properties_now(), and TexturePool::write_texture_types().

◆ get_type_from_magic_number()

PNMFileType * PNMFileTypeRegistry::get_type_from_magic_number ( const 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 192 of file pnmFileTypeRegistry.cxx.

References get_type_by_handle(), PNMFileType::has_magic_number(), and PNMFileType::matches_magic_number().

Referenced by get_type_from_extension().

◆ register_type()

void PNMFileTypeRegistry::register_type ( PNMFileType type)

Defines a new PNMFileType in the universe.

Definition at line 52 of file pnmFileTypeRegistry.cxx.

References PNMFileType::get_extension(), PNMFileType::get_num_extensions(), and get_num_types().

◆ write()

void PNMFileTypeRegistry::write ( 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 235 of file pnmFileTypeRegistry.cxx.

References PNMFileType::get_extension(), get_global_ptr(), and PNMFileType::get_num_extensions().

Referenced by ProgramBase::get_exec_command(), get_type_by_handle(), TxaFile::write(), and TexturePool::write_texture_types().


The documentation for this class was generated from the following files: