diff options
Diffstat (limited to 'shared/file_traverser.h')
-rw-r--r-- | shared/file_traverser.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/shared/file_traverser.h b/shared/file_traverser.h index d61ff1cd..61237834 100644 --- a/shared/file_traverser.h +++ b/shared/file_traverser.h @@ -33,9 +33,8 @@ public: bool dirLink; //"true": point to dir; "false": point to file (or broken Link on Linux) }; - class ReturnValDir + struct ReturnValDir { - public: enum ReturnValueEnh { TRAVERSING_DIR_IGNORE, @@ -43,7 +42,7 @@ public: }; ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_IGNORE>) : returnCode(TRAVERSING_DIR_IGNORE), subDirCb(NULL) {} - ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_CONTINUE>, TraverseCallback* subDirCallback) : returnCode(TRAVERSING_DIR_CONTINUE), subDirCb(subDirCallback) {} + ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_CONTINUE>, TraverseCallback& subDirCallback) : returnCode(TRAVERSING_DIR_CONTINUE), subDirCb(&subDirCallback) {} const ReturnValueEnh returnCode; TraverseCallback* const subDirCb; @@ -51,14 +50,28 @@ public: //overwrite these virtual methods virtual void onError(const wxString& errorText) = 0; - virtual void onFile( const DefaultChar* shortName, const Zstring& fullName, const FileInfo& details) = 0; - virtual void onSymlink( const DefaultChar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0; - virtual ReturnValDir onDir(const DefaultChar* shortName, const Zstring& fullName) = 0; + virtual void onFile( const Zchar* shortName, const Zstring& fullName, const FileInfo& details) = 0; + virtual void onSymlink( const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0; + virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) = 0; }; + +#ifdef FFS_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 +}; +#else +struct DstHackCallback; //DST hack not required on Linux +#endif + //custom traverser with detail information about files //directory may end with PATH_SEPARATOR -void traverseFolder(const Zstring& directory, bool followSymlinks, TraverseCallback* sink); //throw(); +void traverseFolder(const Zstring& directory, //throw(); + bool followSymlinks, + TraverseCallback& sink, + DstHackCallback* dstCallback = NULL); //apply DST hack if callback is supplied //followSymlinks: //"true": Symlinks dereferenced and reported via onFile() and onDir() => onSymlink not used! //"false": Symlinks directly reported via onSymlink(), directory symlinks are not followed |