2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2016-03-18 17:07:31 -07:00
|
|
|
|
2019-09-23 12:00:23 -07:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
|
2016-03-20 17:25:53 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2016-03-20 17:25:53 -07:00
|
|
|
class CFontImageDef;
|
2019-09-23 12:00:23 -07:00
|
|
|
class CTextExecuteBuffer;
|
2016-03-18 17:07:31 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CTextParser {
|
|
|
|
IObjectStore& x0_store;
|
2016-03-20 17:25:53 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
static CTextColor ParseColor(const char16_t* str, int len);
|
|
|
|
static u8 GetColorValue(const char16_t* str);
|
|
|
|
static u32 FromHex(char16_t ch);
|
|
|
|
static s32 ParseInt(const char16_t* str, int len, bool signVal);
|
|
|
|
static CAssetId GetAssetIdFromString(const char16_t* str, int len,
|
|
|
|
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
|
|
|
static bool Equals(const char16_t* str, int len, const char16_t* other);
|
|
|
|
static bool BeginsWith(const char16_t* str, int len, const char16_t* other);
|
|
|
|
void ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len,
|
|
|
|
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
|
|
|
CFontImageDef GetImage(const char16_t* str, int len, const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
|
|
|
TToken<CRasterFont> GetFont(const char16_t* str, int len);
|
2016-03-20 17:25:53 -07:00
|
|
|
|
|
|
|
public:
|
2020-03-25 18:25:11 -07:00
|
|
|
explicit CTextParser(IObjectStore& store) : x0_store(store) {}
|
2018-12-07 21:30:43 -08:00
|
|
|
void ParseText(CTextExecuteBuffer& out, const char16_t* str, int len,
|
|
|
|
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
2016-03-18 17:07:31 -07:00
|
|
|
};
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|