Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_listbase_wrapper.hh')
-rw-r--r--source/blender/blenlib/BLI_listbase_wrapper.hh32
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/blenlib/BLI_listbase_wrapper.hh b/source/blender/blenlib/BLI_listbase_wrapper.hh
index a77e2d66458..46f4a9d49fa 100644
--- a/source/blender/blenlib/BLI_listbase_wrapper.hh
+++ b/source/blender/blenlib/BLI_listbase_wrapper.hh
@@ -20,10 +20,10 @@
/** \file
* \ingroup bli
*
- * `blender::ListBaseWrapper` is a typed wrapper for the ListBase struct. That makes it safer and
+ * `blender::ListBaseWrapper` is a typed wrapper for the #ListBase struct. That makes it safer and
* more convenient to use in C++ in some cases. However, if you find yourself iterating over a
* linked list a lot, consider to convert it into a vector for further processing. This improves
- * performance and debugability.
+ * performance and debug-ability.
*/
#include "BLI_listbase.h"
@@ -33,10 +33,10 @@ namespace blender {
template<typename T> class ListBaseWrapper {
private:
- ListBase *m_listbase;
+ ListBase *listbase_;
public:
- ListBaseWrapper(ListBase *listbase) : m_listbase(listbase)
+ ListBaseWrapper(ListBase *listbase) : listbase_(listbase)
{
BLI_assert(listbase);
}
@@ -47,17 +47,17 @@ template<typename T> class ListBaseWrapper {
class Iterator {
private:
- ListBase *m_listbase;
- T *m_current;
+ ListBase *listbase_;
+ T *current_;
public:
- Iterator(ListBase *listbase, T *current) : m_listbase(listbase), m_current(current)
+ Iterator(ListBase *listbase, T *current) : listbase_(listbase), current_(current)
{
}
Iterator &operator++()
{
- m_current = m_current->next;
+ current_ = current_->next;
return *this;
}
@@ -70,35 +70,35 @@ template<typename T> class ListBaseWrapper {
bool operator!=(const Iterator &iterator) const
{
- return m_current != iterator.m_current;
+ return current_ != iterator.current_;
}
T *operator*() const
{
- return m_current;
+ return current_;
}
};
Iterator begin() const
{
- return Iterator(m_listbase, (T *)m_listbase->first);
+ return Iterator(listbase_, (T *)listbase_->first);
}
Iterator end() const
{
- return Iterator(m_listbase, nullptr);
+ return Iterator(listbase_, nullptr);
}
T get(uint index) const
{
- void *ptr = BLI_findlink(m_listbase, index);
+ void *ptr = BLI_findlink(listbase_, index);
BLI_assert(ptr);
return (T *)ptr;
}
- uint index_of(const T *value) const
+ int64_t index_of(const T *value) const
{
- uint index = 0;
+ int64_t index = 0;
for (T *ptr : *this) {
if (ptr == value) {
return index;
@@ -106,7 +106,7 @@ template<typename T> class ListBaseWrapper {
index++;
}
BLI_assert(false);
- return 0;
+ return -1;
}
};