vfs: check userland buffers before reading them.
[haiku.git] / src / apps / installer / ProgressReporter.h
blob6d20d47925919907fa537b715b742d1a09fe4aff
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 PROGRESS_REPORTER_H
6 #define PROGRESS_REPORTER_H
9 #include <Messenger.h>
12 class ProgressReporter {
13 public:
14 ProgressReporter(const BMessenger& messenger,
15 BMessage* message);
16 virtual ~ProgressReporter();
18 void Reset();
20 void AddItems(uint64 count, off_t bytes);
22 void StartTimer();
24 void ItemsWritten(uint64 items, off_t bytes,
25 const char* itemName,
26 const char* targetFolder);
28 // TODO: Perhaps move cancelling here as well...
30 private:
31 void _UpdateProgress(const char* itemName,
32 const char* targetFolder);
34 private:
35 bigtime_t fStartTime;
37 off_t fBytesToWrite;
38 off_t fBytesWritten;
40 uint64 fItemsToWrite;
41 uint64 fItemsWritten;
43 BMessenger fMessenger;
44 BMessage* fMessage;
48 #endif // PROGRESS_REPORTER_H