1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(coreav): remove unused IndexedList

This commit is contained in:
sudden6 2017-10-27 00:54:37 +02:00
parent ed4b063994
commit 4149b5b252
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
3 changed files with 0 additions and 93 deletions

View File

@ -233,7 +233,6 @@ set(${PROJECT_NAME}_SOURCES
src/core/dhtserver.cpp
src/core/dhtserver.h
src/core/icoresettings.h
src/core/indexedlist.h
src/core/recursivesignalblocker.cpp
src/core/recursivesignalblocker.h
src/core/toxcall.cpp

View File

@ -1,90 +0,0 @@
#ifndef INDEXEDLIST_H
#define INDEXEDLIST_H
#include <algorithm>
#include <vector>
template <typename T>
class IndexedList
{
public:
explicit IndexedList() = default;
// Qt
inline bool isEmpty()
{
return v.empty();
}
template <typename cmp_type>
bool contains(cmp_type i)
{
return std::find_if(begin(), end(), [i](T& t) { return static_cast<cmp_type>(t) == i; })
!= end();
}
template <typename cmp_type>
void remove(cmp_type i)
{
v.erase(std::remove_if(begin(), end(), [i](T& t) { return static_cast<cmp_type>(t) == i; }),
end());
}
template <typename cmp_type>
T& operator[](cmp_type i)
{
iterator it =
std::find_if(begin(), end(), [i](T& t) { return static_cast<cmp_type>(t) == i; });
if (it == end())
it = insert({});
return *it;
}
// STL
using iterator = typename std::vector<T>::iterator;
using const_iterator = typename std::vector<T>::const_iterator;
inline iterator begin()
{
return v.begin();
}
inline const_iterator cbegin() const
{
return v.cbegin();
}
inline iterator end()
{
return v.end();
}
inline const_iterator cend() const
{
return v.cend();
}
inline iterator erase(iterator pos)
{
return v.erase(pos);
}
inline iterator erase(iterator first, iterator last)
{
return v.erase(first, last);
}
inline iterator insert(T&& value)
{
v.push_back(std::move(value));
return --v.end();
}
private:
std::vector<T> v;
};
#endif // INDEXEDLIST_H

View File

@ -6,8 +6,6 @@
#include <QtGlobal>
#include <cstdint>
#include "src/core/indexedlist.h"
#include <tox/toxav.h>
class QTimer;