Compound list   Compound Members  

Section Class Reference

A Section object manages one section of a configuration database. More...

List of all members.

Public Members

Protected Members

Static Protected Members


Detailed Description

A Section object manages one section of a configuration database.

A configuration database consists of sections which in turn consist of other sections (recursive definition) and key-value-pairs. This file declares the Section class. An object of Section manages exactly one section during its lifetime.


Member Typedef Documentation

typedef map<QString, Section*, QStringLess> Section::StringSectionMap

The StringSectionMap type is defined to make the code more readable.


Member Function Documentation

Section::Section()

The default constructor.

Section::Section(const KeyValueMap&)

Constructor that fills the keys with the given map entries.

bool Section::add(const QString&)

Add an empty new section.

bool Section::add(const QString&, Section*)

Add the section.

bool Section::find(const QString&, StringSectionMap::iterator&)

Search for the section, returning an iterator to it.

bool Section::find(const QString&, Section*&)

Search for the section, returning a pointer to the section object.

bool Section::remove(const QString&)

Remove this subsection.

KeyValueMap* Section::getKeys()

Return the key-value-pairs of this (!) section.

bool Section::save(QTextStream& stream, int level=0)

Save this section to the given output stream.

Level is the position in section tree depth (the hierarchy level). It is used for indenting.

bool Section::readSection(QTextStream& file, bool finish=true)

Read one section from the given input stream.

The method does not expect the line that marks the begin of the section. If finish is false, the code does also not except the section to be ended with a line like [END].

bool Section::clear()

Clears both subsections and keys.

bool Section::empty()

Returns whether this section is empty.

A section is empty if it has no subsections and no key-value-pairs.

iterator Section::sectionsBegin()

Return an iterator to the beginning of the subsections map.

iterator Section::sectionsEnd()

Return an iterator to the end of the subsections map.

unsigned int Section::noOfSections()

Return the number of subsections.

void Section::insertIndentSpace(QTextStream& file, int level) [protected]

Insert the spaces for indention the lines of this section when saving.

bool Section::isBeginOfSection(QString) [protected]

Check whether the string (one line of the file currently read) marks the beginning of a new subsection (usually [sectionname]).

bool Section::isEndOfSection(QString) [protected]

Check whether the string (one line of the file currently read) marks the end of a new subsection (usually [END]).

QString Section::nameOfSection(const QString&) [protected]

Extract the name of the section from the string.

The string must contain the line that starts the section.

See also:
isBeginOfSection()


Member Data Documentation

StringSectionMap Section::sections [protected]

A map containing the subsections of this section.

KeyValueMap Section::keys [protected]

The key-value-pairs of this section.

const int Section::indent_width [static, protected]

The number of spaces a subsection is indented in text files.


The documentation for this class was generated from the following file:

The KDE Addressbook Developers Reference 
Mirko Sucker, 1999