Panda3D
|
This is the base class of a family of classes that represent particular image file types that PNMImage supports. More...
#include "pnmFileType.h"
Public Member Functions | |
virtual TypeHandle | force_init_type () |
virtual string | get_extension (int n) const |
Returns the nth possible filename extension associated with this particular file type, without a leading dot. More... | |
virtual string | get_name () const =0 |
virtual int | get_num_extensions () const |
Returns the number of different possible filename extensions associated with this particular file type. More... | |
virtual string | get_suggested_extension () const |
Returns a suitable filename extension (without a leading dot) to suggest for files of this type, or empty string if no suggestions are available. More... | |
virtual TypeHandle | get_type () const |
virtual bool | has_magic_number () const |
Returns true if this particular file type uses a magic number to identify it, false otherwise. More... | |
virtual PNMReader * | make_reader (istream *file, bool owns_file=true, const string &magic_number=string()) |
Allocates and returns a new PNMReader suitable for reading from this file type, if possible. More... | |
MAKE_SEQ (get_extensions, get_num_extensions, get_extension) | |
virtual PNMWriter * | make_writer (ostream *file, bool owns_file=true) |
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible. More... | |
virtual bool | matches_magic_number (const string &magic_number) const |
Returns true if the indicated "magic number" byte stream (the initial few bytes read from the file) matches this particular file type, false otherwise. More... | |
virtual void | write_datagram (BamWriter *writer, Datagram &datagram) |
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file. More... | |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More... | |
string | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. More... | |
bool | encode_to_bam_stream (string &data, BamWriter *writer=NULL) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
virtual void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More... | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More... | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More... | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
![]() | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
Additional Inherited Members | |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
This is the base class of a family of classes that represent particular image file types that PNMImage supports.
Definition at line 35 of file pnmFileType.h.
|
virtual |
Returns the nth possible filename extension associated with this particular file type, without a leading dot.
Reimplemented in PNMFileTypePfm.
Definition at line 62 of file pnmFileType.cxx.
References get_suggested_extension().
Referenced by get_num_extensions(), get_suggested_extension(), PNMFileTypeRegistry::register_type(), and PNMFileTypeRegistry::write().
|
virtual |
Returns the number of different possible filename extensions associated with this particular file type.
Reimplemented in PNMFileTypePfm.
Definition at line 50 of file pnmFileType.cxx.
References get_extension().
Referenced by get_suggested_extension(), PNMFileTypeRegistry::register_type(), and PNMFileTypeRegistry::write().
|
virtual |
Returns a suitable filename extension (without a leading dot) to suggest for files of this type, or empty string if no suggestions are available.
Reimplemented in PNMFileTypePfm.
Definition at line 75 of file pnmFileType.cxx.
References get_extension(), get_num_extensions(), and has_magic_number().
Referenced by get_extension(), TxaLine::match_texture(), and ImageFile::set_filename().
|
virtual |
Returns true if this particular file type uses a magic number to identify it, false otherwise.
Reimplemented in PNMFileTypePfm.
Definition at line 89 of file pnmFileType.cxx.
References matches_magic_number().
Referenced by get_suggested_extension(), and PNMFileTypeRegistry::get_type_from_magic_number().
|
virtual |
Allocates and returns a new PNMReader suitable for reading from this file type, if possible.
If reading from this file type is not supported, returns NULL.
Reimplemented in PNMFileTypePfm.
Definition at line 113 of file pnmFileType.cxx.
References make_writer().
Referenced by PNMImageHeader::make_reader(), and matches_magic_number().
|
virtual |
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible.
If writing files of this type is not supported, returns NULL.
Reimplemented in PNMFileTypePfm.
Definition at line 125 of file pnmFileType.cxx.
References write_datagram().
Referenced by make_reader(), and PNMImageHeader::make_writer().
|
virtual |
Returns true if the indicated "magic number" byte stream (the initial few bytes read from the file) matches this particular file type, false otherwise.
Reimplemented in PNMFileTypePfm.
Definition at line 101 of file pnmFileType.cxx.
References make_reader().
Referenced by PNMFileTypeRegistry::get_type_from_magic_number(), and has_magic_number().
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
None of the particular PNMFileType objects store any extra data–at least, not yet–so we just define this up here to do nothing.
Reimplemented from TypedWritable.
Definition at line 159 of file pnmFileType.cxx.
Referenced by make_writer().