From kde-devel Tue May 02 20:19:48 2000 From: Mirko Sucker Date: Tue, 02 May 2000 20:19:48 +0000 To: kde-devel Subject: Re: FW: API for accessing Unix/Linux config files X-MARC-Message: https://marc.info/?l=kde-devel&m=95730425726995 "Hummel, Timo" wrote: > > > Hi, > > > > my colleague Philip Blatter and I are trying to create an API to provide a > > configuration GUI an easy access to various configuration files on a > > Unix/Linux system (we know that tools like COAS, LinuxConf and such are > > out there, but they don't fit our requirements). The specification idea is > > good so far, but the main problem is that configuration files are designed > > very different (especially if you compare route.conf with http.conf). If > > someone has a good idea to get a consistent access to these files or likes > > to join our project, please contact us immediately. Hello, I know you try to find a way to access all Unix config files, but I want to point you to another thingy I wrote some time ago and that is rather matured, I think. It is a simple C++ class that reads and writes text files that are used like file systems (consider pathes, filenames and data in files). You may, for example, create a config file "foo", and add /a/b/c containg the text "hello" to it. /a/b is the path (section), c the filename (key), "hello" the data (value). This objects may be written to disk and reread, and, as the files are stored using plain text, may even be edited manually. Indeed, it was written initially for reading and writing config files, thus it´s called ConfigDB. There is a standard C++ version of it in KDE 1 (kdelibs/kab/configDB.h ...) and a Qt adapted version in the current KDE 2 sources (kdelibs/kab/qconfigDB.h ...). So, instead of trying to find a way to parse thousands of file formats, why not give it a try? --Mirko. PS: By the way, the class handles different data types as values. Ever wanted to store a list of integers? Simply do it. Or Unicode strings? Or boolean values? The interface is simply, anyway, as all methods to store and retrieve key-value-pairs use overloaded methods of the same name. -- Drei Dinge gibt es, denen alle Menschen gern gemütlich zuschauen: ° fliessendes Wasser, ° knisterndes Feuer und (am allerliebsten) ° anderen Menschen beim Arbeiten. (Charlie Brown).