Feature #1696
plugin/Zip/UnZip: interface simplification & a little optimisation
Status: | Approved | Start date: | 04/28/2017 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Miroslav Fidler | % Done: | 0% | |
Category: | General | Spent time: | - | |
Target version: | Release 2017.2 |
Description
in the attached patch :
- update UnZip::ReadDir(): a file is added to the list only if all it's field are sets.
- add the possiblilty to load a file knowing it's path
- add search in the zip: Vector<String> UnZip::Search(String pattern)
currently, i have to do loop in each file in the zip in order to find a file knowing it's name.
while(!(unzip.IsEof() || unzip.IsError())) { if(path == unzip.GetPath())) s = unzip.ReadFile(); else unzip.SkipFile(); }
it's usefull if we add this overload:
String UnZip::ReadFile(const char* path, Gate<int, int> progress = Null) { for(int i = 0; i < file.GetCount(); i++) { if(file[i].path.IsEqual(path)) { Seek(i); return ReadFile( progress ); } } return String::GetVoid(); }
then the call will be :
s = unzip.ReadFile(path);
History
#1 Updated by Zbigniew Rebacz almost 8 years ago
Why not?
for(int i = 0; i < file.GetCount(); i++) {}
for(const auto& f : file) {}
Just small tip :)
#2 Updated by Abdelghani Omari almost 8 years ago
thanks for the tips, i will consider that in future
but here the index is used in Seek(i)
#3 Updated by Abdelghani Omari almost 8 years ago
i think we shall add abbreviations for that "fa fca fab fdab" like fi, fj fib ..
fa = for(auto& a: @)
@) {\r\n\t\r\n}
fcab = for(const auto& a:
#4 Updated by Abdelghani Omari almost 8 years ago
- File zip.patch added
- Subject changed from UnZip: allow reading file by path to plugin/Zip/UnZip: interface simplification & a little optimisation
- Description updated (diff)
- Priority changed from Low to Normal
#5 Updated by Abdelghani Omari almost 8 years ago
- File deleted (
zip.patch)
#6 Updated by Abdelghani Omari almost 8 years ago
- File zip.patch
added
#8 Updated by Zbigniew Rebacz almost 8 years ago
- Target version set to Release 2017.2