Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

lrt::IniFile Class Reference

IniFile implements an interface to a configuration file in INI format. More...

#include <rtini.h>

List of all members.

Public Types

typedef StringMap< IniSection
>::Iterator 
Iterator

Public Methods

 IniFile ()
 Creates an empty IniFile. More...

 IniFile (const String &filename)
 Creates an IniFile and fills it with sections and entries from an INI file on your disk. More...

bool hasSection (const String &name) const
 Checks if a section with the given name is present in this IniFile.

IniSection & getSection (const String &name)
 Gets an IniSection by its name from this IniFile. More...

const IniSection & getSectionConst (const String &name) const
 Gets an IniSection by its name from this IniFile. More...

void addSection (const String &name, const IniSection &section)
 Adds an IniSection to this IniFile. More...

bool removeSection (const String &name)
 Removes the given section (by its name), if it is present. More...

Iterator begin ()
 Returns an iterator to the begin of the IniFile. More...

Iterator begin () const
 Returns an unmodifyable iterator to the begin of the IniFile.

bool read (const String &filename)
 Reads an INI file from your disk and inserts its contents into this IniFile. More...

bool write (const String &filename)
 Writes the contents of this IniFile to your disk. More...


Detailed Description

IniFile implements an interface to a configuration file in INI format.

(This format is a well known text-mode configuration file format from the Windows world.) While the format of INI files varies with different Windows programs, for our purposes, its structure is as follows:


Constructor & Destructor Documentation

lrt::IniFile::IniFile (    ) 
 

Creates an empty IniFile.

It will not contain any sections nor entries.

lrt::IniFile::IniFile (  const String &    filename ) 
 

Creates an IniFile and fills it with sections and entries from an INI file on your disk.

Parameters:
filename  The INI file to read.


Member Function Documentation

void lrt::IniFile::addSection (  const String &    name,
const IniSection &    section
) 
 

Adds an IniSection to this IniFile.

The section's contents will be copied over to the IniFile. If a section with the same name was already present in this IniFile, its contents will be discarded.

IniFile::Iterator lrt::IniFile::begin (    ) 
 

Returns an iterator to the begin of the IniFile.

You can use it to traverse all IniSections that are present in it.

IniSection & lrt::IniFile::getSection (  const String &    name ) 
 

Gets an IniSection by its name from this IniFile.

If the section does not yet exist, an empty section will be created and returned.

Parameters:
name  The section's name.
Returns:
A reference to the section through which its contents can be modified.

const IniSection & lrt::IniFile::getSectionConst (  const String &    name )  const
 

Gets an IniSection by its name from this IniFile.

If the section does not yet exist, some nonsense value is returned; use hasSection() beforewards to check.

bool lrt::IniFile::read (  const String &    filename ) 
 

Reads an INI file from your disk and inserts its contents into this IniFile.

Returns:
True if reading succeeded.

bool lrt::IniFile::removeSection (  const String &    name ) 
 

Removes the given section (by its name), if it is present.

Returns:
True if there was actually a section to remove, false otherwise.

bool lrt::IniFile::write (  const String &    filename ) 
 

Writes the contents of this IniFile to your disk.

Parameters:
filename  The file to write to.
Returns:
True if writing succeeded.


The documentation for this class was generated from the following files:
This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer