Panda3D
|
00001 // Filename: filenameUnifier.h 00002 // Created by: drose (05Dec00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef FILENAMEUNIFIER_H 00016 #define FILENAMEUNIFIER_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "filename.h" 00021 00022 #include "pmap.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : FilenameUnifier 00026 // Description : This static class does the job of converting 00027 // filenames from relative to absolute to canonical or 00028 // whatever is appropriate. Its main purpose is to 00029 // allow us to write relative pathnames to the bam file 00030 // and turn them back into absolute pathnames on read, 00031 // so that a given bam file does not get tied to 00032 // absolute pathnames. 00033 //////////////////////////////////////////////////////////////////// 00034 class FilenameUnifier { 00035 public: 00036 static void set_txa_filename(const Filename &txa_filename); 00037 static void set_rel_dirname(const Filename &rel_dirname); 00038 00039 static Filename make_bam_filename(Filename filename); 00040 static Filename get_bam_filename(Filename filename); 00041 static Filename make_egg_filename(Filename filename); 00042 static Filename make_user_filename(Filename filename); 00043 static void make_canonical(Filename &filename); 00044 00045 private: 00046 00047 static Filename _txa_filename; 00048 static Filename _txa_dir; 00049 static Filename _rel_dirname; 00050 00051 typedef pmap<string, string> CanonicalFilenames; 00052 static CanonicalFilenames _canonical_filenames; 00053 }; 00054 00055 #endif 00056