diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-29 16:40:07 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-29 16:40:19 +0300 |
commit | 72e095cf987d6bb2bc2212035a8c5498f3b6d329 (patch) | |
tree | 75e1191db056794d252ff6c6384f3763f2a0ad4b /src/history.h | |
parent | 67750111c420fcf97e31289bb4770cb7f69c426e (diff) |
Moved History to its own type
Diffstat (limited to 'src/history.h')
-rw-r--r-- | src/history.h | 41 |
1 files changed, 41 insertions, 0 deletions
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 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include <the_Foundation/array.h> | ||
4 | #include <the_Foundation/string.h> | ||
5 | #include <the_Foundation/time.h> | ||
6 | |||
7 | iDeclareType(History) | ||
8 | iDeclareType(HistoryItem) | ||
9 | |||
10 | struct Impl_HistoryItem { | ||
11 | iTime when; | ||
12 | iString url; | ||
13 | }; | ||
14 | |||
15 | iDeclareTypeConstruction(HistoryItem) | ||
16 | |||
17 | struct Impl_History { | ||
18 | iArray history; | ||
19 | size_t historyPos; /* zero at the latest item */ | ||
20 | }; | ||
21 | |||
22 | iDeclareTypeConstruction(History) | ||
23 | |||
24 | void clear_History (iHistory *); | ||
25 | |||
26 | void load_History (iHistory *, const iString *path); | ||
27 | void save_History (const iHistory *, const iString *path); | ||
28 | |||
29 | iHistoryItem * itemAtPos_History (iHistory *, size_t pos); | ||
30 | const iString * url_History (iHistory *, size_t pos); | ||
31 | iTime urlVisitTime_History(const iHistory *, const iString *url); | ||
32 | void print_History (const iHistory *); | ||
33 | |||
34 | iLocalDef iHistoryItem *item_History(iHistory *d) { | ||
35 | return itemAtPos_History(d, d->historyPos); | ||
36 | } | ||
37 | |||
38 | void addUrl_History (iHistory *, const iString *url); | ||
39 | |||
40 | iBool goBack_History (iHistory *); | ||
41 | iBool goForward_History (iHistory *); | ||