Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

FilenameUnifier Class Reference

This static class does the job of converting filenames from relative to absolute to canonical or whatever is appropriate. More...

#include <filenameUnifier.h>

List of all members.

Static Public Member Functions

void set_txa_filename (const Filename &txa_filename)
 Notes the filename the .txa file was found in.

void set_rel_dirname (const Filename &rel_dirname)
 Sets the name of the directory that texture filenames will be written relative to, when generating egg files.

Filename make_bam_filename (Filename filename)
 Returns a new filename that's made relative to the bam file itself, suitable for writing to the bam file.

Filename get_bam_filename (Filename filename)
 Returns an absolute pathname based on the given relative pathname, presumably read from the bam file and relative to the bam file.

Filename make_egg_filename (Filename filename)
 Returns a new filename that's made relative to the rel_directory, suitable for writing out within egg files.

Filename make_user_filename (Filename filename)
 Returns a new filename that's made relative to the current directory, suitable for reporting to the user.


Private Types

typedef pmap< string, string > CanonicalFilenames

Static Private Member Functions

void make_canonical (Filename &filename)
 Does the same thing as Filename::make_canonical()--it converts the filename to its canonical form--but caches the operation so that repeated calls to filenames in the same directory will tend to be faster.


Static Private Attributes

Filename _txa_filename
Filename _txa_dir
Filename _rel_dirname
CanonicalFilenames _canonical_filenames


Detailed Description

This static class does the job of converting filenames from relative to absolute to canonical or whatever is appropriate.

Its main purpose is to allow us to write relative pathnames to the bam file and turn them back into absolute pathnames on read, so that a given bam file does not get tied to absolute pathnames.

Definition at line 50 of file filenameUnifier.h.


Member Typedef Documentation

typedef pmap<string, string> FilenameUnifier::CanonicalFilenames [private]
 

Definition at line 67 of file filenameUnifier.h.


Member Function Documentation

Filename FilenameUnifier::get_bam_filename Filename  filename  )  [static]
 

Returns an absolute pathname based on the given relative pathname, presumably read from the bam file and relative to the bam file.

Definition at line 120 of file filenameUnifier.cxx.

References Filename::empty(), ExecutionEnvironment::get_cwd(), make_canonical(), and Filename::make_relative_to().

Referenced by Palettizer::write_datagram().

Filename FilenameUnifier::make_bam_filename Filename  filename  )  [static]
 

Returns a new filename that's made relative to the bam file itself, suitable for writing to the bam file.

Definition at line 101 of file filenameUnifier.cxx.

References _rel_dirname, Filename::empty(), make_canonical(), and Filename::make_relative_to().

void FilenameUnifier::make_canonical Filename filename  )  [static, private]
 

Does the same thing as Filename::make_canonical()--it converts the filename to its canonical form--but caches the operation so that repeated calls to filenames in the same directory will tend to be faster.

Also guarantees that the directory containing the filename exists by making it if it does not.

Definition at line 192 of file filenameUnifier.cxx.

Referenced by get_bam_filename(), make_bam_filename(), and set_txa_filename().

Filename FilenameUnifier::make_egg_filename Filename  filename  )  [static]
 

Returns a new filename that's made relative to the rel_directory, suitable for writing out within egg files.

Definition at line 140 of file filenameUnifier.cxx.

References _canonical_filenames, Filename::empty(), Filename::get_dirname(), Filename::make_canonical(), Filename::make_dir(), and Filename::set_dirname().

Filename FilenameUnifier::make_user_filename Filename  filename  )  [static]
 

Returns a new filename that's made relative to the current directory, suitable for reporting to the user.

Definition at line 161 of file filenameUnifier.cxx.

Referenced by ImageFile::exists(), TextureImage::is_newer_than(), and PaletteImage::unplace().

void FilenameUnifier::set_rel_dirname const Filename rel_dirname  )  [static]
 

Sets the name of the directory that texture filenames will be written relative to, when generating egg files.

This is not the directory the textures are actually written to (see set_map_dirname()), but rather is the name of some directory above that, which will be the starting point for the pathnames written to the egg files. If this is empty, the full pathnames will be written to the egg files.

Definition at line 83 of file filenameUnifier.cxx.

References _txa_dir, Filename::empty(), and Filename::make_absolute().

Referenced by Palettizer::write_datagram().

void FilenameUnifier::set_txa_filename const Filename txa_filename  )  [static]
 

Notes the filename the .txa file was found in.

This may have come from the command line, or it may have been implicitly located. This has other implications for the FilenameUnifier, particularly in locating the bam file that saves the filenameUnifier state from last session.

Definition at line 51 of file filenameUnifier.cxx.

References _rel_dirname, Filename::empty(), and make_canonical().


Member Data Documentation

FilenameUnifier::CanonicalFilenames FilenameUnifier::_canonical_filenames [static, private]
 

Definition at line 30 of file filenameUnifier.cxx.

Referenced by make_egg_filename().

Filename FilenameUnifier::_rel_dirname [static, private]
 

Definition at line 28 of file filenameUnifier.cxx.

Referenced by make_bam_filename(), and set_txa_filename().

Filename FilenameUnifier::_txa_dir [static, private]
 

Definition at line 27 of file filenameUnifier.cxx.

Referenced by set_rel_dirname().

Filename FilenameUnifier::_txa_filename [static, private]
 

Definition at line 26 of file filenameUnifier.cxx.


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:26:33 2003 for Panda-Tool by doxygen1.3