35 lines
702 B
C++
35 lines
702 B
C++
#pragma once
|
|
|
|
#include "../std.hpp"
|
|
#include <iostream>
|
|
#include <memory>
|
|
#include <functional>
|
|
|
|
namespace ougge::Resources {
|
|
|
|
// call this in main()
|
|
void init();
|
|
|
|
std::string formatSizeHumanReadable(std::size_t byte_n);
|
|
|
|
class Resource {
|
|
public:
|
|
const std::string path;
|
|
const std::size_t size;
|
|
|
|
using StreamFactoryMethod = std::function< std::unique_ptr<std::istream> () >;
|
|
|
|
Resource(const std::string& path, const std::size_t size, StreamFactoryMethod open_read_steam_func);
|
|
|
|
const StreamFactoryMethod openStream;
|
|
};
|
|
|
|
class MemoryStreamBuf : public std::streambuf {
|
|
public:
|
|
MemoryStreamBuf(void* p, const std::size_t n);
|
|
};
|
|
|
|
|
|
Resource& getResource(const std::string& path);
|
|
|
|
} |