Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ~archive/IniParser


Ignore:
Timestamp:
Nov 27, 2007, 10:43:49 PM (17 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ~archive/IniParser

    v1 v1  
     1= IniParser =
     2
     3The ini-parser does what it is called, and more...
     4
     5it is a very simple library, that allows two things, reading ini-files, and writing them.
     6files:
     7  * source:/trunk/src/lib/util/ini_parser.cc#HEAD
     8  * source:/trunk/src/lib/util/ini_parser.h#HEAD
     9
     10
     11== Known functions ==
     12{{{
     13#!cpp
     14    bool readFile(const char* fileName);
     15    bool writeFile(const char* fileName);
     16
     17    bool addSection(const char* sectionName);
     18    bool getSection(const char* sectionName);
     19
     20    bool addVar(const char* entryName, const char* value, const char* sectionName = NULL);
     21    const char* getVar(const char* entryName, const char* sectionName, const char* defaultValue = "") const;
     22}}}
     23with those you can do almost everything.
     24Althought, if you want to iterate through a File, and parsing all the good stuff, do something like:
     25{{{
     26#!cpp
     27  #include "ini_parser.h"
     28
     29  .
     30  .
     31  .
     32
     33  IniParser iniParser("someFile");
     34  if (!iniParser.isOpen())
     35    return;
     36
     37  iniParser.getFirstSection();
     38  while (iniParser.getCurrentSection())
     39  {
     40     /// SECTION SPECIFIC STUFF
     41    iniParser.getFirstVar();
     42    while(iniParser.getCurrentName())
     43    {
     44     /// VARIABLE SPECIFI STUFF
     45     iniParser.nextVar();
     46    }
     47
     48    iniParser.nextSection();
     49  }
     50}}}