25 class VSG_DECLSPEC mem_stream :
public std::istream
28 mem_stream(
const uint8_t* ptr,
size_t length);
29 mem_stream(
const std::string& str, std::string::size_type pos, std::string::size_type length);
30 explicit mem_stream(
const std::string_view& sv);
33 void set(
const uint8_t* ptr,
size_t length);
36 void set(
const std::string_view& sv) {
set(
reinterpret_cast<const uint8_t*
>(sv.data()), sv.size()); }
39 void set(
const std::string& str, std::string::size_type pos, std::string::size_type length) {
set(
reinterpret_cast<const uint8_t*
>(&(str[pos])), length); }
42 struct mem_buffer :
public std::streambuf
44 mem_buffer(
const uint8_t* ptr,
size_t length);
46 inline void set(
const uint8_t* ptr,
size_t length)
48 setg((
char*)(ptr), (
char*)(ptr), (
char*)(ptr) + length);
51 std::streambuf::pos_type seekoff(std::streambuf::off_type offset, std::ios_base::seekdir dir, std::ios_base::openmode mode = ios_base::in | ios_base::out)
override;
52 std::streambuf::pos_type seekpos(std::streambuf::pos_type pos, std::ios_base::openmode mode = ios_base::in | ios_base::out)
override;
void set(const std::string &str, std::string::size_type pos, std::string::size_type length)
set the mem_stream to portion of string
Definition mem_stream.h:39