/*
 * Copyright 2015 - 2025 gary@drinkingtea.net
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#pragma once

#ifdef OX_USE_STDLIB
#include <istream>
#endif

#include "reader.hpp"

namespace ox {

#ifdef OX_USE_STDLIB
class StreamReader: public Reader_v {
	private:
		std::istream &m_strm;
	public:
		constexpr explicit StreamReader(std::istream &stream) noexcept: m_strm(stream) {}
		Result<char> peek() const noexcept override;
		Result<size_t> read(char *v, size_t cnt) noexcept override;
		Error seekg(size_t p) noexcept override;
		Error seekg(int64_t p, ios_base::seekdir sd) noexcept override;
		Result<size_t> tellg() noexcept override;
};
#endif

}
