Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
CharStrmReader.h
Go to the documentation of this file.
1#ifndef NW4HBM_UT_CHAR_STREAM_READER_H
2#define NW4HBM_UT_CHAR_STREAM_READER_H
3
4// required to fix data order in `lyt_textBox.cpp`
5#include "../lyt/textBox.h"
6#include "../db/assert.h"
7
8namespace nw4hbm {
9 namespace ut {
11 public:
13
15
16 void Set(const char* stream) {
17 NW4HBM_ASSERT_VALID_PTR(49, this);
18 NW4HBM_ASSERT_VALID_PTR(50, stream);
20 mCharStrm = stream;
21 }
22
23 void Set(const wchar_t* stream) {
24 NW4HBM_ASSERT_VALID_PTR(59, this);
25 NW4HBM_ASSERT_ALIGN2(60, stream);
26 NW4HBM_ASSERT_VALID_PTR(61, stream);
27 NW4HBM_ASSERT(62, mReadFunc == ReadNextCharUTF16);
28 mCharStrm = stream;
29 }
30
31 const void* GetCurrentPos() const {
32 NW4HBM_ASSERT_VALID_PTR(68, this);
33 return mCharStrm;
34 }
35
37 NW4HBM_ASSERT_VALID_PTR(74, this);
38 return (this->*mReadFunc)();
39 }
40
45
46 template <typename T>
47 T GetChar() const {
48 const T* const charStrm = static_cast<const T* const>(mCharStrm);
49 return charStrm[0];
50 }
51
52 template <typename T>
53 T GetChar(int offset) const {
54 const T* const charStrm = static_cast<const T* const>(mCharStrm);
55 return charStrm[offset];
56 }
57
58 template <typename T>
59 void StepStrm(int step) {
60 const T*& charStrm = *reinterpret_cast<const T**>(&mCharStrm);
61 charStrm += step;
62 }
63
64 /* 0x00 */ const void* mCharStrm;
65 /* 0x04 */ const ReadFunc mReadFunc;
66 };
67
68 } // namespace ut
69} // namespace nw4hbm
70
71#endif
static s32 offset
Definition WUD.c:1669
Definition CharStrmReader.h:10
void Set(const char *stream)
Definition CharStrmReader.h:16
const void * mCharStrm
Definition CharStrmReader.h:64
u16 ReadNextCharUTF8()
Definition ut_CharStrmReader.cpp:12
u16 ReadNextCharCP1252()
Definition ut_CharStrmReader.cpp:53
u16 ReadNextCharUTF16()
Definition ut_CharStrmReader.cpp:43
void StepStrm(int step)
Definition CharStrmReader.h:59
void Set(const wchar_t *stream)
Definition CharStrmReader.h:23
u16(CharStrmReader::*) ReadFunc()
Definition CharStrmReader.h:12
CharStrmReader(ReadFunc func)
Definition CharStrmReader.h:14
const ReadFunc mReadFunc
Definition CharStrmReader.h:65
T GetChar(int offset) const
Definition CharStrmReader.h:53
u16 ReadNextCharSJIS()
Definition ut_CharStrmReader.cpp:62
T GetChar() const
Definition CharStrmReader.h:47
u16 Next()
Definition CharStrmReader.h:36
const void * GetCurrentPos() const
Definition CharStrmReader.h:31
unsigned short int u16
Definition types.h:10
Definition HBMAnmController.h:6