vkdoom_m/src/common/filesystem/source/fs_stringpool.h
Christoph Oelckers 83aa9388ca backend update from Raze
* moving large allocations off the stack
* use proper printf formatters for size_t and ptrdiff_t.
* adding some missing 'noexcept'.
2024-01-06 15:24:10 +01:00

28 lines
551 B
C++

#pragma once
namespace FileSys {
// Storage for all the static strings the file system must hold.
class StringPool
{
// do not allow externally defining this.
friend class FileSystem;
friend class FResourceFile;
private:
StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), BlockSize(blocksize), shared(_shared) {}
public:
~StringPool();
const char* Strdup(const char*);
void* Alloc(size_t size);
protected:
struct Block;
Block *AddBlock(size_t size);
Block *TopBlock;
size_t BlockSize;
public:
bool shared;
};
}