22 lines
472 B
C
Raw Normal View History

2024-04-21 17:38:47 +08:00
#pragma once
2024-02-08 16:18:33 +08:00
struct InfoForExtension
{
const char* name;
int64_t value;
};
struct SentenceInfo
{
const InfoForExtension* infoArray;
int64_t operator[](std::string_view propertyName)
{
for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array
if (propertyName == info->name) return info->value;
return *(int*)0xDEAD = 0; // gives better error message than alternatives
}
};
2024-04-21 17:38:47 +08:00
struct SKIP {};
inline void Skip() { throw SKIP(); }