Panda3D

Loading...
Searching...
No Matches
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
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.
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.
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.
void | register_type (PNMFileType *type)
| Defines a new PNMFileType in the universe.
void | unregister_type (PNMFileType *type)
| Removes a PNMFileType previously passed to register_type.
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.

## Static Public Member Functions
static PNMFileTypeRegistry * | get_global_ptr ()
| Returns a pointer to the global PNMFileTypeRegistry object.

## Public Attributes
| get_num_types
| Returns the total number of types registered.
| get_type
| Returns the nth type registered.

## Detailed Description

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

Definition at line 28 of file pnmFileTypeRegistry.h.

## Constructor & Destructor Documentation

## ◆ ~PNMFileTypeRegistry()

PNMFileTypeRegistry::~PNMFileTypeRegistry | ( |  | ) |

Definition at line 39 of file pnmFileTypeRegistry.cxx.

## Member Function Documentation

## ◆ get_global_ptr()

PNMFileTypeRegistry * PNMFileTypeRegistry::get_global_ptr | ( |  | ) |
| static

Returns a pointer to the global PNMFileTypeRegistry object.

Definition at line 276 of file pnmFileTypeRegistry.cxx.

Referenced by TexturePool::get_texture_type(), init_libpnmimagetypes(), PNMImageHeader::make_reader(), PNMImageHeader::make_writer(), and TexturePool::write_texture_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 232 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 146 of file pnmFileTypeRegistry.cxx.

References downcase().

Referenced by TexturePool::get_texture_type(), PNMImageHeader::make_reader(), 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 209 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 46 of file pnmFileTypeRegistry.cxx.

References downcase(), PNMFileType::get_extension, and 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 93 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 247 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:

- panda/src/pnmimage/pnmFileTypeRegistry.h
- panda/src/pnmimage/pnmFileTypeRegistry.cxx