util/StringPointer: rename typedef pointer to pointer_type
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
|
||||
template<>
|
||||
AllocatedString<char>
|
||||
AllocatedString<char>::Duplicate(const_pointer src)
|
||||
AllocatedString<char>::Duplicate(const_pointer_type src)
|
||||
{
|
||||
return Duplicate(src, StringLength(src));
|
||||
}
|
||||
|
@@ -44,15 +44,15 @@ template<typename T=char>
|
||||
class AllocatedString {
|
||||
public:
|
||||
typedef typename StringPointer<T>::value_type value_type;
|
||||
typedef typename StringPointer<T>::pointer pointer;
|
||||
typedef typename StringPointer<T>::const_pointer const_pointer;
|
||||
typedef typename StringPointer<T>::pointer_type pointer_type;
|
||||
typedef typename StringPointer<T>::const_pointer_type const_pointer_type;
|
||||
|
||||
static constexpr value_type SENTINEL = '\0';
|
||||
|
||||
private:
|
||||
pointer value;
|
||||
pointer_type value;
|
||||
|
||||
explicit AllocatedString(pointer _value)
|
||||
explicit AllocatedString(pointer_type _value)
|
||||
:value(_value) {}
|
||||
|
||||
public:
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
delete[] value;
|
||||
}
|
||||
|
||||
static AllocatedString Donate(pointer value) {
|
||||
static AllocatedString Donate(pointer_type value) {
|
||||
return AllocatedString(value);
|
||||
}
|
||||
|
||||
@@ -79,16 +79,16 @@ public:
|
||||
return Donate(p);
|
||||
}
|
||||
|
||||
static AllocatedString Duplicate(const_pointer src);
|
||||
static AllocatedString Duplicate(const_pointer_type src);
|
||||
|
||||
static AllocatedString Duplicate(const_pointer begin,
|
||||
const_pointer end) {
|
||||
static AllocatedString Duplicate(const_pointer_type begin,
|
||||
const_pointer_type end) {
|
||||
auto p = new value_type[end - begin + 1];
|
||||
*std::copy(begin, end, p) = SENTINEL;
|
||||
return Donate(p);
|
||||
}
|
||||
|
||||
static AllocatedString Duplicate(const_pointer begin,
|
||||
static AllocatedString Duplicate(const_pointer_type begin,
|
||||
size_t length) {
|
||||
auto p = new value_type[length + 1];
|
||||
*std::copy_n(begin, length, p) = SENTINEL;
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
return value == nullptr;
|
||||
}
|
||||
|
||||
constexpr const_pointer c_str() const {
|
||||
constexpr const_pointer_type c_str() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -112,8 +112,8 @@ public:
|
||||
return *value == SENTINEL;
|
||||
}
|
||||
|
||||
pointer Steal() {
|
||||
pointer result = value;
|
||||
pointer_type Steal() {
|
||||
pointer_type result = value;
|
||||
value = nullptr;
|
||||
return result;
|
||||
}
|
||||
|
@@ -37,17 +37,17 @@ template<typename T=char>
|
||||
class StringPointer {
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
typedef T *pointer_type;
|
||||
typedef const T *const_pointer_type;
|
||||
|
||||
static constexpr value_type SENTINEL = '\0';
|
||||
|
||||
private:
|
||||
const_pointer value;
|
||||
const_pointer_type value;
|
||||
|
||||
public:
|
||||
StringPointer() = default;
|
||||
constexpr StringPointer(const_pointer _value)
|
||||
constexpr StringPointer(const_pointer_type _value)
|
||||
:value(_value) {}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
return value == nullptr;
|
||||
}
|
||||
|
||||
constexpr const_pointer c_str() const {
|
||||
constexpr const_pointer_type c_str() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user