aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/Path.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 21:59:35 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 23:43:46 +0200
commitabfbd55305587306730d5419b8a3b09e6a43abcb (patch)
tree2a195220d79efe195f3beacb7dd3a226a3341ad6 /src/fs/Path.cxx
parentb3611524f45c2a478f9decd6d22ecd1dbbbb64b9 (diff)
downloadmpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.gz
mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.xz
mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.zip
fs/Path: rename to AllocatedPath
The new class Path only holds a string pointer without being responsible for allocation/deallocation. The FileSystem.hxx library accepts Path arguments instead of AllocatedPath, to avoid forcing callers to allocate another string object.
Diffstat (limited to 'src/fs/Path.cxx')
-rw-r--r--src/fs/Path.cxx64
1 files changed, 1 insertions, 63 deletions
diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx
index ecdf73e49..0ff0591fb 100644
--- a/src/fs/Path.cxx
+++ b/src/fs/Path.cxx
@@ -19,57 +19,12 @@
#include "config.h"
#include "Path.hxx"
-#include "Domain.hxx"
#include "Charset.hxx"
-#include "util/Error.hxx"
-#include "Compiler.h"
-
-#include <glib.h>
-
-#include <assert.h>
-#include <string.h>
-
-inline Path::Path(Donate, pointer _value)
- :value(_value) {
- g_free(_value);
-}
-
-/* no inlining, please */
-Path::~Path() {}
-
-Path
-Path::Build(const_pointer a, const_pointer b)
-{
- return Path(Donate(), g_build_filename(a, b, nullptr));
-}
-
-Path Path::FromUTF8(const char *path_utf8)
-{
- return Path(Donate(), ::PathFromUTF8(path_utf8));
-}
-
-Path
-Path::FromUTF8(const char *path_utf8, Error &error)
-{
- Path path = FromUTF8(path_utf8);
- if (path.IsNull())
- error.Format(path_domain,
- "Failed to convert to file system charset: %s",
- path_utf8);
-
- return path;
-}
-
-Path
-Path::GetDirectoryName() const
-{
- return Path(Donate(), g_path_get_dirname(value.c_str()));
-}
std::string
Path::ToUTF8() const
{
- return ::PathToUTF8(value.c_str());
+ return ::PathToUTF8(c_str());
}
const char *
@@ -93,20 +48,3 @@ Path::RelativeFS(const char *other_fs) const
return other_fs;
}
-
-void
-Path::ChopSeparators()
-{
- size_t l = length();
- const char *p = data();
-
- while (l >= 2 && PathTraits::IsSeparatorFS(p[l - 1])) {
- --l;
-
-#if GCC_CHECK_VERSION(4,7) && !defined(__clang__)
- value.pop_back();
-#else
- value.erase(value.end() - 1, value.end());
-#endif
- }
-}