Whoo!
[potpourri.git] / src / Zip / Zip.h
blob138375d34a92776977394efd9e306a465c73502d
1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
19 // NOTES:
20 // This is my oop wrapper around libzip
21 // this is just for reading, just so you don't get the wrong idea
23 #ifndef __ZIP_H
24 #define __ZIP_H
26 #include <zip.h>
28 #include <vector>
29 #include <string>
31 #include <cstdlib>
32 #include <time.h>
34 #include "../../include/plugins/media/Archive.h"
35 #include "../../include/core/common.h"
37 namespace fragrant
39 const std::string temp = "temp";
41 const int wrap = 40;
42 const int seed = time(0);
44 struct ZipWrap
46 zip* zip_data;
47 int refcount;
50 class Zip : public Archive
52 public:
53 Zip(std::string data);
54 Zip(ZipWrap* zip_datad);
55 ~Zip();
57 void setArchiveFuncs(std::map<std::string, archive_function> funcs);
59 std::string getFile(std::string source);
60 std::vector<std::string> getListing(std::string folder);
61 Directory* getDirectory(std::vector<std::string> path);
63 private:
64 std::string fetchData(std::string filename);
66 std::string temp_filename;
67 ZipWrap* zip_data;
69 std::string prefix;
71 std::map<std::string, archive_function> functions;
75 #endif