comparison foosdk/sdk/foobar2000/helpers/metadb_io_hintlist.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 #include "metadb_info_container_impl.h"
4 #include <SDK/input.h>
5 #include <SDK/filesystem.h>
6 #include <SDK/metadb.h>
7
8
9 // Obsolete, use metadb_hint_list instead when possible, wrapper provided for compatibility with old code
10
11 class metadb_io_hintlist {
12 public:
13 void hint_reader(service_ptr_t<input_info_reader> p_reader, const char * p_path,abort_callback & p_abort) {
14 init();
15 m_hints->add_hint_reader( p_path, p_reader, p_abort );
16 m_pendingCount += p_reader->get_subsong_count();
17 }
18 void add(metadb_handle_ptr const& h, const file_info& i, t_filestats2 const& s, bool f) {
19 init();
20 metadb_hint_list_v3::ptr v3;
21 v3 ^= m_hints;
22
23 auto infoObj = fb2k::service_new< metadb_info_container_const_impl >();
24 infoObj->m_info = i; infoObj->m_stats = s;
25 v3->add_hint_v3(h, infoObj, f);
26
27 ++m_pendingCount;
28 }
29 void add(metadb_handle_ptr const & p_handle,const file_info & p_info,t_filestats const & p_stats,bool p_fresh) {
30 init();
31 m_hints->add_hint( p_handle, p_info, p_stats, p_fresh );
32 ++m_pendingCount;
33 }
34 void run() {
35 if ( m_hints.is_valid() ) {
36 m_hints->on_done();
37 m_hints.release();
38 }
39 m_pendingCount = 0;
40 }
41 size_t get_pending_count() const { return m_pendingCount; }
42 private:
43 void init() {
44 if ( m_hints.is_empty() ) {
45 m_hints = metadb_io_v2::get()->create_hint_list();
46 }
47 }
48 metadb_hint_list::ptr m_hints;
49 size_t m_pendingCount = 0;
50 };