Textractor_test/extensions/extension.h

26 lines
495 B
C
Raw Normal View History

2018-10-12 02:29:11 +08:00
#pragma once
2018-11-05 10:19:00 +08:00
#include "common.h"
2018-10-12 02:29:11 +08:00
struct InfoForExtension
{
const char* name;
int64_t value;
};
struct SentenceInfo
{
2019-02-09 13:30:38 +08:00
const InfoForExtension* infoArray;
// nullptr marks end of info array
2018-10-12 02:29:11 +08:00
int64_t operator[](std::string propertyName)
{
2019-02-09 13:30:38 +08:00
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
2018-10-12 02:29:11 +08:00
throw;
}
2019-02-11 10:46:39 +08:00
2019-02-18 08:14:49 +08:00
inline static InfoForExtension DUMMY[2] = { { "text number", 1 } };
2018-10-12 02:29:11 +08:00
};
struct SKIP {};
inline void Skip() { throw SKIP(); }