foobar2000 SDK  2015-01-14
Public Member Functions | Protected Member Functions | Private Attributes
cfg_struct_t< t_struct >

#include <cfg_var.h>

+ Inheritance diagram for cfg_struct_t< t_struct >:

Public Member Functions

 cfg_struct_t (const GUID &p_guid, const t_struct &p_val)
 
 cfg_struct_t (const GUID &p_guid, int filler)
 
const t_struct & get_value () const
 
t_struct & get_value ()
 
 operator t_struct () const
 
const cfg_struct_t< t_struct > & operator= (const cfg_struct_t< t_struct > &p_val)
 
const cfg_struct_t< t_struct > & operator= (const t_struct &p_val)
 
- Public Member Functions inherited from cfg_var
GUID get_guid () const
 
- Public Member Functions inherited from cfg_var_reader
 cfg_var_reader (const GUID &guid)
 
 ~cfg_var_reader ()
 
- Public Member Functions inherited from cfg_var_writer
 cfg_var_writer (const GUID &guid)
 
 ~cfg_var_writer ()
 

Protected Member Functions

void get_data_raw (stream_writer *p_stream, abort_callback &p_abort)
 
void set_data_raw (stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
 
- Protected Member Functions inherited from cfg_var
 cfg_var (const GUID &p_guid)
 

Private Attributes

t_struct m_val
 

Additional Inherited Members

- Static Public Member Functions inherited from cfg_var_reader
static void config_read_file (stream_reader *p_stream, abort_callback &p_abort)
 
- Static Public Member Functions inherited from cfg_var_writer
static void config_write_file (stream_writer *p_stream, abort_callback &p_abort)
 
- Data Fields inherited from cfg_var_reader
const GUID m_guid
 
- Data Fields inherited from cfg_var_writer
const GUID m_guid
 

Detailed Description

template<typename t_struct>
class cfg_struct_t< t_struct >

Struct config variable template. Warning: not endian safe, should be used only for nonportable code.
Note that cfg_var class and its derivatives may be only instantiated statically (as static objects or members of other static objects), NEVER dynamically (operator new, local variables, members of objects instantiated as such).

Definition at line 143 of file cfg_var.h.

Constructor & Destructor Documentation

template<typename t_struct>
cfg_struct_t< t_struct >::cfg_struct_t ( const GUID p_guid,
const t_struct &  p_val 
)
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 156 of file cfg_var.h.

156 : cfg_var(p_guid), m_val(p_val) {}
cfg_var(const GUID &p_guid)
Definition: cfg_var.h:57
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
cfg_struct_t< t_struct >::cfg_struct_t ( const GUID p_guid,
int  filler 
)
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 158 of file cfg_var.h.

158 : cfg_var(p_guid) {memset(&m_val,filler,sizeof(t_struct));}
cfg_var(const GUID &p_guid)
Definition: cfg_var.h:57
t_struct m_val
Definition: cfg_var.h:145

Member Function Documentation

template<typename t_struct>
void cfg_struct_t< t_struct >::get_data_raw ( stream_writer p_stream,
abort_callback p_abort 
)
inlineprotectedvirtual

Retrieves state of the variable. Called only from main thread, when writing configuration file.

Parameters
p_streamStream receiving state of the variable.

Implements cfg_var_writer.

Definition at line 148 of file cfg_var.h.

148 {p_stream->write_object(&m_val,sizeof(m_val),p_abort);}
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
const t_struct& cfg_struct_t< t_struct >::get_value ( ) const
inline

Definition at line 163 of file cfg_var.h.

163 {return m_val;}
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
t_struct& cfg_struct_t< t_struct >::get_value ( )
inline

Definition at line 164 of file cfg_var.h.

164 {return m_val;}
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
cfg_struct_t< t_struct >::operator t_struct ( ) const
inline

Definition at line 165 of file cfg_var.h.

165 {return m_val;}
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
const cfg_struct_t<t_struct>& cfg_struct_t< t_struct >::operator= ( const cfg_struct_t< t_struct > &  p_val)
inline

Definition at line 160 of file cfg_var.h.

160 {m_val = p_val.get_value();return *this;}
const t_struct & get_value() const
Definition: cfg_var.h:163
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
const cfg_struct_t<t_struct>& cfg_struct_t< t_struct >::operator= ( const t_struct &  p_val)
inline

Definition at line 161 of file cfg_var.h.

161 {m_val = p_val;return *this;}
t_struct m_val
Definition: cfg_var.h:145
template<typename t_struct>
void cfg_struct_t< t_struct >::set_data_raw ( stream_reader p_stream,
t_size  p_sizehint,
abort_callback p_abort 
)
inlineprotectedvirtual

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).

Implements cfg_var_reader.

Definition at line 149 of file cfg_var.h.

149  {
150  t_struct temp;
151  p_stream->read_object(&temp,sizeof(temp),p_abort);
152  m_val = temp;
153  }
t_struct m_val
Definition: cfg_var.h:145

Field Documentation

template<typename t_struct>
t_struct cfg_struct_t< t_struct >::m_val
private

Definition at line 145 of file cfg_var.h.


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