diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-08-09 07:50:49 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-08-09 07:50:49 +0000 |
commit | 39e77f7d7f8a2c9148fb1c064c2e1437ad378ccb (patch) | |
tree | 7864a810ee7eed2520376e47f26d9b9ec8a12130 /src/configmanager.cpp | |
parent | 3b036371ae3edebb53fd878ddc8c916e78ee1279 (diff) | |
download | libbu++-39e77f7d7f8a2c9148fb1c064c2e1437ad378ccb.tar.gz libbu++-39e77f7d7f8a2c9148fb1c064c2e1437ad378ccb.tar.bz2 libbu++-39e77f7d7f8a2c9148fb1c064c2e1437ad378ccb.tar.xz libbu++-39e77f7d7f8a2c9148fb1c064c2e1437ad378ccb.zip |
Renamed it, it also is no longer a singleton, although your child class could
be.
Diffstat (limited to 'src/configmanager.cpp')
-rw-r--r-- | src/configmanager.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/configmanager.cpp b/src/configmanager.cpp deleted file mode 100644 index 6c239f8..0000000 --- a/src/configmanager.cpp +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <string.h> | ||
3 | #include "xmlnode.h" | ||
4 | #include "xmlfilereader.h" | ||
5 | #include "configmanagerbase.h" | ||
6 | |||
7 | ConfigManagerBase::ConfigManager() | ||
8 | { | ||
9 | } | ||
10 | |||
11 | ConfigManagerBase::~ConfigManager() | ||
12 | { | ||
13 | } | ||
14 | |||
15 | void ConfigManagerBase::addSearchPath( const std::string &sPath ) | ||
16 | { | ||
17 | lSearchPath.push_back( sPath ); | ||
18 | } | ||
19 | |||
20 | void ConfigManagerBase::loadConfig( const char *lpProfile ) | ||
21 | { | ||
22 | // Try a few locations... | ||
23 | std::list<std::string>::const_iterator i; | ||
24 | for( i = lSearchPath.begin(); i != lSearchPath.end(); i++ ) | ||
25 | { | ||
26 | if( parseConfig( (*i).c_str(), lpProfile ) ) | ||
27 | { | ||
28 | break; | ||
29 | } | ||
30 | } | ||
31 | } | ||
32 | |||
33 | bool ConfigManagerBase::parseConfig( const char *lpFileName, const char *lpProfile ) | ||
34 | { | ||
35 | XmlNode *pRoot, *pCur; | ||
36 | XmlFileReader doc( lpFileName ); | ||
37 | |||
38 | pRoot = doc.getRoot(); | ||
39 | if( pRoot == NULL ) | ||
40 | { | ||
41 | return false; | ||
42 | } | ||
43 | |||
44 | if( strcmp("config", pRoot->getName() ) ) | ||
45 | { | ||
46 | return false; | ||
47 | } | ||
48 | |||
49 | for( int j = 0;; j++ ) | ||
50 | { | ||
51 | pCur = pRoot->getChild( "profile", j ); | ||
52 | if( pCur == NULL ) | ||
53 | return false; | ||
54 | |||
55 | if( !strcmp( pCur->getProperty("id"), lpProfile ) ) | ||
56 | { | ||
57 | return processProfile( pCur ); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | return false; | ||
62 | } | ||
63 | |||