summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 3df1c55fda..bd12438503 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -5,7 +5,7 @@ extern HANDLE htuLog;
/////////////////////////////////////////////////////////////////////////////////////////
// Filters
-bool Filter::check(ItemData *item)
+bool Filter::check(ItemData *item) const
{
if (!item) return false;
if (!(flags & EVENTONLY)) {
@@ -431,6 +431,16 @@ int HistoryArray::getCount() const
return (nPages == 0) ? 0 : (nPages - 1) * HIST_BLOCK_SIZE + iLastPageCounter;
}
+int HistoryArray::find(int id, int dir, const Filter &filter)
+{
+ int count = getCount();
+ for (int i = id + dir; i >= 0 && i < count; i += dir)
+ if (filter.check(get(i)))
+ return i;
+
+ return -1;
+}
+
void HistoryArray::remove(int id)
{
int pageNo = id / HIST_BLOCK_SIZE;