FBB::ConfigFileile

libbobcat1-dev_2.21.00-x.tar.gz

2005-2012


FBB::ConfigFileile(3bobcat)

FBB::ConfigFileile(3bobcat)

libbobcat1-dev_2.21.00-x.tar.gz Configuration File Processing

2005-2012

NAME

FBB::ConfigFileile - A class processing standard unix-like configuration files

SYNOPSIS

#include <bobcat/configfile>
Linking option: -lbobcat

DESCRIPTION

ConfigFile objects read standard unix-style configuration files. Lines are stored with initial white-space (blanks and tabs) removed. If a line ends in \, then the next line (initial white-space removed) is appended to the current line.

Information at and beyond the first # on individual lines is removed if the rmComment flag is set to true. In that case, lines containing only blanks and tabs are not stored.

All non-empty lines of the configuration file (when comment is ignored comment is not considered to be line-content) are stored in the ConfigFile object. When line indices should be stored the (0-based) line indices of lines will be available as well.

At construction time comment handling (keep comment / remove comment), case-sensitive searching (sensitive / insensitive) and index storage (store / don't store) can be specified.

It can't be modified using the open member, but overloaded assignment is supported and comment and letter case handling can be modified by set-members.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

-

ENUMERATIONS

The following enumerations are defined by the class ConfigFile:

TYPES

The following types are defined by the class ConfigFile:

CONSTRUCTORS


The copy and move constructors are available.

OVERLOADED OPERATORS


The overloaded assignment and move assignment operators are available.

MEMBER FUNCTIONS

EXAMPLE

Assume the configuration file is called config.rc and contains the following lines:



# this is ignored

noline: this one too

line: this is found

this is not a line containing line: at the beginning of the line

line: this one is

    line: what about this one? \ 
        it's extending over multiple lines

and there may, of course, be more lines in this file
    

The following program may be compiled and run as a.out config.rc:


#include <iostream>
#include <iterator>
#include <algorithm>
#include <string>
#include <bobcat/configfile>

using namespace std;
using namespace FBB;
    
int main(int argc, char **argv)
{
    ConfigFile cf(argv[1]);     

    cout << *cf.find("this one") << endl; // find text within a line

                                         // find all lines matching 
                                         // `^line:'
    copy(cf.beginRE("^line:"), cf.endRE(), 
                    ostream_iterator<string>(cout, "\n"));
}
    

Producing the output:


noline: this one too
line: this is found
line: this one is
line: what about this one? it's extending over multiple lines
    

FILES

bobcat/configfile - defines the class interface

SEE ALSO

bobcat(7), errno(3bobcat), pattern(3bobcat)

BUGS

None Reported.

DISTRIBUTION FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).