btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / installer / UnzipEngine.h
blob36eafdcc1a63b0ccebdd178ce66825f422367a08
1 /*
2 * Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5 #ifndef UNZIP_ENGINE_H
6 #define UNZIP_ENGINE_H
9 #include <stdio.h>
11 #include <Messenger.h>
12 #include <String.h>
14 #include "CommandPipe.h"
15 #include "HashMap.h"
16 #include "HashString.h"
18 class ProgressReporter;
21 class UnzipEngine : private BCommandPipe::LineReader {
22 public:
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();
37 private:
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);
50 private:
51 BString fPackage;
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