comparison include/animone/player.h @ 21:973734ebd2be

dep/animone: REFACTOR ALL THE THINGS 1: animone now has its own syntax divergent from anisthesia, making different platforms actually have their own sections 2: process names in animone are now called `comm' (this will probably break things). this is what its called in bsd/linux so I'm just going to use it everywhere 3: the X11 code now checks for the existence of a UTF-8 window title and passes it if available 4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK! I still actually need to test the bsd code. to be honest I'm probably going to move all of the bsds into separate files because they're all essentially different operating systems at this point
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 12:51:15 -0400
parents 27b988a1048c
children 60ded877339b
comparison
equal deleted inserted replaced
20:7174ff20498d 21:973734ebd2be
1 #ifndef ANIMONE_ANIMONE_PLAYER_H_ 1 #ifndef ANIMONE_ANIMONE_PLAYER_H_
2 #define ANIMONE_ANIMONE_PLAYER_H_ 2 #define ANIMONE_ANIMONE_PLAYER_H_
3 3
4 #include <string> 4 #include <string>
5 #include <vector> 5 #include <vector>
6 #include <map>
6 7
7 namespace animone { 8 namespace animone {
9
10 enum class ExecutablePlatform {
11 Posix, // Posix platforms that aren't OS X
12 Win32, // Windows
13 Xnu, // OS X
14 Unknown, // ...
15 };
16
17 enum class WindowPlatform {
18 Quartz, // OS X
19 Win32, // Windows
20 X11, // X11
21 Unknown, // ...
22 };
8 23
9 enum class Strategy { 24 enum class Strategy {
10 WindowTitle, 25 WindowTitle,
11 OpenFiles, 26 OpenFiles,
12 UiAutomation // unused 27 UiAutomation // unused
19 34
20 struct Player { 35 struct Player {
21 PlayerType type = PlayerType::Default; 36 PlayerType type = PlayerType::Default;
22 std::string name; 37 std::string name;
23 std::string window_title_format; 38 std::string window_title_format;
24 std::vector<std::string> windows; 39 std::map<WindowPlatform, std::vector<std::string>> windows;
25 std::vector<std::string> executables; 40 std::map<ExecutablePlatform, std::vector<std::string>> executables;
26 std::vector<Strategy> strategies; 41 std::vector<Strategy> strategies;
27 }; 42 };
28 43
29 bool ParsePlayersData(const std::string& data, std::vector<Player>& players); 44 bool ParsePlayersData(const std::string& data, std::vector<Player>& players);
30 bool ParsePlayersFile(const std::string& path, std::vector<Player>& players); 45 bool ParsePlayersFile(const std::string& path, std::vector<Player>& players);