Last change
on this file since 13640 was 5503, checked in by sjboddie, 21 years ago |
* empty log message *
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Rev | Line | |
---|
[5503] | 1 | #if defined(GSDL_USE_OBJECTSPACE)
|
---|
| 2 | # include <ospace/std/iostream>
|
---|
| 3 | # include <ospace/std/fstream>
|
---|
| 4 | #elif defined(GSDL_USE_IOS_H)
|
---|
| 5 | # include <iostream.h>
|
---|
| 6 | # include <fstream.h>
|
---|
| 7 | #else
|
---|
| 8 | # include <iostream>
|
---|
| 9 | # include <fstream>
|
---|
| 10 | #endif
|
---|
| 11 |
|
---|
| 12 | #include "cnfgator.h"
|
---|
| 13 |
|
---|
| 14 | configurator::configurator(configurable *configureobject) {
|
---|
| 15 | configureobjs.push_back(configureobject);
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | void configurator::add_configurable(configurable *configureobject) {
|
---|
| 19 | configureobjs.push_back(configureobject);
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | bool configurator::configure(text_t filename) {
|
---|
| 23 | // read in the build configuration file
|
---|
| 24 | text_t key;
|
---|
| 25 | text_tarray cfgline;
|
---|
| 26 | char *cstr = filename.getcstr();
|
---|
| 27 | ifstream confin (cstr);
|
---|
| 28 | delete cstr;
|
---|
| 29 |
|
---|
| 30 | if (confin) {
|
---|
| 31 | while (read_cfg_line(confin, cfgline) >= 0) {
|
---|
| 32 | if (cfgline.size () >= 2) {
|
---|
| 33 | key = cfgline[0];
|
---|
| 34 | cfgline.erase(cfgline.begin());
|
---|
| 35 |
|
---|
| 36 | // configure the configurables
|
---|
| 37 | configurable *configureObject;
|
---|
| 38 | vector<configurable *>::iterator configureIter = configureobjs.begin();
|
---|
| 39 |
|
---|
| 40 | while (configureIter != configureobjs.end()) {
|
---|
| 41 | configureObject = *configureIter;
|
---|
| 42 | configureIter ++;
|
---|
| 43 |
|
---|
| 44 | configureObject->configure (key, cfgline);
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | confin.close ();
|
---|
| 49 | return true;
|
---|
| 50 | }
|
---|
| 51 | return false;
|
---|
| 52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.