diff options
author | yazevnul <[email protected]> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/folder/pathsplit.h | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/folder/pathsplit.h')
-rw-r--r-- | util/folder/pathsplit.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index c7f5d55197b..d134338e35d 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -10,7 +10,7 @@ struct TPathSplitStore: public TVector<TStringBuf> { TStringBuf Drive; bool IsAbsolute = false; - void AppendComponent(const TStringBuf comp); + void AppendComponent(const TStringBuf comp); TStringBuf Extension() const; protected: @@ -22,41 +22,41 @@ protected: }; struct TPathSplitTraitsUnix: public TPathSplitStore { - static constexpr char MainPathSep = '/'; + static constexpr char MainPathSep = '/'; inline TString Reconstruct() const { return DoReconstruct(TStringBuf("/")); } - static constexpr bool IsPathSep(const char c) noexcept { + static constexpr bool IsPathSep(const char c) noexcept { return c == '/'; } - static inline bool IsAbsolutePath(const TStringBuf path) noexcept { + static inline bool IsAbsolutePath(const TStringBuf path) noexcept { return path && IsPathSep(path[0]); } - void DoParseFirstPart(const TStringBuf part); - void DoParsePart(const TStringBuf part); + void DoParseFirstPart(const TStringBuf part); + void DoParsePart(const TStringBuf part); }; struct TPathSplitTraitsWindows: public TPathSplitStore { - static constexpr char MainPathSep = '\\'; + static constexpr char MainPathSep = '\\'; inline TString Reconstruct() const { return DoReconstruct(TStringBuf("\\")); } - static constexpr bool IsPathSep(char c) noexcept { + static constexpr bool IsPathSep(char c) noexcept { return c == '/' || c == '\\'; } - static inline bool IsAbsolutePath(const TStringBuf path) noexcept { + static inline bool IsAbsolutePath(const TStringBuf path) noexcept { return path && (IsPathSep(path[0]) || (path.size() > 1 && path[1] == ':' && IsAsciiAlpha(path[0]) && (path.size() == 2 || IsPathSep(path[2])))); } - void DoParseFirstPart(const TStringBuf part); - void DoParsePart(const TStringBuf part); + void DoParseFirstPart(const TStringBuf part); + void DoParsePart(const TStringBuf part); }; #if defined(_unix_) @@ -70,7 +70,7 @@ class TPathSplitBase: public TTraits { public: inline TPathSplitBase() = default; - inline TPathSplitBase(const TStringBuf part) { + inline TPathSplitBase(const TStringBuf part) { this->ParseFirstPart(part); } @@ -80,13 +80,13 @@ public: return *this; } - inline TPathSplitBase& ParseFirstPart(const TStringBuf part) { + inline TPathSplitBase& ParseFirstPart(const TStringBuf part) { this->DoParseFirstPart(part); return *this; } - inline TPathSplitBase& ParsePart(const TStringBuf part) { + inline TPathSplitBase& ParsePart(const TStringBuf part) { this->DoParsePart(part); return *this; @@ -110,4 +110,4 @@ using TPathSplitWindows = TPathSplitBase<TPathSplitTraitsWindows>; TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2); -TStringBuf CutExtension(const TStringBuf fileName); +TStringBuf CutExtension(const TStringBuf fileName); |