[Scummvm-cvs-logs] SF.net SVN: scummvm:[51267] scummvm/branches/gsoc2010-testbed/engines/ testbed
sud03r at users.sourceforge.net
sud03r at users.sourceforge.net
Sun Jul 25 00:32:08 CEST 2010
Revision: 51267
http://scummvm.svn.sourceforge.net/scummvm/?rev=51267&view=rev
Author: sud03r
Date: 2010-07-24 22:32:08 +0000 (Sat, 24 Jul 2010)
Log Message:
-----------
TESTBED: removed unnecessary code from config file implementation
Modified Paths:
--------------
scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/config.h
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp 2010-07-24 22:31:31 UTC (rev 51266)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp 2010-07-24 22:32:08 UTC (rev 51267)
@@ -127,50 +127,19 @@
}
}
-void TestbedConfigManager::initConfigFile(Common::WriteStream *ws) {
- Common::String wStr;
- // Global Params
- wStr = "[Global]\n";
- ws->writeString(wStr);
- wStr = "isSessionInteractive";
- wStr += "=";
- wStr += "true\n";
- ws->writeString(wStr);
- ws->writeString("\n");
-
- for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i < _testsuiteList.end(); i++) {
- // Construct the string
- wStr = "[";
- wStr += (*i)->getName();
- wStr += "]\n";
- ws->writeString(wStr);
- wStr = "this";
- wStr += "=";
- wStr += boolToString((*i)->isEnabled());
- wStr += "\n";
- ws->writeString(wStr);
-
- const Common::Array<Test *> &testList = (*i)->getTestList();
- for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
- wStr = (*j)->featureName;
- wStr += "=";
- wStr += boolToString((*j)->enabled);
- wStr += "\n";
- ws->writeString(wStr);
- }
- ws->writeString("\n");
- }
+void TestbedConfigManager::initDefaultConfiguration() {
+ // Default Configuration
+ // Add Global configuration Parameters here.
+ _configFileInterface.setKey("isSessionInteractive", "Global", "true");
}
void TestbedConfigManager::writeTestbedConfigToStream(Common::WriteStream *ws) {
Common::String wStr;
for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i < _testsuiteList.end(); i++) {
- if (_configFileInterface.hasSection((*i)->getName())) {
- _configFileInterface.setKey("this", (*i)->getName(), boolToString((*i)->isEnabled()));
- const Common::Array<Test *> &testList = (*i)->getTestList();
- for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
- _configFileInterface.setKey((*j)->featureName, (*i)->getName(), boolToString((*j)->enabled));
- }
+ _configFileInterface.setKey("this", (*i)->getName(), boolToString((*i)->isEnabled()));
+ const Common::Array<Test *> &testList = (*i)->getTestList();
+ for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
+ _configFileInterface.setKey((*j)->featureName, (*i)->getName(), boolToString((*j)->enabled));
}
}
_configFileInterface.saveToStream(*ws);
@@ -191,10 +160,6 @@
Common::FSNode gameRoot(path);
Common::FSNode config = gameRoot.getChild(_configFileName);
ws = config.createWriteStream();
- if (!config.exists()) {
- Testsuite::logPrintf("Info! No config file found, creating new one\n");
- initConfigFile(ws);
- }
return ws;
}
@@ -203,6 +168,7 @@
if (!rs) {
Testsuite::logPrintf("Info! No config file found, using default configuration.\n");
+ initDefaultConfiguration();
return;
}
_configFileInterface.loadFromStream(*rs);
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/config.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/config.h 2010-07-24 22:31:31 UTC (rev 51266)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.h 2010-07-24 22:32:08 UTC (rev 51267)
@@ -59,7 +59,7 @@
Testsuite *getTestsuiteByName(const Common::String &name);
bool stringToBool(const Common::String str) { return str.equalsIgnoreCase("true") ? true : false; }
Common::String boolToString(bool val) { return val ? "true" : "false"; }
- void initConfigFile(Common::WriteStream *ws);
+ void initDefaultConfiguration();
private:
Common::Array<Testsuite *> &_testsuiteList;
Common::String _configFileName;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list