Example-Extension/ExampleExtension/Extension.h

28 lines
582 B
C
Raw Normal View History

2018-10-08 13:37:56 +08:00
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <cstdint>
#include <string>
2019-02-14 07:28:23 +08:00
2018-10-08 13:37:56 +08:00
struct InfoForExtension
{
const char* name;
int64_t value;
};
struct SentenceInfo
{
2019-02-14 07:28:23 +08:00
const InfoForExtension* infoArray;
2018-10-08 13:37:56 +08:00
int64_t operator[](std::string propertyName)
{
2019-06-29 17:32:59 +08:00
for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array
if (propertyName == info->name) return info->value;
return *(int*)0xcccc = 0; // gives better error message than alternatives
2018-10-08 13:37:56 +08:00
}
};
2018-10-12 03:23:59 +08:00
struct SKIP {};
inline void Skip() { throw SKIP(); }