diff options
Diffstat (limited to 'CPP/7zip/UI/Common/DirItem.h')
-rw-r--r-- | CPP/7zip/UI/Common/DirItem.h | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/CPP/7zip/UI/Common/DirItem.h b/CPP/7zip/UI/Common/DirItem.h index ce48b582..4286b4e8 100644 --- a/CPP/7zip/UI/Common/DirItem.h +++ b/CPP/7zip/UI/Common/DirItem.h @@ -11,6 +11,38 @@ #include "../../Archive/IArchive.h" +struct CDirItemsStat +{ + UInt64 NumDirs; + UInt64 NumFiles; + UInt64 NumAltStreams; + UInt64 FilesSize; + UInt64 AltStreamsSize; + + UInt64 NumErrors; + // UInt64 GetTotalItems() const { return NumDirs + NumFiles + NumAltStreams; } + + UInt64 GetTotalBytes() const { return FilesSize + AltStreamsSize; } + + CDirItemsStat(): + NumDirs(0), + NumFiles(0), + NumAltStreams(0), + FilesSize(0), + AltStreamsSize(0), + NumErrors(0) + {} +}; + +#define INTERFACE_IDirItemsCallback(x) \ + virtual HRESULT ScanError(const FString &path, DWORD systemError) x; \ + virtual HRESULT ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir) x; \ + +struct IDirItemsCallback +{ + INTERFACE_IDirItemsCallback(=0) +}; + struct CDirItem { UInt64 Size; @@ -46,7 +78,7 @@ class CDirItems UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const; - void EnumerateDir(int phyParent, int logParent, const FString &phyPrefix); + HRESULT EnumerateDir(int phyParent, int logParent, const FString &phyPrefix); public: CObjectVector<CDirItem> Items; @@ -54,26 +86,14 @@ public: bool SymLinks; bool ScanAltStreams; - FStringVector ErrorPaths; - CRecordVector<DWORD> ErrorCodes; - UInt64 TotalSize; - + + CDirItemsStat Stat; #ifndef UNDER_CE - void SetLinkInfo(CDirItem &dirItem, const NWindows::NFile::NFind::CFileInfo &fi, + HRESULT SetLinkInfo(CDirItem &dirItem, const NWindows::NFile::NFind::CFileInfo &fi, const FString &phyPrefix); #endif - void AddError(const FString &path, DWORD errorCode) - { - ErrorCodes.Add(errorCode); - ErrorPaths.Add(path); - } - - void AddError(const FString &path) - { - AddError(path, ::GetLastError()); - } #if defined(_WIN32) && !defined(UNDER_CE) @@ -82,19 +102,30 @@ public: bool _saclEnabled; bool ReadSecure; - void AddSecurityItem(const FString &path, int &secureIndex); + HRESULT AddSecurityItem(const FString &path, int &secureIndex); #endif + IDirItemsCallback *Callback; + CDirItems(); - int GetNumFolders() const { return Prefixes.Size(); } - UString GetPhyPath(unsigned index) const; + void AddDirFileInfo(int phyParent, int logParent, int secureIndex, + const NWindows::NFile::NFind::CFileInfo &fi); + + HRESULT AddError(const FString &path, DWORD errorCode); + HRESULT AddError(const FString &path); + + HRESULT ScanProgress(const FString &path); + + // unsigned GetNumFolders() const { return Prefixes.Size(); } + FString GetPhyPath(unsigned index) const; UString GetLogPath(unsigned index) const; unsigned AddPrefix(int phyParent, int logParent, const UString &prefix); void DeleteLastPrefix(); - void EnumerateItems2( + + HRESULT EnumerateItems2( const FString &phyPrefix, const UString &logPrefix, const FStringVector &filePaths, |