You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/07/22 12:37:13 UTC
mesos git commit: Added doxygen styled comments to Path::basename and
Path::dirname.
Repository: mesos
Updated Branches:
refs/heads/master 2eaa20d47 -> 2d36e2c96
Added doxygen styled comments to Path::basename and Path::dirname.
Review: https://reviews.apache.org/r/35998
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2d36e2c9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2d36e2c9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2d36e2c9
Branch: refs/heads/master
Commit: 2d36e2c96592ae5c1407a36974bda6447298393d
Parents: 2eaa20d
Author: Till Toenshoff <to...@me.com>
Authored: Wed Jul 22 12:36:21 2015 +0200
Committer: Bernd Mathiske <be...@mesosphere.io>
Committed: Wed Jul 22 12:36:21 2015 +0200
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/path.hpp | 59 ++++++++++++++++++--
1 file changed, 53 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2d36e2c9/3rdparty/libprocess/3rdparty/stout/include/stout/path.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/path.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/path.hpp
index 86c12a5..d58f8a4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/path.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/path.hpp
@@ -20,17 +20,42 @@
#include <stout/strings.hpp>
-// Basic abstraction for representing a path in a filesystem.
+/**
+ * Represents a POSIX file systems path and offers common path
+ * manipulations.
+ */
class Path
{
public:
explicit Path(const std::string& path)
: value(strings::remove(path, "file://", strings::PREFIX)) {}
- // TODO(cmaloney): Add more useful operations such as 'absolute()'
- // etc.
-
- // Like the standard '::basename()' except it is thread safe.
+ // TODO(cmaloney): Add more useful operations such as 'absolute()',
+ // 'directoryname()', 'filename()', etc.
+
+ /**
+ * Extracts the component following the final '/'. Trailing '/'
+ * characters are not counted as part of the pathname.
+ *
+ * Like the standard '::basename()' except it is thread safe.
+ *
+ * The following list of examples (taken from SUSv2) shows the
+ * strings returned by basename() for different paths:
+ *
+ * path | basename
+ * ----------- | -----------
+ * "/usr/lib" | "lib"
+ * "/usr/" | "usr"
+ * "usr" | "usr"
+ * "/" | "/"
+ * "." | "."
+ * ".." | ".."
+ *
+ * @return The component following the final '/'. If Path does not
+ * contain a '/', this returns a copy of Path. If Path is the
+ * string "/", then this returns the string "/". If Path is an
+ * empty string, then it returns the string ".".
+ */
inline std::string basename()
{
if (value.empty()) {
@@ -62,7 +87,29 @@ public:
return value.substr(start, end + 1 - start);
}
- // Like the standard '::dirname()' except it is thread safe.
+ /**
+ * Extracts the component up to, but not including, the final '/'.
+ * Trailing '/' characters are not counted as part of the pathname.
+ *
+ * Like the standard '::dirname()' except it is thread safe.
+ *
+ * The following list of examples (taken from SUSv2) shows the
+ * strings returned by dirname() for different paths:
+ *
+ * path | dirname
+ * ----------- | -----------
+ * "/usr/lib" | "/usr"
+ * "/usr/" | "/"
+ * "usr" | "."
+ * "/" | "/"
+ * "." | "."
+ * ".." | "."
+ *
+ * @return The component up to, but not including, the final '/'. If
+ * Path does not contain a '/', then this returns the string ".".
+ * If Path is the string "/", then this returns the string "/".
+ * If Path is an empty string, then this returns the string ".".
+ */
inline std::string dirname()
{
if (value.empty()) {