aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/zipatch/reader.h
blob: a94bc79b713ec297cbd92deef6b8eac6227c45b4 (plain) (blame)
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
45
46
47
48
#pragma once

#include <util/folder/path.h>
#include <util/generic/ptr.h>

namespace NZipatch {

class TReader {
public:
    enum EAction {
        Unknown = 0,
        Copy,
        MkDir,
        Move,
        Remove,
        StoreFile,
    };

    struct TSource {
        TString Path;
        ui64 Revision;
    };

    struct TEvent {
        EAction Action;
        TString Path;
        TStringBuf Data;
        TSource Source;
        bool Executable;
        bool Symlink;
    };

    using TOnEvent = std::function<void(const TEvent&)>;

public:
     TReader(const TFsPath& path);
     TReader(const TStringBuf buf);
    ~TReader();

    void Enumerate(TOnEvent cb) const;

private:
    class TImpl;
    THolder<TImpl> Impl_;
};

} // namespace NZipatch