Mercurial > libanimone
comparison include/animone/player.h @ 32:93224b26a0ee default tip
player: efforts towards C-ization
author | Paper <paper@tflc.us> |
---|---|
date | Mon, 10 Feb 2025 19:17:29 -0500 |
parents | 60ded877339b |
children |
comparison
equal
deleted
inserted
replaced
31:668f4f31ddda | 32:93224b26a0ee |
---|---|
7 #include <vector> | 7 #include <vector> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 namespace animone { | 10 namespace animone { |
11 | 11 |
12 /* TODO convert to plain C enums */ | |
12 enum class ExecutablePlatform { | 13 enum class ExecutablePlatform { |
14 Unknown, // ... | |
13 Posix, // Posix platforms that aren't OS X | 15 Posix, // Posix platforms that aren't OS X |
14 Win32, // Windows | 16 Win32, // Windows |
15 Xnu, // OS X | 17 Xnu, // OS X |
16 Unknown, // ... | |
17 }; | 18 }; |
18 | 19 |
19 enum class WindowPlatform { | 20 enum class WindowPlatform { |
21 Unknown, // ... | |
20 Quartz, // OS X | 22 Quartz, // OS X |
21 Win32, // Windows | 23 Win32, // Windows |
22 X11, // X11 | 24 X11, // X11 |
23 Unknown, // ... | |
24 }; | 25 }; |
25 | 26 |
26 enum class Strategy { | 27 enum class Strategy { |
27 WindowTitle, | 28 WindowTitle, |
28 OpenFiles, | 29 OpenFiles, |
29 UiAutomation // unused | 30 UiAutomation, |
30 }; | 31 }; |
31 | 32 |
32 enum class PlayerType { | 33 enum class PlayerType { |
33 Default, | 34 Default, |
34 WebBrowser // unused | 35 WebBrowser, |
35 }; | 36 }; |
36 | 37 |
37 struct ANIMONE_API Player { | 38 struct ANIMONE_API Player { |
38 PlayerType type = PlayerType::Default; | 39 PlayerType type = PlayerType::Default; |
39 std::string name; | 40 std::string name; |
41 std::map<WindowPlatform, std::vector<std::string>> windows; | 42 std::map<WindowPlatform, std::vector<std::string>> windows; |
42 std::map<ExecutablePlatform, std::vector<std::string>> executables; | 43 std::map<ExecutablePlatform, std::vector<std::string>> executables; |
43 std::vector<Strategy> strategies; | 44 std::vector<Strategy> strategies; |
44 }; | 45 }; |
45 | 46 |
46 ANIMONE_API bool ParsePlayersData(const std::string& data, std::vector<Player>& players); | 47 } |
47 ANIMONE_API bool ParsePlayersFile(const std::string& path, std::vector<Player>& players); | |
48 | 48 |
49 } // namespace animone | 49 #ifdef __cplusplus |
50 extern "C" { | |
51 #endif | |
52 | |
53 int animone_ParsePlayersData(const char *data, std::vector<animone::Player>& players); | |
54 int animone_ParsePlayersData(const char *path, std::vector<animone::Player>& players); | |
55 | |
56 #ifdef __cplusplus | |
57 } | |
58 | |
59 namespace animone { | |
60 | |
61 inline bool ParsePlayersData(const std::string& data, std::vector<Player>& players) | |
62 { | |
63 return !!ParsePlayersData(data.c_str(), players); | |
64 } | |
65 inline bool ParsePlayersFile(const std::string& path, std::vector<Player>& players) | |
66 { | |
67 return !!ParsePlayersFile(path.c_str(), players); | |
68 } | |
69 | |
70 } | |
71 | |
72 #endif | |
50 | 73 |
51 #endif // ANIMONE_ANIMONE_PLAYER_H_ | 74 #endif // ANIMONE_ANIMONE_PLAYER_H_ |