fs/Path: use base class StringPointer
This commit is contained in:
parent
e4844b9936
commit
4c0916df79
@ -37,14 +37,10 @@ class AllocatedPath;
|
|||||||
* This class manages a pointer to an existing path string. While an
|
* This class manages a pointer to an existing path string. While an
|
||||||
* instance lives, the string must not be invalidated.
|
* instance lives, the string must not be invalidated.
|
||||||
*/
|
*/
|
||||||
class Path {
|
class Path : public PathTraitsFS::Pointer {
|
||||||
typedef PathTraitsFS::value_type value_type;
|
typedef PathTraitsFS::Pointer Base;
|
||||||
typedef PathTraitsFS::pointer pointer;
|
|
||||||
typedef PathTraitsFS::const_pointer const_pointer;
|
|
||||||
|
|
||||||
const_pointer value;
|
constexpr Path(const_pointer _value):Base(_value) {}
|
||||||
|
|
||||||
constexpr Path(const_pointer _value):value(_value) {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -80,7 +76,7 @@ public:
|
|||||||
* must not be used.
|
* must not be used.
|
||||||
*/
|
*/
|
||||||
bool IsNull() const {
|
bool IsNull() const {
|
||||||
return value == nullptr;
|
return Base::IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,7 +85,7 @@ public:
|
|||||||
* @see IsNull()
|
* @see IsNull()
|
||||||
*/
|
*/
|
||||||
void SetNull() {
|
void SetNull() {
|
||||||
value = nullptr;
|
*this = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +106,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
const_pointer c_str() const {
|
const_pointer c_str() const {
|
||||||
return value;
|
return Base::c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
#include "util/StringPointer.hxx"
|
||||||
#include "util/StringAPI.hxx"
|
#include "util/StringAPI.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -50,8 +51,9 @@ struct PathTraitsFS {
|
|||||||
#endif
|
#endif
|
||||||
typedef string::traits_type char_traits;
|
typedef string::traits_type char_traits;
|
||||||
typedef char_traits::char_type value_type;
|
typedef char_traits::char_type value_type;
|
||||||
typedef value_type *pointer;
|
typedef StringPointer<value_type> Pointer;
|
||||||
typedef const value_type *const_pointer;
|
typedef Pointer::pointer pointer;
|
||||||
|
typedef Pointer::const_pointer const_pointer;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static constexpr value_type SEPARATOR = '\\';
|
static constexpr value_type SEPARATOR = '\\';
|
||||||
|
Loading…
Reference in New Issue
Block a user