Refactor message handling: replace TextElement return type with std::optional for better nullability handling

This commit is contained in:
scawful
2025-04-05 17:24:11 -04:00
parent 9705745c14
commit 3d3a88a9c6
4 changed files with 52 additions and 69 deletions

View File

@@ -256,7 +256,7 @@ static const std::vector<TextElement> TextCommands = {
TextElement(0x70, "NONO", false, kCrash),
};
TextElement FindMatchingCommand(uint8_t b);
std::optional<TextElement> FindMatchingCommand(uint8_t b);
static const std::vector<TextElement> SpecialChars = {
TextElement(0x43, "...", false, "Ellipsis …"),
@@ -282,7 +282,7 @@ static const std::vector<TextElement> SpecialChars = {
TextElement(0x4B, "LFR", false, "Link face right"),
};
TextElement FindMatchingSpecial(uint8_t b);
std::optional<TextElement> FindMatchingSpecial(uint8_t b);
struct ParsedElement {
TextElement Parent;