foobar2000 SDK  2015-08-03
Public Member Functions | Protected Member Functions | Private Attributes
cfg_int_t< t_inttype >

#include <cfg_var.h>

+ Inheritance diagram for cfg_int_t< t_inttype >:

Public Member Functions

 cfg_int_t (const GUID &p_guid, t_inttype p_default)
 
t_inttype get_value () const
 
 operator t_inttype () const
 
const cfg_int_t< t_inttype > & operator= (const cfg_int_t< t_inttype > &p_val)
 
t_inttype operator= (t_inttype 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_inttype 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_inttype>
class cfg_int_t< t_inttype >

Generic integer config variable class. Template parameter can be used to specify integer type to use.
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 65 of file cfg_var.h.

Constructor & Destructor Documentation

template<typename t_inttype>
cfg_int_t< t_inttype >::cfg_int_t ( const GUID p_guid,
t_inttype  p_default 
)
inlineexplicit
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.
p_defaultDefault value of the variable.

Definition at line 79 of file cfg_var.h.

79 : cfg_var(p_guid), m_val(p_default) {}
t_inttype m_val
Definition: cfg_var.h:67
cfg_var(const GUID &p_guid)
Definition: cfg_var.h:57

Member Function Documentation

template<typename t_inttype>
void cfg_int_t< t_inttype >::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 69 of file cfg_var.h.

69 {p_stream->write_lendian_t(m_val,p_abort);}
t_inttype m_val
Definition: cfg_var.h:67
template<typename t_inttype>
t_inttype cfg_int_t< t_inttype >::get_value ( ) const
inline

Definition at line 86 of file cfg_var.h.

86 {return m_val;}
t_inttype m_val
Definition: cfg_var.h:67
template<typename t_inttype>
cfg_int_t< t_inttype >::operator t_inttype ( ) const
inline

Definition at line 84 of file cfg_var.h.

84 {return m_val;}
t_inttype m_val
Definition: cfg_var.h:67
template<typename t_inttype>
const cfg_int_t<t_inttype>& cfg_int_t< t_inttype >::operator= ( const cfg_int_t< t_inttype > &  p_val)
inline

Definition at line 81 of file cfg_var.h.

81 {m_val=p_val.m_val;return *this;}
t_inttype m_val
Definition: cfg_var.h:67
template<typename t_inttype>
t_inttype cfg_int_t< t_inttype >::operator= ( t_inttype  p_val)
inline

Definition at line 82 of file cfg_var.h.

82 {m_val=p_val;return m_val;}
t_inttype m_val
Definition: cfg_var.h:67
template<typename t_inttype>
void cfg_int_t< t_inttype >::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 70 of file cfg_var.h.

70  {
71  t_inttype temp;
72  p_stream->read_lendian_t(temp,p_abort);//alter member data only on success, this will throw an exception when something isn't right
73  m_val = temp;
74  }
t_inttype m_val
Definition: cfg_var.h:67

Field Documentation

template<typename t_inttype>
t_inttype cfg_int_t< t_inttype >::m_val
private

Definition at line 67 of file cfg_var.h.


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