diff 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
line wrap: on
line diff
--- a/include/animone/player.h	Mon Feb 10 00:07:21 2025 -0500
+++ b/include/animone/player.h	Mon Feb 10 19:17:29 2025 -0500
@@ -9,29 +9,30 @@
 
 namespace animone {
 
+/* TODO convert to plain C enums */
 enum class ExecutablePlatform {
+	Unknown, // ...
 	Posix,   // Posix platforms that aren't OS X
 	Win32,   // Windows
 	Xnu,     // OS X
-	Unknown, // ...
 };
 
 enum class WindowPlatform {
+	Unknown, // ...
 	Quartz,  // OS X
 	Win32,   // Windows
 	X11,     // X11
-	Unknown, // ...
 };
 
 enum class Strategy {
 	WindowTitle,
 	OpenFiles,
-	UiAutomation // unused
+	UiAutomation,
 };
 
 enum class PlayerType {
 	Default,
-	WebBrowser // unused
+	WebBrowser,
 };
 
 struct ANIMONE_API Player {
@@ -43,9 +44,31 @@
 	std::vector<Strategy> strategies;
 };
 
-ANIMONE_API bool ParsePlayersData(const std::string& data, std::vector<Player>& players);
-ANIMONE_API bool ParsePlayersFile(const std::string& path, std::vector<Player>& players);
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int animone_ParsePlayersData(const char *data, std::vector<animone::Player>& players);
+int animone_ParsePlayersData(const char *path, std::vector<animone::Player>& players);
+
+#ifdef __cplusplus
+}
 
-} // namespace animone
+namespace animone {
+
+inline bool ParsePlayersData(const std::string& data, std::vector<Player>& players)
+{
+	return !!ParsePlayersData(data.c_str(), players);
+}
+inline bool ParsePlayersFile(const std::string& path, std::vector<Player>& players)
+{
+	return !!ParsePlayersFile(path.c_str(), players);
+}
+
+}
+
+#endif
 
 #endif // ANIMONE_ANIMONE_PLAYER_H_
\ No newline at end of file