mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-18 02:39:20 +01:00
23 lines
732 B
C++
23 lines
732 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
|
|
struct membuf : std::streambuf {
|
|
membuf(char *begin, char *end) {
|
|
this->setg(begin, begin, end);
|
|
}
|
|
|
|
pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in) override {
|
|
if (dir == std::ios_base::cur)
|
|
gbump(off);
|
|
else if (dir == std::ios_base::end)
|
|
setg(eback(), egptr() + off, egptr());
|
|
else if (dir == std::ios_base::beg)
|
|
setg(eback(), eback() + off, egptr());
|
|
return gptr() - eback();
|
|
}
|
|
|
|
pos_type seekpos(pos_type sp, std::ios_base::openmode which) override {
|
|
return seekoff(sp - pos_type(off_type(0)), std::ios_base::beg, which);
|
|
}
|
|
}; |