IniParser
This is an archived page! This page is very old and the content is not up to date. Not everything (if any) which is written here will be in the final game! |
The ini-parser does what it is called, and more…
it is a very simple library, that allows two things, reading ini-files, and writing them. files:
- source:orxonox.OLD/trunk/src/lib/util/ini_parser.cc#HEAD
- source:orxonox.OLD/trunk/src/lib/util/ini_parser.h#HEAD
Known functions
bool readFile(const char* fileName); bool writeFile(const char* fileName); bool addSection(const char* sectionName); bool getSection(const char* sectionName); bool addVar(const char* entryName, const char* value, const char* sectionName = NULL); const char* getVar(const char* entryName, const char* sectionName, const char* defaultValue = "") const;
with those you can do almost everything. Althought, if you want to iterate through a File, and parsing all the good stuff, do something like:
#include "ini_parser.h" . . . IniParser iniParser("someFile"); if (!iniParser.isOpen()) return; iniParser.getFirstSection(); while (iniParser.getCurrentSection()) { /// SECTION SPECIFIC STUFF iniParser.getFirstVar(); while(iniParser.getCurrentName()) { /// VARIABLE SPECIFI STUFF iniParser.nextVar(); } iniParser.nextSection(); }
Last modified 8 years ago
Last modified on Apr 15, 2017, 3:50:42 PM