Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Inifile Class Reference

a whole inifile. More...

#include <inifile.h>

Collaboration diagram for Inifile:

Collaboration graph
[legend]
List of all members.

Public Methods

 Inifile (const std::string &loaded_from_file_)
 create an empty inifile. More...

virtual ~Inifile ()
Sections::const_iterator begin () const
 start-iterator over all sections of the inifile. More...

Sections::const_iterator end () const
 end-iterator over all sections of the inifile. More...

const std::string & loadedFrom () const
 returns the filename the inifile was loaded from. More...

void insertSection (SectionPtr section, ChangesState mode=MINOR_CHANGES)
 insert a new Section to Inifile. More...

const SectionPtr findSection (const std::string &name_) const
 search a Section. More...

SectionPtr findSection (const std::string &name_)
SectionPtr expectSection (const std::string &name_) const
 find an existing Section. More...

SectionPtr findOrCreateSection (const std::string &name_, ChangesState mode=MINOR_CHANGES)
 search for or create a Section. More...

const EntryPtr findEntry (const std::string &section, const std::string &entry) const
 search an entry. More...

EntryPtr findEntry (const std::string &section, const std::string &entry)
const std::string & findStringEntry (const std::string &section, const std::string &entry) const
 search a string entry. More...

double findNumericEntry (const std::string &section, const std::string &entry) const
 search a numeric entry. More...

long findIntegerEntry (const std::string &section, const std::string &entry) const
 search a numeric entry. More...

void dump (std::ostream &out) const
 write Inifile to stream. More...

ChangesState changesMade () const
 test if changes were made. More...

void fixState ()
 set everything to unchanged. More...


Private Methods

void set_changes_made (ChangesState mode)
 update ChangesState of Inifile. More...


Private Attributes

Sections sections
 contains all Section's of the Inifile. More...

ChangesState changes_made
 records if changes were made to the Inifile. More...

std::string loaded_from_file

Detailed Description

a whole inifile.

Definition at line 417 of file inifile.h.


Constructor & Destructor Documentation

Inifile (  const std::string &    loaded_from_file_ )  [inline]
 

create an empty inifile.

See also:
ini::readInifile , ini::readOrCreateInifile

Definition at line 439 of file inifile.h.

virtual ~Inifile (    )  [inline, virtual]
 

Definition at line 440 of file inifile.h.


Member Function Documentation

void set_changes_made (  ChangesState    mode )  [inline, private]
 

update ChangesState of Inifile.

Parameters:
mode  new ChangesState
Note:
the current mode remains unchanged, if it is bigger than mode.

Definition at line 432 of file inifile.h.

Sections::const_iterator begin (    )  const [inline]
 

start-iterator over all sections of the inifile.

Definition at line 443 of file inifile.h.

Sections::const_iterator end (    )  const [inline]
 

end-iterator over all sections of the inifile.

Definition at line 446 of file inifile.h.

const std::string& loadedFrom (    )  const [inline]
 

returns the filename the inifile was loaded from.

Definition at line 449 of file inifile.h.

Referenced by Inifile::expectSection().

void insertSection (  SectionPtr    section,
ChangesState    mode = MINOR_CHANGES
)  [inline]
 

insert a new Section to Inifile.

Parameters:
section  Section to insert.
mode  How to handle changes (defaults to MINOR_CHANGES).

Definition at line 455 of file inifile.h.

Referenced by Inifile::findOrCreateSection().

const SectionPtr findSection (  const std::string &    name_ )  const [inline]
 

search a Section.

Parameters:
name_  name of section
Returns:
section (if section was not found Null SectionPtr is returned)

Definition at line 468 of file inifile.h.

Referenced by Inifile::expectSection(), and Inifile::findOrCreateSection().

SectionPtr findSection (  const std::string &    name_ ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 303 of file inifile.cpp.

SectionPtr expectSection (  const std::string &    name_ )  const
 

find an existing Section.

Parameters:
name_  name of section
Returns:
section (if section was not found an Error is thrown)

Definition at line 293 of file inifile.cpp.

Referenced by Inifile::findEntry(), Inifile::findIntegerEntry(), Inifile::findNumericEntry(), and Inifile::findStringEntry().

SectionPtr findOrCreateSection (  const std::string &    name_,
ChangesState    mode = MINOR_CHANGES
) 
 

search for or create a Section.

if Section does not exist, it is created.

Parameters:
name_  name of section
mode  How to handle changes (defaults to MINOR_CHANGES).
Returns:
found or created section

Definition at line 228 of file inifile.cpp.

const EntryPtr findEntry (  const std::string &    section,
const std::string &    entry
)  const
 

search an entry.

Parameters:
section  name of section
entry  name of entry
Returns:
entry
Exceptions:
Error  if section or entry was not found
See also:
Section::findEntry

Definition at line 285 of file inifile.cpp.

EntryPtr findEntry (  const std::string &    section,
const std::string &    entry
)  [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 501 of file inifile.h.

const string & findStringEntry (  const std::string &    section,
const std::string &    entry
)  const
 

search a string entry.

Parameters:
section  name of section
entry  name of entry
Returns:
the string contained in the entry
Exceptions:
Error  if section or entry does not exist or entry is no string entry
See also:
findSection , Section::findStringEntry

Definition at line 262 of file inifile.cpp.

double findNumericEntry (  const std::string &    section,
const std::string &    entry
)  const
 

search a numeric entry.

Parameters:
section  name of section
entry  name of entry
Returns:
the numeric value contained in the entry
Exceptions:
Error  if section or entry does not exist or entry is no numeric entry
See also:
findSection , Section::findNumericEntry

Definition at line 270 of file inifile.cpp.

long findIntegerEntry (  const std::string &    section,
const std::string &    entry
)  const
 

search a numeric entry.

Parameters:
section  name of section
entry  name of entry
Returns:
the numeric value contained in the entry
Exceptions:
Error  if section or entry does not exist or entry is no numeric entry
See also:
findSection , Section::findIntegerEntry

Definition at line 277 of file inifile.cpp.

void dump (  std::ostream &    out )  const [inline]
 

write Inifile to stream.

Definition at line 536 of file inifile.h.

ChangesState changesMade (    )  const
 

test if changes were made.

Returns:
info about made changes
See also:
ChangesState

Definition at line 242 of file inifile.cpp.

void fixState (    ) 
 

set everything to unchanged.

Note:
Use this after saving the inifile to disk with writeInifile

Definition at line 252 of file inifile.cpp.


Member Data Documentation

Sections sections [private]
 

contains all Section's of the Inifile.

Definition at line 421 of file inifile.h.

Referenced by Inifile::changesMade(), Inifile::findSection(), and Inifile::fixState().

ChangesState changes_made [private]
 

records if changes were made to the Inifile.

Definition at line 424 of file inifile.h.

Referenced by Inifile::changesMade(), and Inifile::fixState().

std::string loaded_from_file [private]
 

Definition at line 426 of file inifile.h.


The documentation for this class was generated from the following files:
Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen