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

Section Class Reference

contains a whole section. More...

#include <inifile.h>

Inheritance diagram for rs::ini::Section:

Inheritance graph
[legend]
Collaboration diagram for Section:

Collaboration graph
[legend]
List of all members.

Public Methods

 Section (const std::string &name_, unsigned long line_number)
 create an empty section named name_. More...

virtual ~Section ()
const InifilemyInifile () const
 get pointer to my Section. More...

const std::string & getName () const
 get name of the Section. More...

void insertEntry (EntryPtr entry, ChangesState mode=MINOR_CHANGES)
 insert an entry into Section. More...

const EntryPtr findEntry (const std::string &name_) const
 search for an entry. More...

EntryPtr findEntry (const std::string &name_)
EntryPtr findOrCreateEntry (const std::string &name_, const std::string &content, ChangesState mode=MINOR_CHANGES, const char *add_comment=0)
 search for or create an Entry. More...

EntryPtr findOrCreateEntry (const std::string &name_, long default_value, ChangesState mode=MINOR_CHANGES, const char *add_comment=0)
EntryPtr findOrCreateEntry (const std::string &name_, std::string(*get_content)(), ChangesState mode=MINOR_CHANGES, const char *add_comment=0)
 search for or create an Entry. More...

const std::string & findStringEntry (const std::string &name_) const
 Searches section for an existing Entry. More...

double findNumericEntry (const std::string &name_) const
 Searches section for an existing Entry. More...

long findIntegerEntry (const std::string &name_) const
 Searches section for an existing Entry. More...

Entries::const_iterator begin () const
 first section. More...

Entries::const_iterator end () const
 behind last section. More...

void clearEntries ()
 delete all entries from section. More...

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

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

void fixState ()
 reset ChangesState to NO_CHANGES. More...

void throw_Error (const std::string &message) const
 throws an error referring the section. More...


Private Methods

void set_changes_made (ChangesState mode)
 Update chages-state of Section. More...

EntryPtr expectEntry (const std::string &name_) const

Private Attributes

std::string name
Entries entries
ChangesState changes_made
Inifilemy_inifile

Friends

class Inifile

Detailed Description

contains a whole section.

Definition at line 267 of file inifile.h.


Constructor & Destructor Documentation

Section const std::string &    name_,
unsigned long    line_number
[inline]
 

create an empty section named name_.

Definition at line 291 of file inifile.h.

virtual ~Section   [inline, virtual]
 

Definition at line 292 of file inifile.h.


Member Function Documentation

void set_changes_made ChangesState    mode [inline, private]
 

Update chages-state of Section.

Parameters:
mode  minimum wanted mode
Note:
the current mode remains unchanged, if it is bigger than mode.

Definition at line 278 of file inifile.h.

EntryPtr expectEntry const std::string &    name_ const [private]
 

Definition at line 214 of file inifile.cpp.

Referenced by Section::findIntegerEntry(), Section::findNumericEntry(), and Section::findStringEntry().

const Inifile* myInifile   const [inline]
 

get pointer to my Section.

Returns:
pointer to my Section (or NULL if Entry was not yet inserted into a Section)

Definition at line 297 of file inifile.h.

Referenced by Section::throw_Error().

const std::string& getName   const [inline]
 

get name of the Section.

Definition at line 300 of file inifile.h.

Referenced by Section::throw_Error().

void insertEntry EntryPtr    entry,
ChangesState    mode = MINOR_CHANGES
[inline]
 

insert an entry into Section.

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

Definition at line 306 of file inifile.h.

Referenced by Section::findOrCreateEntry().

const EntryPtr findEntry const std::string &    name_ const [inline]
 

search for an entry.

Parameters:
name_  name of entry
Returns:
entry (if entry was not found a Null SmartPtr is returned)

Definition at line 319 of file inifile.h.

Referenced by Section::expectEntry(), and Section::findOrCreateEntry().

EntryPtr findEntry const std::string &    name_ [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 323 of file inifile.h.

EntryPtr findOrCreateEntry const std::string &    name_,
const std::string &    content,
ChangesState    mode = MINOR_CHANGES,
const char *    add_comment = 0
 

search for or create an Entry.

Parameters:
name_  name of Entry
content  if the Entry does not exist this is the default value
mode  How to handle changes (defaults to MINOR_CHANGES).
add_comment  Comment added if entry was created.
Returns:
entry

Definition at line 155 of file inifile.cpp.

EntryPtr findOrCreateEntry const std::string &    name_,
long    default_value,
ChangesState    mode = MINOR_CHANGES,
const char *    add_comment = 0
 

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 127 of file inifile.cpp.

EntryPtr findOrCreateEntry const std::string &    name_,
std::string(*    get_content)(),
ChangesState    mode = MINOR_CHANGES,
const char *    add_comment = 0
 

search for or create an Entry.

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

Parameters:
name_  name of Entry
get_content  if entry does not exist, the user function get_content will be called and the result will be used as default value
mode  How to handle changes (defaults to MINOR_CHANGES).
add_comment  Comment added if entry was created.
Returns:
entry

Definition at line 169 of file inifile.cpp.

const string & findStringEntry const std::string &    name_ const
 

Searches section for an existing Entry.

Parameters:
name_  Name of the entry
Returns:
The value of the Entry.
Exceptions:
Error  if no such Entry was found.

Definition at line 183 of file inifile.cpp.

double findNumericEntry const std::string &    name_ const
 

Searches section for an existing Entry.

Parameters:
name_  Name of the entry
Returns:
The numeric value of the Entry.
Exceptions:
Error  if no such Entry was found or if content is not numeric.

Definition at line 191 of file inifile.cpp.

long findIntegerEntry const std::string &    name_ const
 

Searches section for an existing Entry.

Parameters:
name_  Name of the entry
Returns:
The numeric integer value of the Entry.
Exceptions:
Error  if no such Entry was found or if content is not numeric.

Definition at line 199 of file inifile.cpp.

Entries::const_iterator begin   const [inline]
 

first section.

Definition at line 374 of file inifile.h.

Referenced by Section::changesMade().

Entries::const_iterator end   const [inline]
 

behind last section.

Definition at line 376 of file inifile.h.

Referenced by Section::changesMade().

void clearEntries   [inline]
 

delete all entries from section.

Definition at line 379 of file inifile.h.

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

write Section to stream.

Reimplemented from Commentable.

Definition at line 382 of file inifile.h.

ChangesState changesMade   const
 

test if changes were made in this section.

Returns:
current ChangesState

Definition at line 142 of file inifile.cpp.

void fixState   [inline]
 

reset ChangesState to NO_CHANGES.

Definition at line 400 of file inifile.h.

void throw_Error const std::string &    message const
 

throws an error referring the section.

Definition at line 206 of file inifile.cpp.

Referenced by Section::expectEntry().


Friends And Related Function Documentation

friend class Inifile [friend]
 

Definition at line 285 of file inifile.h.


Member Data Documentation

std::string name [private]
 

Definition at line 269 of file inifile.h.

Entries entries [private]
 

Definition at line 270 of file inifile.h.

ChangesState changes_made [private]
 

Definition at line 271 of file inifile.h.

Referenced by Section::changesMade().

Inifile* my_inifile [private]
 

Definition at line 272 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