txtv/src/Page.hpp

44 lines
912 B
C++
Raw Normal View History

2024-09-16 16:07:26 +02:00
// _____ _ _____
// |_ _|____ _| ||_ _|_ __
// | |/ _ \ \/ / __|| | \ \ / /
// | | __/> <| |_ | | \ V /
// |_|\___/_/\_\\__||_| \_/
// Author: Love Billenius <lovebillenius@disroot.org>
// License: GPL-3
#pragma once
#include <vector>
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
class Page {
private:
uint_fast8_t number{};
std::vector<std::string> subpages;
public:
explicit Page(uint_fast8_t number = DEFAULT_NUMBER);
Page operator--(int) const;
Page operator++(int) const;
Page &operator+=(int);
Page &operator-=(int);
std::string str() const;
bool refresh();
private:
[[nodiscard]] std::string url() const;
[[nodiscard]] std::vector<std::string> fetchSubpages() const;
[[nodiscard]] bool contentEquals(const std::vector<std::string> &subpagesOther) const;
};