1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 23:45:06 +00:00
serenity/Userland/Applications/Browser/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

53 lines
812 B
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "History.h"
namespace Browser {
void History::dump() const
{
dbgln("Dump {} items(s)", m_items.size());
int i = 0;
for (auto& item : m_items) {
dbgln("[{}] {} {}", i, item, m_current == i ? '*' : ' ');
++i;
}
}
void History::push(const URL& url)
{
m_items.shrink(m_current + 1);
m_items.append(url);
m_current++;
}
URL History::current() const
{
if (m_current == -1)
return {};
return m_items[m_current];
}
void History::go_back()
{
VERIFY(can_go_back());
m_current--;
}
void History::go_forward()
{
VERIFY(can_go_forward());
m_current++;
}
void History::clear()
{
m_items = {};
m_current = -1;
}
}