| 29 | using TCompare = int (*)(const FTSENT**, const FTSENT**); |
| 30 | |
| 31 | struct TOptions { |
| 32 | inline TOptions() { |
| 33 | Init(FTS_PHYSICAL); |
| 34 | } |
| 35 | |
| 36 | inline TOptions(int opts) { |
| 37 | Init(opts); |
| 38 | } |
| 39 | |
| 40 | inline TOptions& SetMaxLevel(size_t level) noexcept { |
| 41 | MaxLevel = level; |
| 42 | |
| 43 | return *this; |
| 44 | } |
| 45 | |
| 46 | inline TOptions& SetSortFunctor(TCompare cmp) noexcept { |
| 47 | Cmp = cmp; |
| 48 | |
| 49 | return *this; |
| 50 | } |
| 51 | |
| 52 | TOptions& SetSortByName() noexcept; |
| 53 | |
| 54 | int FtsOptions; |
| 55 | size_t MaxLevel; |
| 56 | TCompare Cmp; |
| 57 | |
| 58 | private: |
| 59 | inline void Init(int opts) noexcept { |
| 60 | FtsOptions = opts | FTS_NOCHDIR; |
| 61 | MaxLevel = Max<size_t>(); |
| 62 | Cmp = nullptr; |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | inline TDirIterator(const TString& path, const TOptions& options = TOptions()) |
| 67 | : Options_(options) |
no outgoing calls