diff foosdk/sdk/foobar2000/SDK/callback_merit.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/foosdk/sdk/foobar2000/SDK/callback_merit.h	Mon Jan 05 02:15:46 2026 -0500
@@ -0,0 +1,24 @@
+#pragma once
+
+namespace fb2k {
+	// callback_merit_t controls in what order callbacks are executed. \n
+	// In specific corner cases, you want your callback executed before other callbacks of the same kind.
+	typedef double callback_merit_t;
+
+	// Note REVERSE sort. HIGHER merit called first.
+	static constexpr callback_merit_t callback_merit_default = 0;
+	static constexpr callback_merit_t callback_merit_indexer = 1000; // indexer: does nothing else than updating internal state, called early before UI updates, in case UI updates might rely on indexed data.
+	static constexpr callback_merit_t callback_merit_serializer = 2000; // serializer: does nothing else than saving new state, called early.
+
+	//! Special class that can be optionally implemented by 'static' callbacks, such as library_callback, to control callback merit. \n
+	//! See also: callback_merit_t \n
+	//! Some callback classes support get_callback_merit() natively, such as metadb_io_callback_v2. \n
+	//! With callbacks registered dynamically, other means of controlling merit are provided.
+	class callback_with_merit : public service_base {
+		FB2K_MAKE_SERVICE_INTERFACE(callback_with_merit, service_base);
+	public:
+		virtual callback_merit_t get_callback_merit() = 0;
+	};
+
+	callback_merit_t callback_merit_of(service_ptr obj);
+}
\ No newline at end of file