I spend some time on looking over IrrIni again and fixed some bugs (most notably the one that reads garbage if the last line in the file was not empty) and did some changes.
First I renamed the class to IrrIni. IIniFileReader was some kind of outdated since the class was able to write file too for a while now. Then I also managed to remove the 64 characters limitation for section names and key names. And last but not least I rewrote the read and write methods of the class. They are now using only Irrlicht functions and do no longer depend on the runtime functions like strtok or others.
Here is the complete changelog:
- Renamed IIniFileReader class to IrrIni.
- Renamed createIniFileReader(empty) to createIniFile(empty).
- Methods are now const correct.
- Added IrrIni::keyExists() to check if a key exists.
- Removed IrrIni::addKeyToSection(). Use setValue() to create new keys.
- Removed the 64 character limitation of section and key names. (Now using stringc instead of char*).
- IrrIni::getValue() now returns a const c8* instead of c8*.
- Added extra constructors to SValue structs allowing manual creation of these structs.
- Replaced SValue i/f with template classes.
- createIniFile(empty) now needs a pointer to the Irrlicht IFileSystem for writing the data. If you just need to read them you can pass 0.
- added IrrIni::setFileSystem() to set filesystem after creation.
- Fixed memory leak in IrrIni::load() if a key was found outside a section.
- Fixed data garbage in last key of a file if no new line was added to the end.
Dec 28th 2008, 03:53 by Sylence.