File.h

Go to the documentation of this file.
00001 
00002 //Luke Lenhart (2007)
00003 //See /docs/License.txt for details on how this code may be used.
00004 
00005 #pragma once
00006 #include <string>
00007 #include <vector>
00008 
00009 namespace MPMA
00010 {
00014     class Filename
00015     {
00016     public:
00017         Filename(const std::string &filename); 
00018         inline Filename(const char *filename) { *this=Filename(std::string(filename)); } 
00019         
00020         inline operator const std::string&() const { return fname; } 
00021         
00022         inline const char* c_str() const { return fname.c_str(); } 
00023         
00024     private:
00025         std::string fname;
00026         
00027         //remove rediculousness from a filename
00028         void PurifyFilename();
00029     };
00030 
00032     class Directory
00033     {
00034     public:
00035         Directory(); 
00036         Directory(const Filename &initialPath); 
00037         
00039         bool CreateDirectory();
00040         
00042         std::vector<std::string> GetFiles() const;
00044         std::vector<std::string> GetSubDirectories() const;
00045         
00047         void StepOut();
00049         void StepInto(const std::string &subdir);
00050         
00052         inline operator const std::string&() const {return path;}
00053         
00055         inline Filename File(const std::string &fname) const {return Filename(path+"/"+fname);}
00056     
00057     private:
00058         std::string path;
00059     };
00060     
00061 } //namespace MPMA

Generated on Wed Feb 13 20:57:04 2008 for MPMA Framework by  doxygen 1.5.4