Delete unused methods on rtc::Pathname.
Deleted methods Normalize(), clear(), empty(), folder(), parent_folder().
Bug: webrtc:6424
Change-Id: I7a7096b23f4ba675305de1728988d2cfb48f135f
Reviewed-on: https://webrtc-review.googlesource.com/80520
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23623}
diff --git a/rtc_base/filerotatingstream_unittest.cc b/rtc_base/filerotatingstream_unittest.cc
index 16db280..375d9a4 100644
--- a/rtc_base/filerotatingstream_unittest.cc
+++ b/rtc_base/filerotatingstream_unittest.cc
@@ -195,10 +195,10 @@
// Tests that the returned file paths have the right folder and prefix.
TEST_F(MAYBE_FileRotatingStreamTest, GetFilePath) {
Init("FileRotatingStreamTestGetFilePath", kFilePrefix, kMaxFileSize, 20);
+ // dir_path_ includes a trailing delimiter.
+ const std::string prefix = dir_path_ + kFilePrefix;
for (auto i = 0; i < 20; ++i) {
- Pathname path(stream_->GetFilePath(i));
- EXPECT_EQ(0, path.folder().compare(dir_path_));
- EXPECT_EQ(0, path.filename().compare(0, strlen(kFilePrefix), kFilePrefix));
+ EXPECT_EQ(0, stream_->GetFilePath(i).compare(0, prefix.size(), prefix));
}
}
diff --git a/rtc_base/pathutils.cc b/rtc_base/pathutils.cc
index b85d14f..594deb7 100644
--- a/rtc_base/pathutils.cc
+++ b/rtc_base/pathutils.cc
@@ -69,24 +69,6 @@
Pathname& Pathname::operator=(const Pathname&) = default;
Pathname& Pathname::operator=(Pathname&&) = default;
-void Pathname::Normalize() {
- for (size_t i=0; i<folder_.length(); ++i) {
- if (IsFolderDelimiter(folder_[i])) {
- folder_[i] = folder_delimiter_;
- }
- }
-}
-
-void Pathname::clear() {
- folder_.clear();
- basename_.clear();
- extension_.clear();
-}
-
-bool Pathname::empty() const {
- return folder_.empty() && basename_.empty() && extension_.empty();
-}
-
std::string Pathname::pathname() const {
std::string pathname(folder_);
pathname.append(basename_);
@@ -116,22 +98,6 @@
SetFilename(filename);
}
-std::string Pathname::folder() const {
- return folder_;
-}
-
-std::string Pathname::parent_folder() const {
- std::string::size_type pos = std::string::npos;
- if (folder_.size() >= 2) {
- pos = folder_.find_last_of(FOLDER_DELIMS, folder_.length() - 2);
- }
- if (pos != std::string::npos) {
- return folder_.substr(0, pos + 1);
- } else {
- return EMPTY_STR;
- }
-}
-
void Pathname::SetFolder(const std::string& folder) {
folder_.assign(folder);
// Ensure folder ends in a path delimiter
diff --git a/rtc_base/pathutils.h b/rtc_base/pathutils.h
index b66cf18..a7005fc 100644
--- a/rtc_base/pathutils.h
+++ b/rtc_base/pathutils.h
@@ -52,16 +52,6 @@
Pathname& operator=(const Pathname&);
Pathname& operator=(Pathname&&);
- // Normalize changes all folder delimiters to folder_delimiter()
- void Normalize();
-
- // Reset to the empty pathname
- void clear();
-
- // Returns true if the pathname is empty. Note: this->pathname().empty()
- // is always false.
- bool empty() const;
-
// Returns the folder and filename components. If the pathname is empty,
// returns a string representing the current directory (as a relative path,
// i.e., ".").
@@ -69,8 +59,6 @@
void SetPathname(const std::string& pathname);
void SetPathname(const std::string& folder, const std::string& filename);
- std::string folder() const;
- std::string parent_folder() const;
// SetFolder and AppendFolder will append a folder delimiter, if needed.
void SetFolder(const std::string& folder);
void AppendFolder(const std::string& folder);
diff --git a/rtc_base/pathutils_unittest.cc b/rtc_base/pathutils_unittest.cc
index cbd33ed..fae4f0a 100644
--- a/rtc_base/pathutils_unittest.cc
+++ b/rtc_base/pathutils_unittest.cc
@@ -16,29 +16,21 @@
std::string(".") + rtc::Pathname::DefaultFolderDelimiter();
rtc::Pathname path("/", "");
- EXPECT_FALSE(path.empty());
- EXPECT_FALSE(path.folder().empty());
EXPECT_TRUE (path.filename().empty());
EXPECT_FALSE(path.pathname().empty());
EXPECT_EQ(std::string("/"), path.pathname());
path.SetPathname("", "foo");
- EXPECT_FALSE(path.empty());
- EXPECT_TRUE (path.folder().empty());
EXPECT_FALSE(path.filename().empty());
EXPECT_FALSE(path.pathname().empty());
EXPECT_EQ(std::string("foo"), path.pathname());
path.SetPathname("", "");
- EXPECT_TRUE (path.empty());
- EXPECT_TRUE (path.folder().empty());
EXPECT_TRUE (path.filename().empty());
EXPECT_FALSE(path.pathname().empty());
EXPECT_EQ(kCWD, path.pathname());
path.SetPathname(kCWD, "");
- EXPECT_FALSE(path.empty());
- EXPECT_FALSE(path.folder().empty());
EXPECT_TRUE (path.filename().empty());
EXPECT_FALSE(path.pathname().empty());
EXPECT_EQ(kCWD, path.pathname());