00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __COMPRESSED_H__
00022 #define __COMPRESSED_H__
00023
00024 #include <string>
00025 #include <list>
00026 #include <algorithm>
00027 #include "utilException.h"
00028 #include <boost/filesystem/path.hpp>
00029
00030 namespace Spm
00031 {
00032 namespace Util
00033 {
00034 class FileNotFoundException : public Exception
00035 {
00036 public :
00037 FileNotFoundException (const std::string & fileName);
00038 };
00039
00044 class Compressed
00045 {
00046 protected:
00047 boost::filesystem::path __file;
00048 std::list<std::string> files;
00049 Compressed (){};
00050 Compressed (const boost::filesystem::path & fileName);
00051
00052 public:
00053 virtual ~Compressed (){};
00054
00058 virtual bool uncompress (const boost::filesystem::path & dest) = 0;
00059
00063 const boost::filesystem::path & getName ();
00064
00070 bool have (const std::string & file);
00071
00076 virtual bool extract (const std::string & file,
00077 const boost::filesystem::path & to) = 0;
00078
00082 std::string getSubDir ();
00083
00088 const std::string & getExactName (const std::string & file)
00089 throw (FileNotFoundException);
00090 };
00091
00092 struct equalFile : public std::binary_function<std::string, std::string, bool>
00093 {
00094 bool operator() (std::string fileToFind,
00095 const std::string & file) const;
00096 };
00097 }
00098 }
00099 #endif