summaryrefslogtreecommitdiff
path: root/zen/file_traverser.h
blob: c57b7d36091962083595d493527b89f1d7e753d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// *****************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under    *
// * GNU General Public License: https://www.gnu.org/licenses/gpl-3.0          *
// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
// *****************************************************************************

#ifndef FILER_TRAVERSER_H_127463214871234
#define FILER_TRAVERSER_H_127463214871234

#include <functional>
#include "file_error.h"
#include "file_path.h"

namespace zen
{
struct FileInfo
{
    Zstring itemName;
    Zstring fullPath;
    uint64_t fileSize = 0; //[bytes]
    time_t modTime = 0; //number of seconds since Jan. 1st 1970 GMT
};

struct FolderInfo
{
    Zstring itemName;
    Zstring fullPath;
};

struct SymlinkInfo
{
    Zstring itemName;
    Zstring fullPath;
    time_t modTime = 0; //number of seconds since Jan. 1st 1970 GMT
};

//- non-recursive
void traverseFolder(const Zstring& dirPath,
                    const std::function<void(const FileInfo&    fi)>& onFile,  /*optional*/
                    const std::function<void(const FolderInfo&  fi)>& onFolder,/*optional*/
                    const std::function<void(const SymlinkInfo& si)>& onSymlink/*optional*/); //throw FileError
}

#endif //FILER_TRAVERSER_H_127463214871234
bgstack15