[Igarden-commit] CommonSource/YAAFExtensions RGZipFile.cpp, 1.1.2.1, 1.1.2.2 RGZipFile.h, 1.1.2.1,
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-12-07 01:24:01
|
Update of /cvsroot/igarden/CommonSource/YAAFExtensions In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv26217 Modified Files: Tag: Release_branch_v1 RGZipFile.cpp RGZipFile.h Log Message: Save and restore aerial view pictures (with preference) Index: RGZipFile.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/Attic/RGZipFile.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** RGZipFile.cpp 2 Dec 2006 05:19:23 -0000 1.1.2.1 --- RGZipFile.cpp 7 Dec 2006 01:23:59 -0000 1.1.2.2 *************** *** 30,33 **** --- 30,34 ---- #include "RGDateTime.h" #include "RGDateTime.h" + #include "cistring.h" // --------------------------------------------------------------------------- *************** *** 139,142 **** --- 140,217 ---- // --------------------------------------------------------------------------- + /// FirstSubFileMatching + // + bool RGZipFile::FirstSubFileMatching(const char *szFileName) + { + bool valid = false, found = false; + char name[256]; + + MyAssert(_unzf != NULL); + valid = unzGoToFirstFile(_unzf) != UNZ_END_OF_LIST_OF_FILE; + while(!found && valid) + { + unzGetCurrentFileInfo(_unzf, NULL, name, sizeof(name), NULL, 0, NULL, 0); + if(CIstrncmp(name, szFileName, strlen(szFileName)) == 0) + found = true; + else + valid = unzGoToNextFile(_unzf) != UNZ_END_OF_LIST_OF_FILE; + } + + if(valid) + unzOpenCurrentFile(_unzf); + + return valid; + } + + + // --------------------------------------------------------------------------- + /// NextSubFileMatching + // + bool RGZipFile::NextSubFileMatching(const char *szFileName) + { + bool valid = false, found = false; + char name[256]; + + MyAssert(_unzf != NULL); + CloseSubFile(); + + valid = unzGoToNextFile(_unzf) != UNZ_END_OF_LIST_OF_FILE; + while(!found && valid) + { + unzGetCurrentFileInfo(_unzf, NULL, name, sizeof(name), NULL, 0, NULL, 0); + if(CIstrncmp(name, szFileName, strlen(szFileName)) == 0) + found = true; + else + valid = unzGoToNextFile(_unzf) != UNZ_END_OF_LIST_OF_FILE; + } + + if(valid) + unzOpenCurrentFile(_unzf); + + return valid; + } + + // --------------------------------------------------------------------------- + /// CurrentSubFileName + // + void RGZipFile::CurrentSubFileName(String &str) + { + char name[256]; + unzGetCurrentFileInfo(_unzf, NULL, name, sizeof(name), NULL, 0, NULL, 0); + str.SetCString(name); + } + + // --------------------------------------------------------------------------- + /// CurrentSubFileLen + // + long RGZipFile::CurrentSubFileLen() + { + unz_file_info fileInfo; + unzGetCurrentFileInfo(_unzf, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + return fileInfo.uncompressed_size; + } + + + // --------------------------------------------------------------------------- /// CreateSubFile // Index: RGZipFile.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/Attic/RGZipFile.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** RGZipFile.h 2 Dec 2006 05:19:23 -0000 1.1.2.1 --- RGZipFile.h 7 Dec 2006 01:23:59 -0000 1.1.2.2 *************** *** 34,37 **** --- 34,38 ---- #include "unzip.h" #include "XGFile.h" + #include "RGString.h" using namespace yaaf; *************** *** 67,70 **** --- 68,75 ---- void CreateSubFile(const char *szFileName, ZipCompressionMethod_t method = kDefaultCompression); void CloseSubFile(); + bool FirstSubFileMatching(const char *szFileName); + bool NextSubFileMatching(const char *szFileName); + void CurrentSubFileName(String &str); + long CurrentSubFileLen(); private: |