32 [[nodiscard]]
virtual bool good()
const = 0;
33 virtual void seek(std::int32_t a_numBytes) = 0;
34 [[nodiscard]]
virtual std::uint32_t
tell()
const;
38 template <
class CharT>
39 bool get(CharT& a_ch);
40 template <
class CharT>
41 bool read(CharT* a_str, std::uint32_t a_count);
42 template <
class CharT>
44 template <
class CharT>
45 bool write(
const CharT* a_str, std::uint32_t a_count);
48 using ReadFn = std::uint32_t(
NiBinaryStream* a_this,
void* a_buffer, std::uint32_t a_bytes, std::uint32_t* a_componentSizes, std::uint32_t a_numComponents);
49 using WriteFn = std::uint32_t(
NiBinaryStream* a_this,
const void* a_buffer, std::uint32_t a_bytes, std::uint32_t* a_componentSizes, std::uint32_t a_numComponents);
51 std::uint32_t
binary_read(
void* a_buffer, std::uint32_t a_totalBytes, std::uint32_t* a_componentSizes, std::uint32_t a_numComponents = 1);
52 std::uint32_t
binary_write(
const void* a_buffer, std::uint32_t a_totalBytes, std::uint32_t* a_componentSizes, std::uint32_t a_numComponents = 1);
62 template <
class CharT>
65 return read(&a_ch, 1);
68 template <
class CharT>
71 std::uint32_t size =
sizeof(CharT);
72 std::uint32_t toRead = a_count * size;
73 std::uint32_t bytesRead =
binary_read(a_str, toRead, &size);
74 return bytesRead == toRead;
77 template <
class CharT>
80 return write(&a_ch, 1);
83 template <
class CharT>
86 std::uint32_t size =
sizeof(CharT);
87 std::uint32_t toWrite = a_count * size;
88 std::uint32_t bytesWritten =
binary_write(a_str, toWrite, &size);
89 return bytesWritten == toWrite;
95 template <
class CharT,
class Traits,
class Allocator>
98 CharT delim = std::use_facet<std::ctype<CharT>>(std::locale()).widen(
'\n');
99 return getline(a_input, a_str, delim);
102 template <
class CharT,
class Traits,
class Allocator>
107 auto notEOF = a_input.
get(c);
110 if (!std::char_traits<CharT>::eq(c, a_delim)) {
116 if (a_str.size() != a_str.max_size()) {
117 notEOF = a_input.
get(c);
Definition NiBinaryStream.h:6
bool get(CharT &a_ch)
Definition NiBinaryStream.h:63
std::uint32_t(NiBinaryStream *a_this, void *a_buffer, std::uint32_t a_bytes, std::uint32_t *a_componentSizes, std::uint32_t a_numComponents) ReadFn
Definition NiBinaryStream.h:48
WriteFn * _writeFn
Definition NiBinaryStream.h:58
virtual void seek(std::int32_t a_numBytes)=0
std::uint32_t(NiBinaryStream *a_this, const void *a_buffer, std::uint32_t a_bytes, std::uint32_t *a_componentSizes, std::uint32_t a_numComponents) WriteFn
Definition NiBinaryStream.h:49
virtual std::uint32_t tell() const
virtual void set_endian_swap(bool a_doSwap)=0
static constexpr auto RTTI
Definition NiBinaryStream.h:8
std::uint32_t _pad0C
Definition NiBinaryStream.h:56
std::uint32_t binary_write(const void *a_buffer, std::uint32_t a_totalBytes, std::uint32_t *a_componentSizes, std::uint32_t a_numComponents=1)
bool write(const CharT *a_str, std::uint32_t a_count)
Definition NiBinaryStream.h:84
bool read(CharT *a_str, std::uint32_t a_count)
Definition NiBinaryStream.h:69
virtual void get_info(BufferInfo &a_buf)
std::int32_t off_type
Definition NiBinaryStream.h:12
virtual ~NiBinaryStream()
virtual bool good() const =0
ReadFn * _readFn
Definition NiBinaryStream.h:57
std::uint32_t _absoluteCurrentPos
Definition NiBinaryStream.h:55
bool put(CharT a_ch)
Definition NiBinaryStream.h:78
std::int32_t int_type
Definition NiBinaryStream.h:10
std::uint32_t binary_read(void *a_buffer, std::uint32_t a_totalBytes, std::uint32_t *a_componentSizes, std::uint32_t a_numComponents=1)
std::uint32_t pos_type
Definition NiBinaryStream.h:11
Definition AbsorbEffect.h:6
constexpr REL::VariantID RTTI_NiBinaryStream(685333, 393110, 0x1ee3e28)
Definition ActorValueList.h:28
bool getline(RE::NiBinaryStream &a_input, std::basic_string< CharT, Traits, Allocator > &a_str)
Definition NiBinaryStream.h:96
Definition NiBinaryStream.h:15
std::uint32_t streamPos
Definition NiBinaryStream.h:23
std::uint32_t bufferPos
Definition NiBinaryStream.h:22
std::uint32_t bufferAllocSize
Definition NiBinaryStream.h:20
std::uint32_t totalSize
Definition NiBinaryStream.h:19
void * buffer
Definition NiBinaryStream.h:18
std::uint32_t pad1C
Definition NiBinaryStream.h:24
std::uint32_t bufferReadSize
Definition NiBinaryStream.h:21