util/{Const,Writable}Buffer: drop more "_type" suffixes from type names
This commit is contained in:
@@ -33,14 +33,14 @@ class CancellablePointer
|
|||||||
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
||||||
public:
|
public:
|
||||||
typedef T *pointer;
|
typedef T *pointer;
|
||||||
typedef T &reference_type;
|
typedef T &reference;
|
||||||
typedef const T &const_reference_type;
|
typedef const T &const_reference;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pointer p;
|
pointer p;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CancellablePointer(reference_type _p):p(&_p) {}
|
explicit CancellablePointer(reference _p):p(&_p) {}
|
||||||
|
|
||||||
CancellablePointer(const CancellablePointer &) = delete;
|
CancellablePointer(const CancellablePointer &) = delete;
|
||||||
|
|
||||||
@@ -54,13 +54,13 @@ public:
|
|||||||
p = nullptr;
|
p = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_type Get() {
|
reference Get() {
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
|
||||||
return *p;
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool Is(const_reference_type other) const {
|
constexpr bool Is(const_reference other) const {
|
||||||
return p == &other;
|
return p == &other;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -68,8 +68,8 @@ public:
|
|||||||
template<typename T, typename CT=CancellablePointer<T>>
|
template<typename T, typename CT=CancellablePointer<T>>
|
||||||
class CancellableList {
|
class CancellableList {
|
||||||
public:
|
public:
|
||||||
typedef typename CT::reference_type reference_type;
|
typedef typename CT::reference reference;
|
||||||
typedef typename CT::const_reference_type const_reference_type;
|
typedef typename CT::const_reference const_reference;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef boost::intrusive::list<CT,
|
typedef boost::intrusive::list<CT,
|
||||||
@@ -79,10 +79,10 @@ private:
|
|||||||
List list;
|
List list;
|
||||||
|
|
||||||
class MatchPointer {
|
class MatchPointer {
|
||||||
const_reference_type p;
|
const_reference p;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit constexpr MatchPointer(const_reference_type _p)
|
explicit constexpr MatchPointer(const_reference _p)
|
||||||
:p(_p) {}
|
:p(_p) {}
|
||||||
|
|
||||||
constexpr bool operator()(const CT &a) const {
|
constexpr bool operator()(const CT &a) const {
|
||||||
@@ -91,12 +91,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
iterator Find(reference_type p) noexcept {
|
iterator Find(reference p) noexcept {
|
||||||
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
const_iterator Find(const_reference_type p) const noexcept {
|
const_iterator Find(const_reference p) const noexcept {
|
||||||
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,12 +123,12 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool Contains(const_reference_type p) const noexcept {
|
bool Contains(const_reference p) const noexcept {
|
||||||
return Find(p) != list.end();
|
return Find(p) != list.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
CT &Add(reference_type p, Args&&... args) {
|
CT &Add(reference p, Args&&... args) {
|
||||||
assert(Find(p) == list.end());
|
assert(Find(p) == list.end());
|
||||||
|
|
||||||
CT *c = new CT(p, std::forward<Args>(args)...);
|
CT *c = new CT(p, std::forward<Args>(args)...);
|
||||||
@@ -144,14 +144,14 @@ public:
|
|||||||
delete &ct;
|
delete &ct;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cancel(reference_type p) {
|
void Cancel(reference p) {
|
||||||
auto i = Find(p);
|
auto i = Find(p);
|
||||||
assert(i != list.end());
|
assert(i != list.end());
|
||||||
|
|
||||||
i->Cancel();
|
i->Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
CT &Get(reference_type p) noexcept {
|
CT &Get(reference p) noexcept {
|
||||||
auto i = Find(p);
|
auto i = Find(p);
|
||||||
assert(i != list.end());
|
assert(i != list.end());
|
||||||
|
|
||||||
|
@@ -47,8 +47,8 @@ class AllocatedArray {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Buffer::size_type size_type;
|
typedef typename Buffer::size_type size_type;
|
||||||
typedef typename Buffer::reference_type reference_type;
|
typedef typename Buffer::reference reference;
|
||||||
typedef typename Buffer::const_reference_type const_reference_type;
|
typedef typename Buffer::const_reference const_reference;
|
||||||
typedef typename Buffer::iterator iterator;
|
typedef typename Buffer::iterator iterator;
|
||||||
typedef typename Buffer::const_iterator const_iterator;
|
typedef typename Buffer::const_iterator const_iterator;
|
||||||
|
|
||||||
@@ -147,33 +147,33 @@ public:
|
|||||||
return buffer.size;
|
return buffer.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_type front() noexcept {
|
reference front() noexcept {
|
||||||
return buffer.front();
|
return buffer.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference_type front() const noexcept {
|
const_reference front() const noexcept {
|
||||||
return buffer.front();
|
return buffer.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_type back() noexcept {
|
reference back() noexcept {
|
||||||
return buffer.back();
|
return buffer.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference_type back() const noexcept {
|
const_reference back() const noexcept {
|
||||||
return buffer.back();
|
return buffer.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one element. No bounds checking.
|
* Returns one element. No bounds checking.
|
||||||
*/
|
*/
|
||||||
reference_type operator[](size_type i) noexcept {
|
reference operator[](size_type i) noexcept {
|
||||||
return buffer[i];
|
return buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one constant element. No bounds checking.
|
* Returns one constant element. No bounds checking.
|
||||||
*/
|
*/
|
||||||
const_reference_type operator[](size_type i) const noexcept {
|
const_reference operator[](size_type i) const noexcept {
|
||||||
return buffer[i];
|
return buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,8 +44,8 @@ template<typename T=char>
|
|||||||
class AllocatedString {
|
class AllocatedString {
|
||||||
public:
|
public:
|
||||||
typedef typename StringPointer<T>::value_type value_type;
|
typedef typename StringPointer<T>::value_type value_type;
|
||||||
typedef typename StringPointer<T>::reference_type reference_type;
|
typedef typename StringPointer<T>::reference reference;
|
||||||
typedef typename StringPointer<T>::const_reference_type const_reference_type;
|
typedef typename StringPointer<T>::const_reference const_reference;
|
||||||
typedef typename StringPointer<T>::pointer pointer;
|
typedef typename StringPointer<T>::pointer pointer;
|
||||||
typedef typename StringPointer<T>::const_pointer const_pointer;
|
typedef typename StringPointer<T>::const_pointer const_pointer;
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
@@ -127,11 +127,11 @@ public:
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_type operator[](size_type i) {
|
reference operator[](size_type i) {
|
||||||
return value[i];
|
return value[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const reference_type operator[](size_type i) const {
|
const reference operator[](size_type i) const {
|
||||||
return value[i];
|
return value[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,8 +93,8 @@ template<typename T>
|
|||||||
struct ConstBuffer {
|
struct ConstBuffer {
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef const T &reference_type;
|
typedef const T &reference;
|
||||||
typedef reference_type const_reference_type;
|
typedef reference const_reference;
|
||||||
typedef const T *pointer;
|
typedef const T *pointer;
|
||||||
typedef pointer const_pointer;
|
typedef pointer const_pointer;
|
||||||
typedef pointer iterator;
|
typedef pointer iterator;
|
||||||
@@ -198,7 +198,7 @@ struct ConstBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type operator[](size_type i) const noexcept {
|
reference operator[](size_type i) const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(i < size);
|
assert(i < size);
|
||||||
#endif
|
#endif
|
||||||
@@ -213,7 +213,7 @@ struct ConstBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type front() const noexcept {
|
reference front() const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(!empty());
|
assert(!empty());
|
||||||
#endif
|
#endif
|
||||||
@@ -227,7 +227,7 @@ struct ConstBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type back() const noexcept {
|
reference back() const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(!empty());
|
assert(!empty());
|
||||||
#endif
|
#endif
|
||||||
@@ -263,8 +263,8 @@ struct ConstBuffer {
|
|||||||
* Remove the first element and return a reference to it.
|
* Remove the first element and return a reference to it.
|
||||||
* Buffer must not be empty.
|
* Buffer must not be empty.
|
||||||
*/
|
*/
|
||||||
reference_type shift() noexcept {
|
reference shift() noexcept {
|
||||||
reference_type result = front();
|
reference result = front();
|
||||||
pop_front();
|
pop_front();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -142,8 +142,8 @@ class HugeArray {
|
|||||||
public:
|
public:
|
||||||
typedef typename Buffer::size_type size_type;
|
typedef typename Buffer::size_type size_type;
|
||||||
typedef typename Buffer::value_type value_type;
|
typedef typename Buffer::value_type value_type;
|
||||||
typedef typename Buffer::reference_type reference;
|
typedef typename Buffer::reference reference;
|
||||||
typedef typename Buffer::const_reference_type const_reference;
|
typedef typename Buffer::const_reference const_reference;
|
||||||
typedef typename Buffer::iterator iterator;
|
typedef typename Buffer::iterator iterator;
|
||||||
typedef typename Buffer::const_iterator const_iterator;
|
typedef typename Buffer::const_iterator const_iterator;
|
||||||
|
|
||||||
|
@@ -37,8 +37,8 @@ template<typename T=char>
|
|||||||
class StringPointer {
|
class StringPointer {
|
||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T &reference_type;
|
typedef T &reference;
|
||||||
typedef const T &const_reference_type;
|
typedef const T &const_reference;
|
||||||
typedef T *pointer;
|
typedef T *pointer;
|
||||||
typedef const T *const_pointer;
|
typedef const T *const_pointer;
|
||||||
|
|
||||||
|
@@ -92,8 +92,8 @@ template<typename T>
|
|||||||
struct WritableBuffer {
|
struct WritableBuffer {
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T &reference_type;
|
typedef T &reference;
|
||||||
typedef const T &const_reference_type;
|
typedef const T &const_reference;
|
||||||
typedef T *pointer;
|
typedef T *pointer;
|
||||||
typedef const T *const_pointer;
|
typedef const T *const_pointer;
|
||||||
typedef pointer iterator;
|
typedef pointer iterator;
|
||||||
@@ -191,7 +191,7 @@ struct WritableBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type operator[](size_type i) const noexcept {
|
reference operator[](size_type i) const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(i < size);
|
assert(i < size);
|
||||||
#endif
|
#endif
|
||||||
@@ -206,7 +206,7 @@ struct WritableBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type front() const noexcept {
|
reference front() const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(!empty());
|
assert(!empty());
|
||||||
#endif
|
#endif
|
||||||
@@ -220,7 +220,7 @@ struct WritableBuffer {
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
reference_type back() const noexcept {
|
reference back() const noexcept {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(!empty());
|
assert(!empty());
|
||||||
#endif
|
#endif
|
||||||
@@ -252,8 +252,8 @@ struct WritableBuffer {
|
|||||||
* Remove the first element and return a reference to it.
|
* Remove the first element and return a reference to it.
|
||||||
* Buffer must not be empty.
|
* Buffer must not be empty.
|
||||||
*/
|
*/
|
||||||
reference_type shift() noexcept {
|
reference shift() noexcept {
|
||||||
reference_type result = front();
|
reference result = front();
|
||||||
pop_front();
|
pop_front();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user