txtv/src/Page.hpp

44 lines
844 B
C++

// _____ _ _____
// |_ _|____ _| ||_ _|_ __
// | |/ _ \ \/ / __|| | \ \ / /
// | | __/> <| |_ | | \ V /
// |_|\___/_/\_\\__||_| \_/
// Author: Love Billenius <lovebillenius@disroot.org>
// License: GPL-3
#pragma once
#include <vector>
#include <string>
#include <cstdint>
static constexpr uint_fast8_t DEFAULT_NUMBER = 100;
static constexpr uint_fast8_t MAX_WHITESPACE = 2;
class Page
{
private:
uint_fast8_t m_number;
std::string m_subpage;
public:
explicit Page(uint_fast8_t number = DEFAULT_NUMBER);
Page operator--(int) const;
Page operator++(int) const;
Page &operator+=(int);
Page &operator-=(int);
[[nodiscard]] std::string str() const;
bool refresh();
private:
[[nodiscard]] std::string url() const;
[[nodiscard]] std::string fetchSubpage() const;
};