source: other-projects/trunk/gsinstaller/fileCopier.h@ 15927

Last change on this file since 15927 was 15927, checked in by anna, 14 years ago

The old method for checking free disk space overflows (returns a negative number) when the physical free disk space is bigger than 4G. So instead of comparing by byte, now we compare by K. The return type is also changed, from unsigned long to double.

  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1#ifndef _FILECOPIER_H_
2#include "file.h"
3#include "filePath.h"
4#include "copyProgress.h"
5#include "diskSpace.h"
6
7class fileCopyMonitor
8{
9public:
10 fileCopyMonitor() {};
11 virtual void copiedFile(string from, string to) = 0;
12 virtual void createdDir(string dirName) = 0;
13 virtual void copiedDir(string dirName) = 0;
14};
15
16class fileCopySet
17{
18private:
19 FileVector fileList;
20 FilePath sourceDir;
21 string label;
22 unsigned long dataSize;
23 unsigned long dataFiles;
24public:
25 FilePath destDir;
26 fileCopySet();
27 fileCopySet(string label, FileVector files, FilePath &from, FilePath &to);
28 char *destination(File *file);
29 unsigned long getOriginalSize();
30 unsigned long getOriginalFiles();
31 unsigned double getCopiedSize(DiskSpace &space);
32 bool ensureParent(FilePath &child, fileCopyMonitor *monitor);
33 bool copyFile(File *file, fileCopyMonitor *monitor, copyProgressBar *progressBar);
34 void copy(File *file, fileCopyMonitor *monitor, copyProgressBar *progressBar);
35 void copy(fileCopyMonitor *monitor, copyProgressBar *progressBar);
36};
37
38typedef vector<fileCopySet> fileCopySetList;
39
40class fileCopier
41{
42private:
43 fileCopySetList list;
44 unsigned long dataSize;
45 unsigned long copied;
46 unsigned long dataFiles;
47 copyProgressBar progressBar;
48 fileCopyMonitor *monitor;
49protected:
50public:
51 fileCopier::fileCopier(fileCopyMonitor *monitor, fileCopySetList &list);
52 fileCopier::fileCopier(fileCopyMonitor *monitor);
53 void fileCopier::addSet(fileCopySet &set);
54 bool checkSpace();
55 void copy();
56};
57#define _FILECOPIER_H_
58#endif
Note: See TracBrowser for help on using the repository browser.