diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:21:22 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:21:22 +0000 |
| commit | 371cf3aa2a132401a4557e227577a9f3a57f4477 (patch) | |
| tree | 1ce345520f684fd56ed1445d237e14174f6e6dd7 /conf.cpp | |
| parent | 58885c244c2b9625d0917797dedd3850bf07ae53 (diff) | |
Diffstat (limited to 'conf.cpp')
| -rw-r--r-- | conf.cpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/conf.cpp b/conf.cpp deleted file mode 100644 index 3ff71b8..0000000 --- a/conf.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// class conf implementation. - -#ifndef s_conf_CXX -#define s_conf_CXX - -#include <fstream> -#include "conf.h" - -using namespace std; - -conf::conf( string s_conf = CONFILE ) : name( s_conf ) -{ - parse( ); // parse the config file. -} - -conf::~conf() -{ -} - -void -conf::parse() -{ -#ifdef VERBOSE - cout << CFILEOK << get_name() << endl; -#endif - - ifstream fs_conf( get_name().c_str() ); - - if ( ! fs_conf ) - { -#ifdef VERBOSE - cout << CFILENO << get_name() << endl; -#endif - return; - } - - char c_buf[READBUF]; - - while( fs_conf.getline( c_buf, READBUF ) ) - { - string s_token( c_buf ); - unsigned int ui_pos = s_token.find( "#", 0 ); - - // if line is commented out: - if ( ui_pos == 0 ) - continue; - - ui_pos = s_token.find( ";", 0 ); - - // if token has not been found. - if ( ui_pos == string::npos ) - continue; - - s_token = s_token.substr( 0 , --ui_pos ); - ui_pos = s_token.find ( "\"", 0 ); - - if ( ui_pos == string::npos ) - continue; - - string s_val = s_token.substr( ui_pos+1, s_token.length() ); - string s_key = s_token.substr( 0 , --ui_pos ); - -#ifdef VERBOSE2 - cout << s_key << "=" << s_val << endl; -#endif - - // fill the map. - map_vals[s_key] = s_val; - } - - fs_conf.close(); - fs_conf.~ifstream(); -} - -#endif |
