blob: 0125d9c6bf5b1d468a4b99353d0795dc105f42ad (
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
|
/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/Vector.h>
class History final {
public:
void push(const StringView& history_item);
String current();
void go_back();
void go_forward();
bool can_go_back() { return m_current_history_item > 0; }
bool can_go_forward() { return m_current_history_item + 1 < static_cast<int>(m_items.size()); }
void clear();
private:
Vector<String> m_items;
int m_current_history_item { -1 };
};
|