diff options
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 12 |
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; |