From 72e095cf987d6bb2bc2212035a8c5498f3b6d329 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 29 Jul 2020 16:40:07 +0300 Subject: Moved History to its own type --- src/history.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/history.h (limited to 'src/history.h') diff --git a/src/history.h b/src/history.h new file mode 100644 index 00000000..15a179d6 --- /dev/null +++ b/src/history.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include + +iDeclareType(History) +iDeclareType(HistoryItem) + +struct Impl_HistoryItem { + iTime when; + iString url; +}; + +iDeclareTypeConstruction(HistoryItem) + +struct Impl_History { + iArray history; + size_t historyPos; /* zero at the latest item */ +}; + +iDeclareTypeConstruction(History) + +void clear_History (iHistory *); + +void load_History (iHistory *, const iString *path); +void save_History (const iHistory *, const iString *path); + +iHistoryItem * itemAtPos_History (iHistory *, size_t pos); +const iString * url_History (iHistory *, size_t pos); +iTime urlVisitTime_History(const iHistory *, const iString *url); +void print_History (const iHistory *); + +iLocalDef iHistoryItem *item_History(iHistory *d) { + return itemAtPos_History(d, d->historyPos); +} + +void addUrl_History (iHistory *, const iString *url); + +iBool goBack_History (iHistory *); +iBool goForward_History (iHistory *); -- cgit v1.2.3