#include <Configurator.h>

Definition at line 119 of file Configurator.h.
Public Member Functions | |
| CConfigurator (class CConfigurator *parent, char *name, char *value, char *text, size_t textlen) | |
| Constructor. | |
| ~CConfigurator (void) | |
| Destructor. | |
| char * | strip_string (char *c) |
| Reduce a quoted string to it's real value. | |
| void | add_value (char *n, char *v) |
| Add a value to our list of values. | |
| char * | get_text_value (const char *n) |
| char * | get_text_value (const char *n, const char *def) |
| Return a text value, if the name of the value can't be found in our list of values, return def. | |
| bool | get_bool_value (const char *n) |
| bool | get_bool_value (const char *n, bool def) |
| Return a boolean value, if the name of the value can't be found in our list of values, or if the value isn't valid, return def. | |
| u64 | get_num_value (const char *n, bool decimal_suffixes) |
| u64 | get_num_value (const char *n, bool decimal_suffixes, u64 def) |
| Return a numeric value, if the name of the value can't be found in our list of values, return def. | |
| classid | get_class_id () |
| void * | get_device () |
| int | get_flags () |
| char * | get_myName () |
| char * | get_myValue () |
| CConfigurator * | get_myParent () |
| void | initialize () |
| Determine what device this configurator represents, and instantiate it; then call initialize for our children. | |
Private Attributes | |
| class CConfigurator * | pParent |
| class CConfigurator * | pChildren [25] |
| int | iNumChildren |
| char * | myName |
| char * | myValue |
| void * | myDevice |
| classid | myClassId |
| int | myFlags |
| int | iNumValues |
| struct CConfigurator::SCfg_Value | pValues [50] |
Data Structures | |
| struct | SCfg_Value |
| CConfigurator::CConfigurator | ( | class CConfigurator * | parent, | |
| char * | name, | |||
| char * | value, | |||
| char * | text, | |||
| size_t | textlen | |||
| ) |
Constructor.
The portion of the configuration file that corresponds with the device we are the configurator for is passed as text, with a length of textlen. We parse this text portion, creating values and children configurators as needed. If parent is NULL, we are the master configurator, and we will call initialize for our children (probably GUI and System) so they can instantiate the classes that correspond to the devices that they configure for. The children will in turn initialize their children.
Definition at line 157 of file Configurator.cpp.
References add_value(), FAILURE_2, FAILURE_3, initialize(), iNumChildren, iNumValues, myFlags, myName, myValue, pChildren, pParent, and strip_string().
| CConfigurator::~CConfigurator | ( | void | ) |
Destructor.
Definition at line 484 of file Configurator.cpp.
| char * CConfigurator::strip_string | ( | char * | c | ) |
Reduce a quoted string to it's real value.
Some values are enclosed in double quotes("), in this case, we take off the quotes, and replace all double double quotes ("") with single double quotes ("). Quoting values is particularly useful if values contain forbidden characters such as spaces, quotes, semicolons, etc. e.g. a text like "c:\program files\putty\putty.exe" telnet://localhost:8000 should be quoted as """c: files\putty\putty.exe"" telnet://localhost:8000"
Definition at line 497 of file Configurator.cpp.
Referenced by CConfigurator().
| void CConfigurator::add_value | ( | char * | n, | |
| char * | v | |||
| ) |
Add a value to our list of values.
Definition at line 528 of file Configurator.cpp.
References iNumValues, CConfigurator::SCfg_Value::name, pValues, and CConfigurator::SCfg_Value::value.
Referenced by CConfigurator().
| char* CConfigurator::get_text_value | ( | const char * | n | ) | [inline] |
Definition at line 129 of file Configurator.h.
Referenced by CDisk::CDisk(), CDiskDevice::CDiskDevice(), CDiskFile::CDiskFile(), CDiskRam::CDiskRam(), CS3Trio64::init(), CDEC21143::init(), CCirrus::init(), CAliM1543C::init(), bx_keymap_c::loadKeymap(), CSystem::LoadROM(), CFlash::RestoreStateF(), CDPR::RestoreStateF(), CFlash::SaveStateF(), CDPR::SaveStateF(), and CSerial::WaitForConnection().
| char * CConfigurator::get_text_value | ( | const char * | n, | |
| const char * | def | |||
| ) |
Return a text value, if the name of the value can't be found in our list of values, return def.
Definition at line 539 of file Configurator.cpp.
References iNumValues, pValues, and CConfigurator::SCfg_Value::value.
| bool CConfigurator::get_bool_value | ( | const char * | n | ) | [inline] |
Definition at line 132 of file Configurator.h.
Referenced by CDisk::CDisk(), bx_sdl_gui_c::handle_events(), CKeyboard::init(), CDEC21143::init(), CAlphaCPU::init(), CAliM1543C_ide::init(), CAliM1543C::init(), bx_keymap_c::loadKeymap(), CAlphaCPU::restore_icache(), bx_sdl_gui_c::specific_init(), bx_x11_gui_c::specific_init(), and bx_win32_gui_c::specific_init().
| bool CConfigurator::get_bool_value | ( | const char * | n, | |
| bool | def | |||
| ) |
Return a boolean value, if the name of the value can't be found in our list of values, or if the value isn't valid, return def.
Valid values are strings that have a first character of:
Definition at line 564 of file Configurator.cpp.
References FAILURE_2, iNumValues, and pValues.
| u64 CConfigurator::get_num_value | ( | const char * | n, | |
| bool | decimal_suffixes | |||
| ) | [inline] |
Definition at line 135 of file Configurator.h.
Referenced by CDiskFile::CDiskFile(), CDiskRam::CDiskRam(), CSystem::CSystem(), CSerial::init(), CDEC21143::init(), and CAlphaCPU::init().
Return a numeric value, if the name of the value can't be found in our list of values, return def.
Definition at line 601 of file Configurator.cpp.
References FAILURE_2, iNumValues, pValues, and CConfigurator::SCfg_Value::value.
| classid CConfigurator::get_class_id | ( | ) | [inline] |
| void* CConfigurator::get_device | ( | ) | [inline] |
| int CConfigurator::get_flags | ( | ) | [inline] |
| char* CConfigurator::get_myName | ( | ) | [inline] |
Definition at line 145 of file Configurator.h.
References myName.
Referenced by CDisk::CDisk(), CSystem::CSystem(), CSystemComponent::CSystemComponent(), CPCIDevice::ReadMem(), CPCIDevice::ReadMem_Bar(), CPCIDevice::ReadMem_Legacy(), CPCIDevice::register_bar(), CPCIDevice::WriteMem(), CPCIDevice::WriteMem_Bar(), and CPCIDevice::WriteMem_Legacy().
| char* CConfigurator::get_myValue | ( | ) | [inline] |
Definition at line 146 of file Configurator.h.
References myValue.
Referenced by CDisk::CDisk(), CSystem::CSystem(), CSystemComponent::CSystemComponent(), CPCIDevice::ReadMem(), CPCIDevice::ReadMem_Bar(), CPCIDevice::ReadMem_Legacy(), CPCIDevice::register_bar(), CPCIDevice::WriteMem(), CPCIDevice::WriteMem_Bar(), and CPCIDevice::WriteMem_Legacy().
| CConfigurator* CConfigurator::get_myParent | ( | ) | [inline] |
| void CConfigurator::initialize | ( | ) |
Determine what device this configurator represents, and instantiate it; then call initialize for our children.
Definition at line 708 of file Configurator.cpp.
References bx_gui, c_ali, c_ali_ide, c_ali_usb, c_cirrus, c_dec21143, c_device, c_ev68cb, c_file, c_none, c_radeon, c_ramdisk, c_s3, c_sdl, c_serial, c_sym53c810, c_sym53c895, c_tsunami, c_win32, c_x11, FAILURE_2, classinfo::flags, get_device(), get_flags(), HAS_DISK, HAS_PCI, classinfo::id, iNumChildren, IS_CS, IS_DISK, IS_GUI, IS_NIC, IS_PCI, myClassId, myDevice, myFlags, myName, myValue, N_P, ON_CS, ON_GUI, pChildren, PLUG_load_plugin, pParent, and theSystem.
Referenced by CConfigurator().
class CConfigurator* CConfigurator::pParent [private] |
Definition at line 151 of file Configurator.h.
Referenced by CConfigurator(), get_myParent(), and initialize().
class CConfigurator* CConfigurator::pChildren[25] [private] |
int CConfigurator::iNumChildren [private] |
char* CConfigurator::myName [private] |
Definition at line 154 of file Configurator.h.
Referenced by CConfigurator(), get_myName(), and initialize().
char* CConfigurator::myValue [private] |
Definition at line 155 of file Configurator.h.
Referenced by CConfigurator(), get_myValue(), and initialize().
void* CConfigurator::myDevice [private] |
classid CConfigurator::myClassId [private] |
int CConfigurator::myFlags [private] |
Definition at line 158 of file Configurator.h.
Referenced by CConfigurator(), get_flags(), and initialize().
int CConfigurator::iNumValues [private] |
Definition at line 159 of file Configurator.h.
Referenced by add_value(), CConfigurator(), get_bool_value(), get_num_value(), and get_text_value().
struct CConfigurator::SCfg_Value CConfigurator::pValues[ 50 ] [private] |
Referenced by add_value(), get_bool_value(), get_num_value(), and get_text_value().