1 #ifndef __ARCHIVES_HPP__ 2 #define __ARCHIVES_HPP__ 17 static int _FindConfigRef(
String const & str,
int offset,
int * length,
String * name );
27 int load(
String const & configFile );
30 bool has(
String const & name )
const {
return _rawParams.find(name) != _rawParams.end(); }
33 String get(
String const & name,
bool stripslashes =
false,
bool expand = false )
const;
44 void setRaw(
String const & name,
String const & value );
53 bool del(
String const & name );
69 void write(
Mixed const & records,
Mixed const & columnHeaders =
Mixed() );
71 void writeRecord(
Mixed const & record );
86 Mixed const & operator [] (
int iRow )
const {
return _records[iRow]; }
88 Mixed const & operator () (
int iRow,
String const & name )
const {
return _records[iRow][ _columns[name] ]; }
90 int getCount()
const {
return _records.getCount(); }
97 void read(
String const & content,
bool hasColumnHeaders =
false );
103 void _readRecord(
String const & str,
int & i,
Mixed & record );
105 void _readString(
String const & str,
int & i,
String & valStr );
111 #define ZR_OK 0x00000000 // nb. the pseudo-code zr-recent is never returned, 112 #define ZR_RECENT 0x00000001 // but can be passed to FormatZipMessage. 114 #define ZR_GENMASK 0x0000FF00 115 #define ZR_NODUPH 0x00000100 // couldn't duplicate the handle 116 #define ZR_NOFILE 0x00000200 // couldn't create/open the file 117 #define ZR_NOALLOC 0x00000300 // failed to allocate some resource 118 #define ZR_WRITE 0x00000400 // a general error writing to the file 119 #define ZR_NOTFOUND 0x00000500 // couldn't find that file in the zip 120 #define ZR_MORE 0x00000600 // there's still more data to be unzipped 121 #define ZR_CORRUPT 0x00000700 // the zipfile is corrupt or not a zipfile 122 #define ZR_READ 0x00000800 // a general error reading the file 123 #define ZR_PASSWORD 0x00001000 // we didn't get the right password to unzip the file 125 #define ZR_CALLERMASK 0x00FF0000 126 #define ZR_ARGS 0x00010000 // general mistake with the arguments 127 #define ZR_NOTMMAP 0x00020000 // tried to ZipGetMemory, but that only works on mmap zipfiles, which yours wasn't 128 #define ZR_MEMSIZE 0x00030000 // the memory size is too small 129 #define ZR_FAILED 0x00040000 // the thing was already failed when you called this function 130 #define ZR_ENDED 0x00050000 // the zip creation has already been closed 131 #define ZR_MISSIZE 0x00060000 // the indicated input file size turned out mistaken 132 #define ZR_PARTIALUNZ 0x00070000 // the file had already been partially unzipped 133 #define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip 135 #define ZR_BUGMASK 0xFF000000 136 #define ZR_NOTINITED 0x01000000 // initialisation didn't work 137 #define ZR_SEEK 0x02000000 // trying to seek in an unseekable file 138 #define ZR_NOCHANGE 0x04000000 // changed its mind on storage, but not allowed 139 #define ZR_FLATE 0x05000000 // an internal error in the de/inflation code 148 Zip(
String const & filename,
char const * password = NULL );
149 Zip(
void * buf,
uint32 size,
char const * password = NULL );
152 bool create(
String const & filename,
char const * password = NULL );
153 bool create(
void * buf,
uint32 size,
char const * password = NULL );
156 ZRESULT addFile(
String const & dstPathInZip,
String const & srcFilename );
157 ZRESULT addFile(
String const & dstPathInZip,
void * src,
uint32 size );
158 ZRESULT addFolder(
String const & dstPathInZip );
160 void zipAll(
String const & dirPath );
162 ZRESULT getMemory(
void * * buf,
unsigned long * size );
179 #if defined(__linux__) || ( defined(__GNUC__) && !defined(_WIN32) ) 180 time_t atime,ctime,mtime;
192 Unzip(
String const & filename,
char const * password = NULL );
193 Unzip(
void * zipbuf,
uint32 size,
char const * password = NULL );
196 bool open(
String const & filename,
char const * password = NULL );
197 bool open(
void * zipbuf,
uint32 size,
char const * password = NULL );
200 int getEntriesCount()
const;
202 ZRESULT getEntry(
int index,
ZipEntry * entry );
204 ZRESULT findEntry(
String const & name,
bool caseInsensitive,
int * index,
ZipEntry * entry );
206 ZRESULT unzipEntry(
int index,
String const & outFilename );
207 ZRESULT unzipEntry(
int index,
void * buf,
uint32 size );
208 void unzipAll(
String const & dirPath =
"" );
210 ZRESULT setUnzipBaseDir(
String const & dirPath );
220 #endif // __ARCHIVES_HPP__
Mixed & getColumnHeaders()
获取所有列标头
std::map< String, String > StringStringMap
#define DISABLE_OBJECT_COPY(clsname)
std::vector< String > StringArray
int getCount() const
获取读取到的记录数
Mixed & getRecords()
获取所有记录的引用,可直接操作
std::basic_string< tchar > String