Delete unused Pathname methods.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2745073004
Cr-Commit-Position: refs/heads/master@{#17388}
This commit is contained in:
nisse 2017-03-27 04:37:14 -07:00 committed by Commit bot
parent 708f731fd1
commit 0be49d8d10
2 changed files with 0 additions and 72 deletions

View File

@ -70,11 +70,6 @@ Pathname::Pathname(const std::string& folder, const std::string& filename)
Pathname& Pathname::operator=(const Pathname&) = default;
Pathname& Pathname::operator=(Pathname&&) = default;
void Pathname::SetFolderDelimiter(char delimiter) {
RTC_DCHECK(IsFolderDelimiter(delimiter));
folder_delimiter_ = delimiter;
}
void Pathname::Normalize() {
for (size_t i=0; i<folder_.length(); ++i) {
if (IsFolderDelimiter(folder_[i])) {
@ -122,28 +117,10 @@ void Pathname::SetPathname(const std::string& folder,
SetFilename(filename);
}
void Pathname::AppendPathname(const std::string& pathname) {
std::string full_pathname(folder_);
full_pathname.append(pathname);
SetPathname(full_pathname);
}
std::string Pathname::folder() const {
return folder_;
}
std::string Pathname::folder_name() 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(pos + 1);
} else {
return folder_;
}
}
std::string Pathname::parent_folder() const {
std::string::size_type pos = std::string::npos;
if (folder_.size() >= 2) {
@ -172,10 +149,6 @@ void Pathname::AppendFolder(const std::string& folder) {
}
}
std::string Pathname::basename() const {
return basename_;
}
bool Pathname::SetBasename(const std::string& basename) {
if(basename.find_first_of(FOLDER_DELIMS) != std::string::npos) {
return false;
@ -184,10 +157,6 @@ bool Pathname::SetBasename(const std::string& basename) {
return true;
}
std::string Pathname::extension() const {
return extension_;
}
bool Pathname::SetExtension(const std::string& extension) {
if (extension.find_first_of(FOLDER_DELIMS) != std::string::npos ||
extension.find_first_of(EXT_DELIM, 1) != std::string::npos) {
@ -216,29 +185,6 @@ bool Pathname::SetFilename(const std::string& filename) {
}
}
#if defined(WEBRTC_WIN)
bool Pathname::GetDrive(char* drive, uint32_t bytes) const {
return GetDrive(drive, bytes, folder_);
}
// static
bool Pathname::GetDrive(char* drive,
uint32_t bytes,
const std::string& pathname) {
// need at lease 4 bytes to save c:
if (bytes < 4 || pathname.size() < 3) {
return false;
}
memcpy(drive, pathname.c_str(), 3);
drive[3] = 0;
// sanity checking
return (isalpha(drive[0]) &&
drive[1] == ':' &&
drive[2] == '\\');
}
#endif
///////////////////////////////////////////////////////////////////////////////
} // namespace rtc

View File

@ -52,10 +52,6 @@ public:
Pathname& operator=(const Pathname&);
Pathname& operator=(Pathname&&);
// Set's the default folder delimiter for this Pathname
char folder_delimiter() const { return folder_delimiter_; }
void SetFolderDelimiter(char delimiter);
// Normalize changes all folder delimiters to folder_delimiter()
void Normalize();
@ -73,34 +69,20 @@ public:
void SetPathname(const std::string& pathname);
void SetPathname(const std::string& folder, const std::string& filename);
// Append pathname to the current folder (if any). Any existing filename
// will be discarded.
void AppendPathname(const std::string& pathname);
std::string folder() const;
std::string folder_name() 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);
std::string basename() const;
bool SetBasename(const std::string& basename);
std::string extension() const;
// SetExtension will prefix a period, if needed.
bool SetExtension(const std::string& extension);
std::string filename() const;
bool SetFilename(const std::string& filename);
#if defined(WEBRTC_WIN)
bool GetDrive(char* drive, uint32_t bytes) const;
static bool GetDrive(char* drive,
uint32_t bytes,
const std::string& pathname);
#endif
private:
std::string folder_, basename_, extension_;
char folder_delimiter_;