util/{Const,Writable}Buffer: drop "_type" from type names

Behave like STL.
This commit is contained in:
Max Kellermann
2020-01-03 15:49:29 +01:00
parent 53f8053188
commit 4937d77cb6
26 changed files with 176 additions and 180 deletions

View File

@@ -46,16 +46,16 @@ public:
typedef typename StringPointer<T>::value_type value_type;
typedef typename StringPointer<T>::reference_type reference_type;
typedef typename StringPointer<T>::const_reference_type const_reference_type;
typedef typename StringPointer<T>::pointer_type pointer_type;
typedef typename StringPointer<T>::const_pointer_type const_pointer_type;
typedef typename StringPointer<T>::pointer pointer;
typedef typename StringPointer<T>::const_pointer const_pointer;
typedef std::size_t size_type;
static constexpr value_type SENTINEL = '\0';
private:
pointer_type value;
pointer value;
explicit AllocatedString(pointer_type _value)
explicit AllocatedString(pointer _value)
:value(_value) {}
public:
@@ -68,7 +68,7 @@ public:
delete[] value;
}
static AllocatedString Donate(pointer_type value) {
static AllocatedString Donate(pointer value) {
return AllocatedString(value);
}
@@ -82,16 +82,16 @@ public:
return Donate(p);
}
static AllocatedString Duplicate(const_pointer_type src);
static AllocatedString Duplicate(const_pointer src);
static AllocatedString Duplicate(const_pointer_type begin,
const_pointer_type end) {
static AllocatedString Duplicate(const_pointer begin,
const_pointer end) {
auto p = new value_type[end - begin + 1];
*std::copy(begin, end, p) = SENTINEL;
return Donate(p);
}
static AllocatedString Duplicate(const_pointer_type begin,
static AllocatedString Duplicate(const_pointer begin,
size_type length) {
auto p = new value_type[length + 1];
*std::copy_n(begin, length, p) = SENTINEL;
@@ -115,7 +115,7 @@ public:
return value == nullptr;
}
constexpr const_pointer_type c_str() const {
constexpr const_pointer c_str() const {
return value;
}
@@ -123,7 +123,7 @@ public:
return *value == SENTINEL;
}
constexpr pointer_type data() const {
constexpr pointer data() const {
return value;
}
@@ -135,7 +135,7 @@ public:
return value[i];
}
pointer_type Steal() {
pointer Steal() {
return std::exchange(value, nullptr);
}