foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes | Static Private Attributes
cfg_var_readerabstract

#include <cfg_var.h>

+ Inheritance diagram for cfg_var_reader:

Public Member Functions

 cfg_var_reader (const GUID &guid)
 
 ~cfg_var_reader ()
 
virtual void set_data_raw (stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)=0
 

Static Public Member Functions

static void config_read_file (stream_reader *p_stream, abort_callback &p_abort)
 

Data Fields

const GUID m_guid
 

Private Attributes

cfg_var_readerm_next
 

Static Private Attributes

static cfg_var_readerg_list = NULL
 

Detailed Description

Reader part of cfg_var object. In most cases, you should use cfg_var instead of using cfg_var_reader directly.

Definition at line 8 of file cfg_var.h.

Constructor & Destructor Documentation

cfg_var_reader::cfg_var_reader ( const GUID guid)
inline
Parameters
p_guidGUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.

Definition at line 11 of file cfg_var.h.

11 : m_guid(guid) { CFG_VAR_ASSERT_SAFEINIT; m_next = g_list; g_list = this; }
const GUID m_guid
Definition: cfg_var.h:22
cfg_var_reader * m_next
Definition: cfg_var.h:25
static cfg_var_reader * g_list
Definition: cfg_var.h:24
cfg_var_reader::~cfg_var_reader ( )
inline

Definition at line 12 of file cfg_var.h.

12 { CFG_VAR_ASSERT_SAFEINIT; }

Member Function Documentation

void cfg_var_reader::config_read_file ( stream_reader p_stream,
abort_callback p_abort 
)
static

For internal use only, do not call.

Definition at line 6 of file cfg_var.cpp.

7 {
9  for(cfg_var_reader * walk = g_list; walk != NULL; walk = walk->m_next) {
10  vars.set(walk->m_guid,walk);
11  }
12  for(;;) {
13 
14  GUID guid;
15  t_uint32 size;
16 
17  if (p_stream->read(&guid,sizeof(guid),p_abort) != sizeof(guid)) break;
18  guid = pfc::byteswap_if_be_t(guid);
19  p_stream->read_lendian_t(size,p_abort);
20 
21  cfg_var_reader * var;
22  if (vars.query(guid,var)) {
23  stream_reader_limited_ref wrapper(p_stream,size);
24  try {
25  var->set_data_raw(&wrapper,size,p_abort);
26  } catch(exception_io_data) {}
27  wrapper.flush_remaining(p_abort);
28  } else {
29  p_stream->skip_object(size,p_abort);
30  }
31  }
32 }
Definition: map.h:16
virtual void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)=0
Sets state of the variable. Called only from main thread, when reading configuration file...
Definition: pfc.h:71
cfg_var_reader * m_next
Definition: cfg_var.h:25
Reader part of cfg_var object. In most cases, you should use cfg_var instead of using cfg_var_reader ...
Definition: cfg_var.h:8
static cfg_var_reader * g_list
Definition: cfg_var.h:24
void set(const _t_key &p_key, const _t_value &p_value)
Definition: map.h:22
T byteswap_if_be_t(T p_param)
uint32_t t_uint32
Definition: int_types.h:5
bool query(const _t_key &p_key, _t_value &p_value) const
Definition: map.h:44
virtual void cfg_var_reader::set_data_raw ( stream_reader p_stream,
t_size  p_sizehint,
abort_callback p_abort 
)
pure virtual

Sets state of the variable. Called only from main thread, when reading configuration file.

Parameters
p_streamStream containing new state of the variable.
p_sizehintNumber of bytes contained in the stream; reading past p_sizehint bytes will fail (EOF).

Implemented in cfg_dsp_chain_config, cfgDialogPosition, cfg_objMap< TMap >, cfg_objListImporter< TObj, TImport >, cfg_obj< TObj >, cfg_objListEx< TList >, cfg_objList< TObj >, cfg_struct_t< t_struct >, cfg_string_mt, cfg_string, config_object_fixed_impl_t< p_size >, cfg_int_t< t_inttype >, cfg_int_t< t_uint64 >, cfg_int_t< bool >, cfgWindowSize, config_object_impl, cfg_window_size, cfg_window_placement, and cfg_guidlist.

Field Documentation

cfg_var_reader * cfg_var_reader::g_list = NULL
staticprivate

Definition at line 24 of file cfg_var.h.

const GUID cfg_var_reader::m_guid

Definition at line 22 of file cfg_var.h.

cfg_var_reader* cfg_var_reader::m_next
private

Definition at line 25 of file cfg_var.h.


The documentation for this class was generated from the following files: