foobar2000 SDK  2015-08-03
cfg_guidlist.h
Go to the documentation of this file.
1 class cfg_guidlist : public cfg_var, public pfc::list_t<GUID>
2 {
3 public:
4  void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
5  t_uint32 n, m = pfc::downcast_guarded<t_uint32>(get_count());
6  p_stream->write_lendian_t(m,p_abort);
7  for(n=0;n<m;n++) p_stream->write_lendian_t(get_item(n),p_abort);
8  }
9  void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
10  t_uint32 n,count;
11  p_stream->read_lendian_t(count,p_abort);
12  m_buffer.set_size(count);
13  for(n=0;n<count;n++) {
14  try {
15  p_stream->read_lendian_t(m_buffer[n],p_abort);
16  } catch(...) {m_buffer.set_size(0); throw;}
17  }
18  }
19 
21 
22  bool have_item_bsearch(const GUID & p_item) {
23  t_size dummy;
24  return bsearch_t(pfc::guid_compare,p_item,dummy);
25  }
26 
27 public:
28  cfg_guidlist(const GUID & p_guid) : cfg_var(p_guid) {}
29 };
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
Definition: cfg_guidlist.h:4
Definition: pfc.h:71
bool have_item_bsearch(const GUID &p_item)
Definition: cfg_guidlist.h:22
cfg_guidlist(const GUID &p_guid)
Definition: cfg_guidlist.h:28
bool bsearch_t(t_compare p_compare, t_param const &p_param, t_size &p_index) const
Definition: list.h:45
int guid_compare(const GUID &g1, const GUID &g2)
Definition: guid.h:18
size_t t_size
Definition: int_types.h:48
void set_size(t_size p_size)
Definition: array.h:104
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
Definition: cfg_guidlist.h:9
Base class for configuration variable classes; provides self-registration mechaisms and methods to se...
Definition: cfg_var.h:54
uint32_t t_uint32
Definition: int_types.h:5