Original Source for 1.13 Mod High Resolution version from 12/06/05

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@21 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2006-04-19 11:32:51 +00:00
commit e54aeb96aa
790 changed files with 741287 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
//
// Snap: Declaration of the TFileCat class
//
// This class catalogues files in a directory and all its subdirectories
//
#ifndef FILECAT_H
#define FILECAT_H
#include "stringicmp.h"
#include <string>
#include <set>
class TFileCat {
public:
TFileCat(std::string root) { NewCat(root); }
TFileCat() {}
// Build a new file catalogue by recursively traversing the root directory
void NewCat(std::string root);
std::string GetRootDir() const { return fRootDir; }
// Look for a given file in the catalogue
// Unless pathIncludesRoot == true, will prepend the root directory to path
bool FindFile(std::string path, bool pathIncludesRoot = false) const;
// Delete a given file from the catalogue
// Unless pathIncludesRoot == true, will prepend the root directory to path
size_t RemoveFile(std::string path, bool pathIncludesRoot = false);
// Delete all files from a given directory in the catalogue
// Unless pathIncludesRoot == true, will prepend the root directory to path
size_t RemoveDir(std::string dir, bool pathIncludesRoot = false);
private:
typedef std::set<std::string, TStringiLess> TCatalogue;
std::string fRootDir;
TCatalogue fFileCat;
// Recursively traverse a directory, adding regular files to the catalogue
void TraverseDir(std::string dir, int depth = -1);
};
#endif // FILECAT_H