Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / bin / makeudfimage / Statistics.h
blob028a42c77f4f878a82306a451991ab7485a8e6ff
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the OpenBeOS license.
4 //
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //----------------------------------------------------------------------
8 /*! \file Statistics.h
10 BDataIO wrapper around a given attribute for a file. (declarations)
13 #ifndef _STATISTICS_H
14 #define _STATISTICS_H
16 #include <OS.h>
17 #include <string>
18 #include <SupportDefs.h>
20 std::string bytes_to_string(uint64 bytes);
22 class Statistics {
23 public:
24 Statistics();
25 void Reset();
27 time_t StartTime() const { return fStartTime; }
28 time_t ElapsedTime() const { return real_time_clock() - fStartTime; }
29 std::string ElapsedTimeString() const;
31 void AddDirectory() { fDirectories++; }
32 void AddFile() { fFiles++; }
33 void AddSymlink() { fSymlinks++; }
34 void AddAttribute() { fAttributes++; }
36 void AddDirectoryBytes(uint64 count) { fDirectoryBytes += count; }
37 void AddFileBytes(uint64 count) { fFileBytes += count; }
39 void SetImageSize(uint64 size) { fImageSize = size; }
41 uint64 Directories() const { return fDirectories; }
42 uint64 Files() const { return fFiles; }
43 uint64 Symlinks() const { return fSymlinks; }
44 uint64 Attributes() const { return fAttributes; }
46 uint64 DirectoryBytes() const { return fDirectoryBytes; }
47 uint64 FileBytes() const { return fFileBytes; }
48 std::string DirectoryBytesString() const;
49 std::string FileBytesString() const;
51 uint64 ImageSize() const { return fImageSize; }
52 std::string ImageSizeString() const;
53 private:
54 time_t fStartTime;
55 uint64 fDirectories;
56 uint64 fFiles;
57 uint64 fSymlinks;
58 uint64 fAttributes;
59 uint64 fDirectoryBytes;
60 uint64 fFileBytes;
61 uint64 fImageSize;
64 #endif // _STATISTICS_H