FUtils/FUFileManager.h

00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     Based on the FS Import classes:
00007     Copyright (C) 2005-2006 Feeling Software Inc
00008     Copyright (C) 2005-2006 Autodesk Media Entertainment
00009     MIT License: http://www.opensource.org/licenses/mit-license.php
00010 */
00011 
00012 #ifndef _FU_FILE_MANAGER_H_
00013 #define _FU_FILE_MANAGER_H_
00014 
00015 class FUFile;
00016 
00017 class FCOLLADA_EXPORT FUFileManager
00018 {
00019 private:
00020     FStringList pathStack;
00021 
00022 public:
00023     FUFileManager();
00024     ~FUFileManager();
00025 
00026     // Root path stack
00027     const fstring& GetCurrentPath() { return pathStack.back(); }
00028     void PushRootPath(const fstring& path);
00029     void PopRootPath();
00030     void PushRootFile(const fstring& filename);
00031     void PopRootFile();
00032 
00033     // Some file access
00034     FUFile* OpenFile(const fstring& filename, bool write=true);
00035 
00036     // Extract information from filenames
00037     static fstring StripFileFromPath(const fstring& filename);
00038     static fstring GetFileExtension(const fstring& filename);
00039 
00040     // Make a file path relative/absolute
00041     fstring MakeFilePathAbsolute(const fstring& filePath);
00042     fstring MakeFilePathRelative(const fstring& filePath);
00043 
00044     // Transform a file URL into a file path
00045     fstring GetFilePath(const fstring& fileURL);
00046 
00047     // Transform a file path into a file URL
00048     fstring GetFileURL(const fstring& filepath, bool relative);
00049 
00050     // For a relative path, extract the list of the individual paths that must be traversed to get to the file.
00051     static void ExtractPathStack(const fstring& filename, FStringList& list, bool includeFilename);
00052 };
00053 
00054 #endif // _FU_FILE_MANAGER_H_
00055 

Generated on Fri May 12 16:44:39 2006 for FCollada by  doxygen 1.4.6-NO