From eeb6ed7b20d56578ff8c68f3c94e887d5ac768ee Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 28 Jul 2011 14:17:55 +0300 Subject: [PATCH] Comment changes --- source/fs/dir.cpp | 6 ++---- source/fs/path.cpp | 9 --------- source/fs/path.h | 9 +++++---- source/fs/stat.h | 12 ++++-------- source/fs/utils.h | 17 +++++------------ 5 files changed, 16 insertions(+), 37 deletions(-) diff --git a/source/fs/dir.cpp b/source/fs/dir.cpp index bc7a8fe..0832854 100644 --- a/source/fs/dir.cpp +++ b/source/fs/dir.cpp @@ -21,10 +21,8 @@ namespace FS { namespace { -/** -Helper function to determine the location of the program's executable. Caches -the last result to cut down filesystem access with repeated calls. -*/ +/** Helper function to determine the location of the program's executable. +Caches the last result to cut down filesystem access with repeated calls. */ const Path &get_bin_dir(const string &argv0) { static string last_argv0; diff --git a/source/fs/path.cpp b/source/fs/path.cpp index f742b11..52b1da2 100644 --- a/source/fs/path.cpp +++ b/source/fs/path.cpp @@ -73,11 +73,6 @@ Path Path::operator/(const Path &p) const return a; } -/** -Attaches another path to the end of this one. An absolute path replaces the -existing data. ".." elements annihilate the last component and "." elements -are ignored. -*/ Path &Path::operator/=(const Path &p) { if(p.is_absolute()) @@ -148,10 +143,6 @@ void Path::init(const string &p) } } -/** -Adds a single component to the path, emulating the cd command. Fails horribly -if comp contains a separator character. -*/ void Path::add_component(const string &comp) { if(comp.empty()) diff --git a/source/fs/path.h b/source/fs/path.h index ed9cc79..6cc14ad 100644 --- a/source/fs/path.h +++ b/source/fs/path.h @@ -66,10 +66,8 @@ public: Path operator/(const Path &p) const; Path &operator/=(const Path &); - /** - Extracts a single component from the path. Negative indices count from the - end of the path. - */ + /** Extracts a single component from the path. Negative indices count from + the end of the path. */ std::string operator[](int) const; bool operator==(const Path &) const; @@ -77,6 +75,9 @@ public: Iterator end() const; private: void init(const std::string &); + + /** Adds a component to the path. It must not contain the directory + separator character. */ void add_component(const std::string &); }; diff --git a/source/fs/stat.h b/source/fs/stat.h index e6b2002..9056c92 100644 --- a/source/fs/stat.h +++ b/source/fs/stat.h @@ -7,17 +7,13 @@ namespace Msp { namespace FS { -/** -Gets information about a file. Returns 0 on success or -1 on error. This +/** Gets information about a file. Returns 0 on success or -1 on error. This version can be used to check for file existence and get information in one -call. -*/ +call. */ int stat(const Path &fn, struct stat &st); -/** -Returns information about a file. This version throws an exception if an error -occurs. -*/ +/** Returns information about a file. This version throws an exception if an +error occurs. */ struct stat stat(const Path &fn); /// Gets information about a file, without following symbolic links diff --git a/source/fs/utils.h b/source/fs/utils.h index f345ba7..df7bc76 100644 --- a/source/fs/utils.h +++ b/source/fs/utils.h @@ -12,22 +12,15 @@ std::string basename(const Path &); /// Removes the last component from the path. Path dirname(const Path &); -/** -Returns the base part of a filename. This includes everything up to the last -dot, but not the dot itself. -*/ +/** Returns the base part of a filename. This includes everything up to the +last dot, but not the dot itself. */ std::string basepart(const std::string &); -/** -Returns the extension part of a filename. This includes the last dot and -everything after it. -*/ +/** Returns the extension part of a filename. This includes the last dot and +everything after it. */ std::string extpart(const std::string &); -/** -Fixes the case of the given path to match files / directories on the -filesystem. -*/ +/// Fixes the case of a path to match files / directories on the filesystem. Path fix_case(const Path &path); /// Reads the contents of a symbolic link -- 2.43.0