Current version is highly portable and has been tested under several common used environmants including Linux, FreeBsd, Solars and Windows98/2000.
It has almost the same functionality as KConfig in KDE lib except the following differences:
The following code demostrates the easy use of this package:
see src/test.cpp for details. you can compile test.cpp using: g++ -o test -lconfig
include <iostream>
include <stdlib.h>
include "ksimpleconfig.h"
using namespace std;
using config::KSimpleConfig;
int main(int argc, char *argv[])
{
cout<<"write test configuration to test.conf"<<endl;
//create a config object
KSimpleConfig config("test.conf",false);
//write a string list
vector<string> str_list;
str_list.push_back("str1");
str_list.push_back("str2");
config.writeEntry("str list",str_list);
//write an empty string
config.writeEntry("empty","");
//create a config group and write some datum
config.setGroup("test group");
config.writeEntry("string1","str1");
config.writeEntry("bool1",true);
config.writeEntry("bool2",false);
config.writeEntry("int1",0);
config.writeEntry("int2",999);
config.writeEntry("int3",-10);
config.writeEntry("uint1",0);
config.writeEntry("uint2",999);
config.writeEntry("float1",0);
config.writeEntry("float1",7.3);
vector<string> groups = config.groupList();
cout<<"total "<<config.groupList().size()<<" groups written:"<<endl;
return EXIT_SUCCESS;
}
1.2.14 written by Dimitri van Heesch,
© 1997-2002