2 * Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT License.
11 #include <Messenger.h>
14 #include "CommandPipe.h"
16 #include "HashString.h"
18 class ProgressReporter
;
21 class UnzipEngine
: private BCommandPipe::LineReader
{
23 UnzipEngine(ProgressReporter
* reporter
,
24 sem_id cancelSemaphore
= -1);
25 virtual ~UnzipEngine();
27 status_t
SetTo(const char* pathToPackage
,
28 const char* destinationFolder
);
30 inline off_t
BytesToUncompress() const
31 { return fBytesToUncompress
; }
32 inline uint64
ItemsToUncompress() const
33 { return fItemsToUncompress
; }
35 status_t
UnzipPackage();
38 // BCommandPipe::LineReader
39 friend class BCommandPipe
;
41 virtual bool IsCanceled();
42 virtual status_t
ReadLine(const BString
& line
);
44 status_t
_ReadLineListing(const BString
& line
);
45 status_t
_ReadLineExtract(const BString
& line
);
47 void _UpdateProgress(const char* item
,
48 const char* targetFolder
);
52 BString fDestinationFolder
;
53 bool fRetrievingListing
;
55 typedef HashMap
<HashString
, off_t
> EntrySizeMap
;
56 EntrySizeMap fEntrySizeMap
;
58 off_t fBytesToUncompress
;
59 off_t fBytesUncompressed
;
60 off_t fLastBytesUncompressed
;
61 uint64 fItemsToUncompress
;
62 uint64 fItemsUncompressed
;
63 uint64 fLastItemsUncompressed
;
65 ProgressReporter
* fProgressReporter
;
66 sem_id fCancelSemaphore
;
70 #endif // UNZIP_ENGINE_H