Compound list Compound Members
Section Class Reference
A Section object manages one section of a configuration database. More...
List of all members.
Public Members
- typedef map<QString, Section*, QStringLess> StringSectionMap
- The StringSectionMap type is defined to make the code more readable.
- Section ()
- The default constructor.
- Section (const KeyValueMap&)
- Constructor that fills the keys with the given map entries.
- bool add (const QString&)
- Add an empty new section.
- bool add (const QString&, Section*)
- Add the section.
- bool find (const QString&, StringSectionMap::iterator&)
- Search for the section, returning an iterator to it.
- bool find (const QString&, Section*&)
- Search for the section, returning a pointer to the section object.
- bool remove (const QString&)
- Remove this subsection.
- KeyValueMap* getKeys ()
- Return the key-value-pairs of this (!) section.
- bool save (QTextStream& stream, int level=0)
- Save this section to the given output stream.
- bool readSection (QTextStream& file, bool finish=true)
- Read one section from the given input stream.
- bool clear ()
- Clears both subsections and keys.
- bool empty ()
- Returns whether this section is empty.
- StringSectionMap::iterator sectionsBegin ()
- Return an iterator to the beginning of the subsections map.
- StringSectionMap::iterator sectionsEnd ()
- Return an iterator to the end of the subsections map.
- unsigned int noOfSections ()
- Return the number of subsections.
Protected Members
- void insertIndentSpace (QTextStream& file, int level)
- Insert the spaces for indention the lines of this section when saving.
- bool isBeginOfSection (QString)
- Check whether the string (one line of the file currently read) marks the beginning of a new subsection (usually [sectionname]).
- bool isEndOfSection (QString)
- Check whether the string (one line of the file currently read) marks the end of a new subsection (usually [END]).
- QString nameOfSection (const QString&)
- Extract the name of the section from the string.
- StringSectionMap sections
- A map containing the subsections of this section.
- KeyValueMap keys
- The key-value-pairs of this section.
Static Protected Members
- const int indent_width
- The number of spaces a subsection is indented in text files.
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()
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*)
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&)
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
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
|