comparison 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
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 namespace fb2k {
4 // callback_merit_t controls in what order callbacks are executed. \n
5 // In specific corner cases, you want your callback executed before other callbacks of the same kind.
6 typedef double callback_merit_t;
7
8 // Note REVERSE sort. HIGHER merit called first.
9 static constexpr callback_merit_t callback_merit_default = 0;
10 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.
11 static constexpr callback_merit_t callback_merit_serializer = 2000; // serializer: does nothing else than saving new state, called early.
12
13 //! Special class that can be optionally implemented by 'static' callbacks, such as library_callback, to control callback merit. \n
14 //! See also: callback_merit_t \n
15 //! Some callback classes support get_callback_merit() natively, such as metadb_io_callback_v2. \n
16 //! With callbacks registered dynamically, other means of controlling merit are provided.
17 class callback_with_merit : public service_base {
18 FB2K_MAKE_SERVICE_INTERFACE(callback_with_merit, service_base);
19 public:
20 virtual callback_merit_t get_callback_merit() = 0;
21 };
22
23 callback_merit_t callback_merit_of(service_ptr obj);
24 }