From 2f33a0fd249a06c7143f69f71078bb649eed5240 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Sun, 21 Oct 2007 08:43:24 +0000 Subject: [PATCH] Add function to list all configuration details. (moe) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3024 --- include/setup.h | 4 +++- src/misc/setup.cpp | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/setup.h b/include/setup.h index 39f57604..ad50ddfc 100644 --- a/include/setup.h +++ b/include/setup.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.h,v 1.27 2007-06-14 08:23:46 qbix79 Exp $ */ +/* $Id: setup.h,v 1.28 2007-10-21 08:43:24 qbix79 Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H @@ -168,6 +168,7 @@ public: void Add_hex(char const * const _propname, int _value=0); void Add_float(char const * const _propname, float _value=0.0); + Property* Get_prop(int index); int Get_int(char const * const _propname) const; const char* Get_string(char const * const _propname) const; bool Get_bool(char const * const _propname) const; @@ -207,6 +208,7 @@ public: Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*)); Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false); + Section* GetSection(int index); Section* GetSection(char const* const _sectionname) const; Section* GetSectionFromProperty(char const * const prop) const; diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index ace47e87..842cbdfc 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.cpp,v 1.40 2007-06-27 14:51:30 qbix79 Exp $ */ +/* $Id: setup.cpp,v 1.41 2007-10-21 08:43:24 qbix79 Exp $ */ #include "dosbox.h" #include "cross.h" @@ -129,6 +129,13 @@ float Section_prop::Get_float(char const * const _propname) const { return false; } +Property* Section_prop::Get_prop(int index){ + for(it tel=properties.begin();tel!=properties.end();tel++){ + if(!index--) return (*tel); + } + return NULL; +} + const char* Section_prop::Get_string(char const * const _propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ if((*tel)->propname==_propname){ @@ -290,6 +297,13 @@ Config::~Config() { } } +Section* Config::GetSection(int index){ + for (it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ + if (!index--) return (*tel); + } + return NULL; +} + Section* Config::GetSection(char const * const _sectionname) const{ for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ if (!strcasecmp((*tel)->GetName(),_sectionname)) return (*tel);