| Last change
                  on this file since 9984 was
                  9880,
                  checked in by bensch, 19 years ago | 
        
          | 
new implementation of the IniParserNow it is in Full stl-style, with iterators, and it does not have a strange internal state, that makes absolutely no sense
 
 | 
        | File size:
            1.4 KB | 
      
      
        
  | Line |  | 
|---|
| 1 | /* | 
|---|
| 2 | orxonox - the future of 3D-vertical-scrollers | 
|---|
| 3 |  | 
|---|
| 4 | Copyright (C) 2004 orx | 
|---|
| 5 |  | 
|---|
| 6 | This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | it under the terms of the GNU General Public License as published by | 
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 9 | any later version. | 
|---|
| 10 |  | 
|---|
| 11 | ### File Specific: | 
|---|
| 12 | main-programmer: Christoph Renner | 
|---|
| 13 | co-programmer: ... | 
|---|
| 14 | */ | 
|---|
| 15 |  | 
|---|
| 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ | 
|---|
| 17 |  | 
|---|
| 18 | #include "ini_file_prefs_reader.h" | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | /** | 
|---|
| 24 | * standard constructor | 
|---|
| 25 | */ | 
|---|
| 26 | IniFilePrefsReader::IniFilePrefsReader ( const std::string& fileName ) | 
|---|
| 27 | { | 
|---|
| 28 | IniParser iniParser; | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | Preferences* prefs = Preferences::getInstance(); | 
|---|
| 32 |  | 
|---|
| 33 | prefs->setUserIni( fileName ); | 
|---|
| 34 |  | 
|---|
| 35 | if ( !iniParser.readFile( fileName ) ) | 
|---|
| 36 | return; | 
|---|
| 37 |  | 
|---|
| 38 | for(IniParser::Section::iterator section = iniParser.begin(); | 
|---|
| 39 | section != iniParser.end(); | 
|---|
| 40 | ++section) | 
|---|
| 41 | for (IniParser::Entry::iterator entry = (*section).begin(); | 
|---|
| 42 | entry != (*section).end(); | 
|---|
| 43 | ++entry) | 
|---|
| 44 | prefs->setString( (*section).name(), (*entry).name(), (*entry).value(), true ); | 
|---|
| 45 |  | 
|---|
| 46 | /*iniParser.firstVar(); | 
|---|
| 47 |  | 
|---|
| 48 | Preferences* prefs = Preferences::getInstance(); | 
|---|
| 49 |  | 
|---|
| 50 | while ( iniParser.nextVar() ) | 
|---|
| 51 | { | 
|---|
| 52 | prefs->setString( iniParser.getCurrentSection(), iniParser.getCurrentName(), iniParser.getCurrentValue(), true ); | 
|---|
| 53 | }*/ | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | /** | 
|---|
| 58 | * standard deconstructor | 
|---|
| 59 | */ | 
|---|
| 60 | IniFilePrefsReader::~IniFilePrefsReader () | 
|---|
| 61 | {} | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.