summaryrefslogtreecommitdiff
path: root/zen/file_traverser.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/file_traverser.h')
-rw-r--r--zen/file_traverser.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/zen/file_traverser.h b/zen/file_traverser.h
index 13b76966..a1d8ac9e 100644
--- a/zen/file_traverser.h
+++ b/zen/file_traverser.h
@@ -7,7 +7,7 @@
#ifndef FILETRAVERSER_H_INCLUDED
#define FILETRAVERSER_H_INCLUDED
-#include <memory>
+//#include <memory>
#include "zstring.h"
#include "int64.h"
#include "file_id_def.h"
@@ -20,17 +20,18 @@ struct TraverseCallback
{
virtual ~TraverseCallback() {}
- struct FileInfo
+ struct SymlinkInfo
{
- UInt64 fileSize; //unit: bytes!
Int64 lastWriteTime; //number of seconds since Jan. 1st 1970 UTC
- FileId id; //optional: initial if not supported!
- //std::unique_ptr<SymlinkInfo> symlinkInfo; //only filled if file is dereferenced symlink
};
- struct SymlinkInfo
+ struct FileInfo
{
+ FileInfo() : symlinkInfo() {}
+ UInt64 fileSize; //unit: bytes!
Int64 lastWriteTime; //number of seconds since Jan. 1st 1970 UTC
+ FileId id; //optional: initial if not supported!
+ const SymlinkInfo* symlinkInfo; //only filled if file is a followed symlink
};
enum HandleLink
@@ -45,22 +46,24 @@ struct TraverseCallback
ON_ERROR_IGNORE
};
- virtual std::shared_ptr<TraverseCallback> //nullptr: ignore directory, non-nullptr: traverse into using the (new) callback
- /**/ onDir (const Zchar* shortName, const Zstring& fullName) = 0;
- virtual void onFile (const Zchar* shortName, const Zstring& fullName, const FileInfo& details) = 0;
- virtual HandleLink onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0;
+ virtual void onFile (const Zchar* shortName, const Zstring& fullName, const FileInfo& details) = 0;
+ virtual HandleLink onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0;
+ virtual TraverseCallback* onDir (const Zchar* shortName, const Zstring& fullName) = 0;
+ //nullptr: ignore directory, non-nullptr: traverse into using the (new) callback => implement releaseDirTraverser() if necessary!
+ virtual void releaseDirTraverser(TraverseCallback* trav) {}
+
virtual HandleError reportDirError (const std::wstring& msg) = 0; //failed directory traversal -> consider directory data as incomplete!
- virtual HandleError reportItemError(const std::wstring& msg, const Zchar* shortName) = 0; //failed to get single file/dir/symlink only!
+ virtual HandleError reportItemError(const std::wstring& msg, const Zchar* shortName) = 0; //failed to get data for single file/dir/symlink only!
};
-#ifdef FFS_WIN
+#ifdef ZEN_WIN
struct DstHackCallback
{
virtual ~DstHackCallback() {}
virtual void requestUiRefresh(const Zstring& filename) = 0; //applying DST hack imposes significant one-time performance drawback => callback to inform user
};
-#elif defined FFS_LINUX || defined FFS_MAC
+#elif defined ZEN_LINUX || defined ZEN_MAC
struct DstHackCallback; //DST hack not required on Unix
#endif
bgstack15