serenity/Userland/Applications/Help/History.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

39 lines
696 B
C++

/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "History.h"
void History::push(const StringView& history_item)
{
m_items.shrink(m_current_history_item + 1);
m_items.append(history_item);
m_current_history_item++;
}
String History::current()
{
if (m_current_history_item == -1)
return {};
return m_items[m_current_history_item];
}
void History::go_back()
{
VERIFY(can_go_back());
m_current_history_item--;
}
void History::go_forward()
{
VERIFY(can_go_forward());
m_current_history_item++;
}
void History::clear()
{
m_items = {};
m_current_history_item = -1;
}