jigdo API
util/configfile.hh File Reference
Access to Gnome/KDE/ini-style configuration files. More...
#include <iosfwd>
#include <list>
#include <string>
#include <debug.hh>
Go to the source code of this file.
Classes | |
class | ConfigFile |
General approach: Reading/changes/writing of config should be possible, and all formatting and comments made by any human editing the file should be preserved. More... | |
struct | ConfigFile::Line |
class | ConfigFile::iterator |
The iterators hide the fact that a ConfigFile is not a list<string>. More... | |
class | ConfigFile::Find |
Class to enumerate all lines in the config file which match a given section & label name. More... | |
class | ConfigFile::ProgressReporter |
Class allowing ConfigFile to convey information back to the creator of a ConfigFile object. More... | |
Functions | |
ostream & | operator<< (ostream &s, const ConfigFile &c) |
istream & | operator>> (istream &s, ConfigFile &c) |
Detailed Description
Access to Gnome/KDE/ini-style configuration files.Allow reading and writing of configuration files. The files consist of a number of sections, introduced with "[SectionName]" on a line by itself. Within each section, there are entries of the form "Label=value". Example for a .jigdo file: ________________________________________
[Jigdo] Version=1.0 Generator=jigdo-file/0.5.1
# Comment [Image] # Comment Filename=image Template=http://edit.this.url/image.template ShortInfo=This is a CD image Info=Some more info about the image. Whee, this entry extends over more than one line! , It even contains an empty line, above this one. # ^^^^^^ multi-line values UNIMPLEMENTED at the moment
[Parts] QrxELOWvjQ2JgkFhlkT74w=A:ironmaiden/part88 jKVYd3dxh68ROwI6NSQxGA=A:ironmaiden/part87________________________________________
Whitespace is removed at the start of lines, to the left of the "=" in an entry line and at the start and end of a section name, but nowhere else. This means that a section name or label may contain spaces, possibly even multiple consecutive spaces. Section and label names cannot contain the characters []=#
Entries appearing before the first section name are added to a 0th section named "" (empty string). Empty label names are also allowed.
Comments are introduced with "#" and extend to the end of the line. They may appear after a "[SectionName]" or on a separate line, but not in entry lines (if they do, they're considered part of the entry's value).
Furthermore, multi-line comments are possible because a section named [Comment] or [comment] is treated specially; errors about incorrect entries are not reported. In practice, this means that any text can be written in these sections, as long as no line begins with '['.
Searches for sections/labels are case-sensitive.
Multi-line entry values are not implemented ATM.
Function Documentation
ostream& operator<< | ( | ostream & | s, | |
const ConfigFile & | c | |||
) | [inline] |
References ConfigFile::put().
istream& operator>> | ( | istream & | s, | |
ConfigFile & | c | |||
) | [inline] |
References ConfigFile::get().
Generated on Tue Sep 23 14:27:42 2008 for jigdo by
