Working on FileListWidget, and keep forgetting to commit this bit.

This commit is contained in:
Stephen Anthony 2019-08-14 13:43:32 -02:30
parent 50cb562592
commit bd66449412
1 changed files with 23 additions and 0 deletions

View File

@ -112,6 +112,22 @@ class LinkedObjectPool
myCurrent = std::next(myCurrent, 1); myCurrent = std::next(myCurrent, 1);
} }
/**
Advance 'current' iterator to first position in the active list.
*/
void moveToFirst() {
if(currentIsValid())
myCurrent = myList.begin();
}
/**
Advance 'current' iterator to last position in the active list.
*/
void moveToLast() {
if(currentIsValid())
myCurrent = std::prev(myList.end(), 1);
}
/** /**
Return an iterator to the first node in the active list. Return an iterator to the first node in the active list.
*/ */
@ -246,6 +262,13 @@ class LinkedObjectPool
bool empty() const { return size() == 0; } bool empty() const { return size() == 0; }
bool full() const { return size() >= capacity(); } bool full() const { return size() >= capacity(); }
friend ostream& operator<<(ostream& os, const LinkedObjectPool<T>& p) {
for(const auto& i: p.myList)
os << i << (p.current() == i ? "* " : " ");
return os;
}
private: private:
std::list<T> myList, myPool; std::list<T> myList, myPool;