summaryrefslogtreecommitdiff
path: root/include/nw4r/ut/ut_TagProcessorBase.h
blob: cbcf180acc601c46e40ead2e2d0dc2b78398b4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef NW4R_UT_TAG_PROCESSOR_BASE_H
#define NW4R_UT_TAG_PROCESSOR_BASE_H
#include "nw4r/types_nw4r.h"
#include "nw4r/ut/ut_Rect.h"

namespace nw4r {
namespace ut {

enum PrintFlags {
    PRINTFLAGS_CHARSPACE = (1 << 0),
};

template <typename T>
struct PrintContext {
    TextWriterBase<T> *writer; // at 0x0
    const T *str;              // at 0x4
    f32 x;                     // at 0x8
    f32 y;                     // at 0xC
    u32 flags;                 // at 0x10
};

enum Operation {
    OPERATION_DEFAULT,
    OPERATION_NO_CHAR_SPACE,
    OPERATION_CHAR_SPACE,
    OPERATION_NEXT_LINE,
    OPERATION_END_DRAW
};

template <typename T>
class TagProcessorBase {
public:
    TagProcessorBase();
    virtual ~TagProcessorBase(); // at 0x8

    virtual Operation Process(u16 ch, PrintContext<T> *ctx); // at 0xC
    virtual Operation CalcRect(Rect *rect, u16 ch,
                               PrintContext<T> *ctx); // at 0x10

    void ProcessLinefeed(PrintContext<T> *ctx);
    void ProcessTab(PrintContext<T> *ctx);
};

} // namespace ut
} // namespace nw4r

#endif