aboutsummaryrefslogtreecommitdiffstats
path: root/util/folder
diff options
context:
space:
mode:
authorkerzum <kerzum@yandex-team.ru>2022-02-10 16:49:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:33 +0300
commit9a7232babfd763ccfe827bc70e82e0f50cfd8276 (patch)
treea39808b7482c4711a80f799a7281adb36d76a13a /util/folder
parent0e68ae909d3b76a5a001a07880eb0010dec6b2ea (diff)
downloadydb-9a7232babfd763ccfe827bc70e82e0f50cfd8276.tar.gz
Restoring authorship annotation for <kerzum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder')
-rw-r--r--util/folder/path.cpp84
-rw-r--r--util/folder/path.h34
2 files changed, 59 insertions, 59 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index bfe0c67d68..ad32a522a8 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -21,10 +21,10 @@ void TFsPath::CheckDefined() const {
}
}
-bool TFsPath::IsSubpathOf(const TFsPath& that) const {
- const TSplit& split = GetSplit();
- const TSplit& rsplit = that.GetSplit();
-
+bool TFsPath::IsSubpathOf(const TFsPath& that) const {
+ const TSplit& split = GetSplit();
+ const TSplit& rsplit = that.GetSplit();
+
if (rsplit.IsAbsolute != split.IsAbsolute) {
return false;
}
@@ -34,12 +34,12 @@ bool TFsPath::IsSubpathOf(const TFsPath& that) const {
}
if (rsplit.size() >= split.size()) {
- return false;
+ return false;
}
-
+
return std::equal(rsplit.begin(), rsplit.end(), split.begin());
-}
-
+}
+
bool TFsPath::IsNonStrictSubpathOf(const TFsPath& that) const {
const TSplit& split = GetSplit();
const TSplit& rsplit = that.GetSplit();
@@ -59,12 +59,12 @@ bool TFsPath::IsNonStrictSubpathOf(const TFsPath& that) const {
return std::equal(rsplit.begin(), rsplit.end(), split.begin());
}
-TFsPath TFsPath::RelativeTo(const TFsPath& root) const {
- TSplit split = GetSplit();
- const TSplit& rsplit = root.GetSplit();
+TFsPath TFsPath::RelativeTo(const TFsPath& root) const {
+ TSplit split = GetSplit();
+ const TSplit& rsplit = root.GetSplit();
if (split.Reconstruct() == rsplit.Reconstruct()) {
- return TFsPath();
+ return TFsPath();
}
if (!this->IsSubpathOf(root)) {
@@ -74,9 +74,9 @@ TFsPath TFsPath::RelativeTo(const TFsPath& root) const {
split.erase(split.begin(), split.begin() + rsplit.size());
split.IsAbsolute = false;
- return TFsPath(split.Reconstruct());
-}
-
+ return TFsPath(split.Reconstruct());
+}
+
TFsPath TFsPath::RelativePath(const TFsPath& root) const {
TSplit split = GetSplit();
const TSplit& rsplit = root.GetSplit();
@@ -100,22 +100,22 @@ TFsPath TFsPath::RelativePath(const TFsPath& root) const {
return r.size() ? TFsPath(r) : TFsPath();
}
-TFsPath TFsPath::Parent() const {
+TFsPath TFsPath::Parent() const {
if (!IsDefined()) {
return TFsPath();
}
- TSplit split = GetSplit();
+ TSplit split = GetSplit();
if (split.size()) {
split.pop_back();
}
if (!split.size() && !split.IsAbsolute) {
- return TFsPath(".");
+ return TFsPath(".");
}
- return TFsPath(split.Reconstruct());
-}
-
-TFsPath& TFsPath::operator/=(const TFsPath& that) {
+ return TFsPath(split.Reconstruct());
+}
+
+TFsPath& TFsPath::operator/=(const TFsPath& that) {
if (!IsDefined()) {
*this = that;
@@ -127,18 +127,18 @@ TFsPath& TFsPath::operator/=(const TFsPath& that) {
TSplit split = GetSplit();
const TSplit& rsplit = that.GetSplit();
split.insert(split.end(), rsplit.begin(), rsplit.end());
- *this = TFsPath(split.Reconstruct());
- }
- return *this;
-}
-
-TFsPath& TFsPath::Fix() {
- // just normalize via reconstruction
+ *this = TFsPath(split.Reconstruct());
+ }
+ return *this;
+}
+
+TFsPath& TFsPath::Fix() {
+ // just normalize via reconstruction
TFsPath(GetSplit().Reconstruct()).Swap(*this);
- return *this;
-}
-
+ return *this;
+}
+
TString TFsPath::GetName() const {
if (!IsDefined()) {
return TString();
@@ -194,20 +194,20 @@ TFsPath::TFsPath() {
}
TFsPath::TFsPath(const TString& path)
- : Path_(path)
-{
+ : Path_(path)
+{
VerifyPath(Path_);
}
TFsPath::TFsPath(const TStringBuf path)
- : Path_(ToString(path))
-{
+ : Path_(ToString(path))
+{
VerifyPath(Path_);
-}
-
-TFsPath::TFsPath(const char* path)
- : Path_(path)
-{
+}
+
+TFsPath::TFsPath(const char* path)
+ : Path_(path)
+{
}
TFsPath TFsPath::Child(const TString& name) const {
@@ -215,7 +215,7 @@ TFsPath TFsPath::Child(const TString& name) const {
ythrow TIoException() << "child name must not be empty";
}
- return *this / name;
+ return *this / name;
}
struct TClosedir {
diff --git a/util/folder/path.h b/util/folder/path.h
index 2fb4d6b4ef..ce5a18f394 100644
--- a/util/folder/path.h
+++ b/util/folder/path.h
@@ -46,7 +46,7 @@ public:
inline const char* c_str() const {
return Path_.c_str();
- }
+ }
inline operator const TString&() const {
return Path_;
@@ -60,17 +60,17 @@ public:
return Path_ != that.Path_;
}
- TFsPath& operator/=(const TFsPath& that);
+ TFsPath& operator/=(const TFsPath& that);
friend TFsPath operator/(const TFsPath& s, const TFsPath& p) {
TFsPath ret(s);
return ret /= p;
- }
-
+ }
+
const TPathSplit& PathSplit() const;
- TFsPath& Fix();
-
+ TFsPath& Fix();
+
inline const TString& GetPath() const {
return Path_;
}
@@ -97,7 +97,7 @@ public:
* @param that - presumable parent path of this
* @return True if this is a subpath of that and false otherwise.
*/
- bool IsSubpathOf(const TFsPath& that) const;
+ bool IsSubpathOf(const TFsPath& that) const;
/**
* TFsPath("/a/b").IsNonStrictSubpathOf("/a") -> true
@@ -110,9 +110,9 @@ public:
*/
bool IsNonStrictSubpathOf(const TFsPath& that) const;
- bool IsContainerOf(const TFsPath& that) const {
- return that.IsSubpathOf(*this);
- }
+ bool IsContainerOf(const TFsPath& that) const {
+ return that.IsSubpathOf(*this);
+ }
TFsPath RelativeTo(const TFsPath& root) const; //must be subpath of root
@@ -127,11 +127,11 @@ public:
TFsPath Parent() const;
TString Basename() const {
- return GetName();
- }
+ return GetName();
+ }
TString Dirname() const {
- return Parent();
- }
+ return Parent();
+ }
TFsPath Child(const TString& name) const;
@@ -168,8 +168,8 @@ public:
inline bool Stat(TFileStat& stat) const {
stat = TFileStat(Path_.data());
- return stat.Mode;
- }
+ return stat.Mode;
+ }
bool Exists() const;
/// false if not exists
@@ -211,7 +211,7 @@ private:
/// cache
mutable TSimpleIntrusivePtr<TSplit> Split_;
};
-
+
namespace NPrivate {
inline void AppendToFsPath(TFsPath&) {
}