sprint 1-alpha
|
00001 /****************************************************************************** 00002 * sprint::xzip 00003 * 00004 * Copyright (C) 2005-2011 Paolo Medici <www.pmx.it> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 * 00020 *******************************************************************************/ 00021 00022 #ifndef _SPRINT_XFOLDER_XZIP_H 00023 #define _SPRINT_XFOLDER_XZIP_H 00024 00029 #include <sprint/io/xstream/xstream.h> 00030 #include <sprint/io/xstream/xfolder.h> 00031 00032 namespace sprint { 00033 00034 namespace io { 00036 typedef void *zipFile; 00037 00040 class xzip: public xfolder { 00041 zipFile m_zip; 00042 flag_t m_mode; 00043 00044 private: 00045 void ListFile(); 00046 00047 public: 00049 xzip(const char *file, flag_t openMode); 00050 virtual ~xzip(); 00051 00055 virtual xstream *open(const char *resource, flag_t mode); 00056 00058 // virtual bool list(callback, void *param) = 0; 00059 00061 bool IsValid() const { return m_zip!=0; } 00062 00063 /********** Direct Write ****************/ 00064 int OpenNewFileInZip(const char *name); 00065 int WriteInFileInZip(const void* buf, unsigned int len); 00066 void CloseFileInZip(); 00067 00068 /********** Direct Read ****************/ 00069 int OpenCurrentFile(); 00070 int ReadCurrentFile(void *buf, unsigned int len); 00071 void CloseCurrentFile(); 00072 00073 /********** Services ****************/ 00074 bool ReadCurFileName(char *buf, int len); 00075 bool GoToFirstFile(char * name, int len); 00076 bool GoToNextFile(char * name, int len); 00077 00078 int LocateFile(const char *name); 00079 }; 00080 00081 } // io 00082 00083 } // sprint 00084 00085 #endif