aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-06-23 12:34:02 +0200
committerMax Kellermann <max@duempel.org>2015-06-23 12:34:45 +0200
commit4c0916df79731c335626f8150c43a35a439e451f (patch)
tree45f31b0f5e31cbaa25bd3796a92f9cd00e83de02 /src/fs
parente4844b99363a055d76032e33be7b219d238e1731 (diff)
downloadmpd-4c0916df79731c335626f8150c43a35a439e451f.tar.gz
mpd-4c0916df79731c335626f8150c43a35a439e451f.tar.xz
mpd-4c0916df79731c335626f8150c43a35a439e451f.zip
fs/Path: use base class StringPointer
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Path.hxx16
-rw-r--r--src/fs/Traits.hxx6
2 files changed, 10 insertions, 12 deletions
diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx
index 21eaffef8..70ea52393 100644
--- a/src/fs/Path.hxx
+++ b/src/fs/Path.hxx
@@ -37,14 +37,10 @@ class AllocatedPath;
* This class manages a pointer to an existing path string. While an
* instance lives, the string must not be invalidated.
*/
-class Path {
- typedef PathTraitsFS::value_type value_type;
- typedef PathTraitsFS::pointer pointer;
- typedef PathTraitsFS::const_pointer const_pointer;
+class Path : public PathTraitsFS::Pointer {
+ typedef PathTraitsFS::Pointer Base;
- const_pointer value;
-
- constexpr Path(const_pointer _value):value(_value) {}
+ constexpr Path(const_pointer _value):Base(_value) {}
public:
/**
@@ -80,7 +76,7 @@ public:
* must not be used.
*/
bool IsNull() const {
- return value == nullptr;
+ return Base::IsNull();
}
/**
@@ -89,7 +85,7 @@ public:
* @see IsNull()
*/
void SetNull() {
- value = nullptr;
+ *this = nullptr;
}
/**
@@ -110,7 +106,7 @@ public:
*/
gcc_pure
const_pointer c_str() const {
- return value;
+ return Base::c_str();
}
/**
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index b92330f60..08d798f05 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -22,6 +22,7 @@
#include "check.h"
#include "Compiler.h"
+#include "util/StringPointer.hxx"
#include "util/StringAPI.hxx"
#ifdef WIN32
@@ -50,8 +51,9 @@ struct PathTraitsFS {
#endif
typedef string::traits_type char_traits;
typedef char_traits::char_type value_type;
- typedef value_type *pointer;
- typedef const value_type *const_pointer;
+ typedef StringPointer<value_type> Pointer;
+ typedef Pointer::pointer pointer;
+ typedef Pointer::const_pointer const_pointer;
#ifdef WIN32
static constexpr value_type SEPARATOR = '\\';