Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | 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
 
PNMFileTypeget_type (int n) const
 
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 std::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 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 PNMFileTypeRegistryget_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...
 

Detailed Description

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

Definition at line 28 of file pnmFileTypeRegistry.h.

Member Function Documentation

◆ get_global_ptr()

PNMFileTypeRegistry * PNMFileTypeRegistry::get_global_ptr ( )
static

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

◆ get_type_from_extension()

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().

◆ get_type_from_magic_number()

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().

◆ register_type()

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().

◆ unregister_type()

void PNMFileTypeRegistry::unregister_type ( PNMFileType type)

Removes a PNMFileType previously passed to register_type.

Definition at line 94 of file pnmFileTypeRegistry.cxx.

◆ write()

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().

Member Data Documentation

◆ get_num_types

int PNMFileTypeRegistry::get_num_types

Returns the total number of types registered.

Definition at line 41 of file pnmFileTypeRegistry.h.

◆ get_type

PNMFileType * PNMFileTypeRegistry::get_type

Returns the nth type registered.

Definition at line 41 of file pnmFileTypeRegistry.h.


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