2024-09-16 16:07:26 +02:00
|
|
|
// _____ _ _____
|
|
|
|
// |_ _|____ _| ||_ _|_ __
|
|
|
|
// | |/ _ \ \/ / __|| | \ \ / /
|
|
|
|
// | | __/> <| |_ | | \ V /
|
|
|
|
// |_|\___/_/\_\\__||_| \_/
|
|
|
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
|
|
|
// License: GPL-3
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
2025-01-22 13:24:08 +01:00
|
|
|
#include <string>
|
|
|
|
#include <cstdint>
|
2024-09-16 16:07:26 +02:00
|
|
|
|
|
|
|
static constexpr uint_fast8_t DEFAULT_NUMBER = 100;
|
2024-09-16 16:58:28 +02:00
|
|
|
static constexpr uint_fast8_t MAX_WHITESPACE = 2;
|
2024-09-16 16:07:26 +02:00
|
|
|
|
2025-01-22 13:24:08 +01:00
|
|
|
class Page
|
|
|
|
{
|
2024-09-16 16:07:26 +02:00
|
|
|
private:
|
2025-01-23 16:29:28 +01:00
|
|
|
uint_fast8_t m_number;
|
2025-01-22 13:36:57 +01:00
|
|
|
std::string m_subpage;
|
2024-09-16 16:07:26 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Page(uint_fast8_t number = DEFAULT_NUMBER);
|
|
|
|
|
|
|
|
Page operator--(int) const;
|
|
|
|
|
|
|
|
Page operator++(int) const;
|
|
|
|
|
|
|
|
Page &operator+=(int);
|
|
|
|
|
|
|
|
Page &operator-=(int);
|
|
|
|
|
2025-01-23 16:29:28 +01:00
|
|
|
[[nodiscard]] std::string str() const;
|
2024-09-16 16:07:26 +02:00
|
|
|
|
|
|
|
bool refresh();
|
|
|
|
|
|
|
|
private:
|
|
|
|
[[nodiscard]] std::string url() const;
|
|
|
|
|
2025-01-22 13:36:57 +01:00
|
|
|
[[nodiscard]] std::string fetchSubpage() const;
|
2024-09-16 16:07:26 +02:00
|
|
|
};
|