33 [[nodiscard]]
virtual bool good()
const = 0;
34 virtual void seek(std::int32_t a_numBytes) = 0;
35 [[nodiscard]]
virtual std::uint32_t
tell()
const;
39 template <
class CharT>
40 bool get(CharT& a_ch);
41 template <
class CharT>
42 bool read(CharT* a_str, std::uint32_t a_count);
43 template <
class CharT>
45 template <
class CharT>
46 bool write(
const CharT* a_str, std::uint32_t a_count);
49 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);
50 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);
52 std::uint32_t
binary_read(
void* a_buffer, std::uint32_t a_totalBytes, std::uint32_t* a_componentSizes, std::uint32_t a_numComponents = 1);
53 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);
63 template <
class CharT>
66 return read(&a_ch, 1);
69 template <
class CharT>
72 std::uint32_t size =
sizeof(CharT);
73 std::uint32_t toRead = a_count * size;
74 std::uint32_t bytesRead =
binary_read(a_str, toRead, &size);
75 return bytesRead == toRead;
78 template <
class CharT>
81 return write(&a_ch, 1);
84 template <
class CharT>
87 std::uint32_t size =
sizeof(CharT);
88 std::uint32_t toWrite = a_count * size;
89 std::uint32_t bytesWritten =
binary_write(a_str, toWrite, &size);
90 return bytesWritten == toWrite;
96 template <
class CharT,
class Traits,
class Allocator>
99 CharT delim = std::use_facet<std::ctype<CharT>>(std::locale()).widen(
'\n');
100 return getline(a_input, a_str, delim);
103 template <
class CharT,
class Traits,
class Allocator>
108 auto notEOF = a_input.
get(c);
111 if (!std::char_traits<CharT>::eq(c, a_delim)) {
117 if (a_str.size() != a_str.max_size()) {
118 notEOF = a_input.
get(c);
Definition: NiBinaryStream.h:6
bool get(CharT &a_ch)
Definition: NiBinaryStream.h:64
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:49
WriteFn * _writeFn
Definition: NiBinaryStream.h:59
static constexpr auto VTABLE
Definition: NiBinaryStream.h:9
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:50
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:57
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:85
bool read(CharT *a_str, std::uint32_t a_count)
Definition: NiBinaryStream.h:70
virtual void get_info(BufferInfo &a_buf)
std::int32_t off_type
Definition: NiBinaryStream.h:13
virtual ~NiBinaryStream()
virtual bool good() const =0
ReadFn * _readFn
Definition: NiBinaryStream.h:58
std::uint32_t _absoluteCurrentPos
Definition: NiBinaryStream.h:56
bool put(CharT a_ch)
Definition: NiBinaryStream.h:79
std::int32_t int_type
Definition: NiBinaryStream.h:11
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:12
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_NiBinaryStream(static_cast< std::uint64_t >(685333))
constexpr std::array< REL::ID, 1 > VTABLE_NiBinaryStream
Definition: Offsets_VTABLE.h:12165
Definition: EffectArchetypes.h:65
bool getline(RE::NiBinaryStream &a_input, std::basic_string< CharT, Traits, Allocator > &a_str)
Definition: NiBinaryStream.h:97
Definition: NiBinaryStream.h:16
std::uint32_t streamPos
Definition: NiBinaryStream.h:24
std::uint32_t bufferPos
Definition: NiBinaryStream.h:23
std::uint32_t bufferAllocSize
Definition: NiBinaryStream.h:21
std::uint32_t totalSize
Definition: NiBinaryStream.h:20
void * buffer
Definition: NiBinaryStream.h:19
std::uint32_t pad1C
Definition: NiBinaryStream.h:25
std::uint32_t bufferReadSize
Definition: NiBinaryStream.h:22