diff options
Diffstat (limited to 'shared/fileTraverser.h')
-rw-r--r-- | shared/fileTraverser.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/shared/fileTraverser.h b/shared/fileTraverser.h index f765bb5b..b9cd3ff1 100644 --- a/shared/fileTraverser.h +++ b/shared/fileTraverser.h @@ -8,8 +8,6 @@ #define FILETRAVERSER_H_INCLUDED #include "zstring.h" -#include <set> -#include <memory> #include <wx/longlong.h> #include "loki/TypeManip.h" @@ -22,16 +20,17 @@ class TraverseCallback public: virtual ~TraverseCallback() {} - enum ReturnValue + struct FileInfo { - TRAVERSING_STOP, - TRAVERSING_CONTINUE + wxULongLong fileSize; //unit: bytes! + wxLongLong lastWriteTimeRaw; //number of seconds since Jan. 1st 1970 UTC }; - struct FileInfo + struct SymlinkInfo { - wxULongLong fileSize; //unit: bytes! wxLongLong lastWriteTimeRaw; //number of seconds since Jan. 1st 1970 UTC + Zstring targetPath; //may be empty if something goes wrong + bool dirLink; //"true": point to dir; "false": point to file (or broken Link on Linux) }; class ReturnValDir @@ -39,29 +38,30 @@ public: public: enum ReturnValueEnh { - TRAVERSING_DIR_STOP, TRAVERSING_DIR_IGNORE, TRAVERSING_DIR_CONTINUE }; - ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_STOP>) : returnCode(TRAVERSING_DIR_STOP), subDirCb(NULL) {} 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) {} - const ReturnValueEnh returnCode; TraverseCallback* const subDirCb; }; //overwrite these virtual methods - virtual ReturnValue onError(const wxString& errorText) = 0; - virtual ReturnValue onFile(const DefaultChar* shortName, const Zstring& fullName, bool isSymlink, const FileInfo& details) = 0; - virtual ReturnValDir onDir(const DefaultChar* shortName, const Zstring& fullName, bool isSymlink) = 0; + 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; }; //custom traverser with detail information about files //directory may end with PATH_SEPARATOR -void traverseFolder(const Zstring& directory, TraverseCallback* sink); //throw() +void traverseFolder(const Zstring& directory, bool followSymlinks, TraverseCallback* sink); //throw(); +//followSymlinks: +//"true": Symlinks dereferenced and reported via onFile() and onDir() => onSymlink not used! +//"false": Symlinks directly reported via onSymlink() } #endif // FILETRAVERSER_H_INCLUDED |