forked from ArthurSonzogni/Diagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTranslator.h
45 lines (37 loc) · 1.17 KB
/
Translator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef TRANSLATOR_TRANSLATOR
#define TRANSLATOR_TRANSLATOR
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
class Translator {
public:
// Main API implemented by translator. ---------------------------------------
virtual std::string Translate(const std::string& input,
const std::string& option) = 0;
virtual ~Translator() = default;
// Reflection API ------------------------------------------------------------
virtual const char* Identifier() { return ""; }
virtual const char* Name() { return ""; }
virtual const char* Description() { return ""; }
enum Widget {
Combobox,
Checkbox,
};
struct OptionDescription {
std::string name;
std::vector<std::string> values;
std::string default_value;
std::string description;
Widget type;
};
virtual std::vector<OptionDescription> Options() { return {}; }
struct Example {
std::string title;
std::string input;
};
virtual std::vector<Example> Examples() { return {}; }
};
std::map<std::string, std::string> SerializeOption(const std::string& options);
#endif /* end of include guard: TRANSLATOR_TRANSLATOR */