OSDN Git Service

Ver0.11pre
[gefu/Gefu.git] / history.h
1 #include <QStringList>
2
3 #ifndef HISTORY_H
4 #define HISTORY_H
5
6 #include <QVector>
7
8 class History
9 {
10     typedef QVector<QString> Container;
11
12 public:
13     History();
14
15     void add(const QString &path);
16
17     const QString& back();
18     const QString& forward();
19     const QString& current() const { return m_list[m_pos]; }
20
21     bool isBegin() const    { return m_pos == 0; }
22     bool isEnd() const      { return m_pos == m_list.size() - 1; }
23     bool isEmpty() const    { return m_list.isEmpty(); }
24
25     int size() const { return m_list.size(); }
26     const QString& at(int n) const { return m_list.at(n); }
27     void setAt(int n) { m_pos = n; }
28
29 private:
30     Container m_list;
31     int m_pos;
32 };
33
34 #endif // HISTORY_H