2021-10-03 00:44:38 +00:00
|
|
|
#ifndef _ID32_H
|
|
|
|
#define _ID32_H
|
2021-10-01 22:55:22 +00:00
|
|
|
|
2022-01-30 22:21:06 +00:00
|
|
|
#include "Dolphin/runtime.h"
|
2022-01-04 11:42:37 +00:00
|
|
|
#include "types.h"
|
2021-10-04 00:10:11 +00:00
|
|
|
#include "stream.h"
|
|
|
|
|
2021-10-04 10:42:01 +00:00
|
|
|
class ID32 {
|
2022-01-04 11:59:11 +00:00
|
|
|
private:
|
2023-01-25 21:50:15 +00:00
|
|
|
char mStr[5]; // _00
|
2021-10-11 02:05:19 +00:00
|
|
|
union {
|
2022-01-04 11:42:37 +00:00
|
|
|
char strView[4];
|
|
|
|
u32 intView;
|
2023-01-25 21:50:15 +00:00
|
|
|
} mId; // _08
|
2021-10-03 00:44:38 +00:00
|
|
|
|
2022-01-04 11:59:11 +00:00
|
|
|
void updateString();
|
|
|
|
|
|
|
|
public:
|
2022-01-04 11:42:37 +00:00
|
|
|
ID32();
|
|
|
|
ID32(u32);
|
2022-01-04 13:08:03 +00:00
|
|
|
|
2022-01-30 22:21:06 +00:00
|
|
|
inline ID32& operator=(const ID32& other)
|
|
|
|
{
|
2023-01-25 21:50:15 +00:00
|
|
|
__copy(mStr, const_cast<char*>(other.mStr), 5);
|
|
|
|
mId = other.mId;
|
2022-01-30 22:21:06 +00:00
|
|
|
return *this;
|
|
|
|
}
|
2022-01-04 11:42:37 +00:00
|
|
|
void operator=(u32);
|
|
|
|
bool operator==(u32);
|
|
|
|
bool operator!=(u32);
|
2022-01-04 13:08:03 +00:00
|
|
|
|
|
|
|
bool match(u32, char);
|
|
|
|
bool isEof();
|
2022-01-04 11:42:37 +00:00
|
|
|
void setID(u32);
|
|
|
|
void updateID();
|
|
|
|
void read(Stream&);
|
|
|
|
void write(Stream&);
|
|
|
|
void sprint(char*);
|
|
|
|
void print();
|
2021-10-04 17:51:29 +00:00
|
|
|
|
2023-01-25 21:50:15 +00:00
|
|
|
inline char* getStrID() { return mId.strView; }
|
|
|
|
inline u32 getID() { return mId.intView; }
|
|
|
|
inline char* getStr() { return mStr; }
|
2021-10-04 17:51:29 +00:00
|
|
|
|
2022-06-25 01:08:27 +00:00
|
|
|
static ID32 eof; // BSS
|
2021-10-01 22:55:22 +00:00
|
|
|
};
|
2021-10-03 00:44:38 +00:00
|
|
|
|
2021-10-14 19:43:06 +00:00
|
|
|
#endif
|