summaryrefslogtreecommitdiff
path: root/src/history.h
blob: 15a179d69b85f635ad718cb7d8e5a74d0b7a6328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include <the_Foundation/array.h>
#include <the_Foundation/string.h>
#include <the_Foundation/time.h>

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 *);