diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/folder/filelist.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/folder/filelist.h')
-rw-r--r-- | util/folder/filelist.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/util/folder/filelist.h b/util/folder/filelist.h index 8f2036e016..3f615fa4c2 100644 --- a/util/folder/filelist.h +++ b/util/folder/filelist.h @@ -1,38 +1,38 @@ #pragma once -#include <util/generic/buffer.h> +#include <util/generic/buffer.h> #include <util/generic/string.h> -#include <util/generic/strbuf.h> +#include <util/generic/strbuf.h> #include <util/generic/flags.h> -class TFileEntitiesList { +class TFileEntitiesList { public: enum EMaskFlag { - EM_FILES = 1, - EM_DIRS = 2, - EM_SLINKS = 4, + EM_FILES = 1, + EM_DIRS = 2, + EM_SLINKS = 4, EM_FILES_DIRS = EM_FILES | EM_DIRS, EM_FILES_SLINKS = EM_FILES | EM_SLINKS, EM_DIRS_SLINKS = EM_DIRS | EM_SLINKS, EM_FILES_DIRS_SLINKS = EM_FILES | EM_DIRS | EM_SLINKS - }; + }; Y_DECLARE_FLAGS(EMask, EMaskFlag) - TFileEntitiesList(EMask mask) - : Mask(mask) - { + TFileEntitiesList(EMask mask) + : Mask(mask) + { Clear(); } void Clear() { Cur = nullptr; FileNamesSize = CurName = 0; - FileNames.Clear(); - FileNames.Append("", 1); + FileNames.Clear(); + FileNames.Append("", 1); } - const char* Next() { + const char* Next() { return Cur = (CurName++ < FileNamesSize ? strchr(Cur, 0) + 1 : nullptr); } @@ -42,40 +42,40 @@ public: inline void Fill(const TString& dirname, bool sort = false) { Fill(dirname, TStringBuf(), sort); - } + } inline void Fill(const TString& dirname, TStringBuf prefix, bool sort = false) { Fill(dirname, prefix, TStringBuf(), 1, sort); - } - + } + void Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort = false); - + void Restart() { - Cur = FileNames.Data(); + Cur = FileNames.Data(); CurName = 0; } protected: - TBuffer FileNames; + TBuffer FileNames; size_t FileNamesSize, CurName; - const char* Cur; + const char* Cur; EMask Mask; }; Y_DECLARE_OPERATORS_FOR_FLAGS(TFileEntitiesList::EMask) -class TFileList: public TFileEntitiesList { +class TFileList: public TFileEntitiesList { public: - TFileList() - : TFileEntitiesList(TFileEntitiesList::EM_FILES) - { - } + TFileList() + : TFileEntitiesList(TFileEntitiesList::EM_FILES) + { + } }; -class TDirsList: public TFileEntitiesList { +class TDirsList: public TFileEntitiesList { public: - TDirsList() - : TFileEntitiesList(TFileEntitiesList::EM_DIRS) - { - } + TDirsList() + : TFileEntitiesList(TFileEntitiesList::EM_DIRS) + { + } }; |