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

rs::ini Namespace Reference

Classes to read/write inifiles. More...


Compounds

class  Comment
 Comment in Inifile. More...

class  Commentable
 Section or Entry - may have a comment. More...

class  FilePosition
 stores the line number where a Section or Entry has been defined. More...

class  Entry
 stores one inifile entry. More...

struct  ltistr
 sort predicate used to sort map's case-insensitive. More...

class  Section
 contains a whole section. More...

class  Inifile
 a whole inifile. More...


Typedefs

typedef SmartPtr< EntryEntryPtr
 SmartPtr to Entry. More...

typedef std::map< std::string,
EntryPtr, ltistr
Entries
 Stores several Entry's. More...

typedef SmartPtr< SectionSectionPtr
 SmartPtr to Section. More...

typedef std::map< std::string,
SectionPtr, ltistr
Sections
 mapping for sections. More...

typedef SmartPtr< InifileInifilePtr
 SmartPtr to Inifile. More...

typedef void(* InifileCompleter )(InifilePtr)
 function type used for readOrCreateInifile. More...


Enumerations

enum  ChangesState { NO_CHANGES, MINOR_CHANGES, MAJOR_CHANGES }
 How to handle changes
  • NO_CHANGES=ignore
  • MINOR_CHANGES=save
  • MAJOR_CHANGES=save & throw Error.
More...



Functions

InifilePtr readInifile (const string &filename)
void writeInifile (const string &filename, InifilePtr ini)
InifilePtr readOrCreateInifile (const string &inifilename, InifileCompleter complete_ini)
InifilePtr readInifile (const std::string &filename)
 read inifile from file. More...

void writeInifile (const std::string &filename, InifilePtr ini)
 save inifile to file. More...

InifilePtr readOrCreateInifile (const std::string &inifilename, InifileCompleter complete_ini)
 read inifile or create from scratch. More...


Variables

bool need_check_for_changes = false
const char comment_char = ';'


Detailed Description

Classes to read/write inifiles.

Typedef Documentation

typedef SmartPtr<Entry> EntryPtr
 

SmartPtr to Entry.

Definition at line 248 of file inifile.h.

Referenced by Section::expectEntry(), Inifile::findEntry(), Section::findOrCreateEntry(), and readInifile().

typedef std::map<std::string, EntryPtr, ltistr > Entries
 

Stores several Entry's.

Definition at line 262 of file inifile.h.

typedef SmartPtr<Section> SectionPtr
 

SmartPtr to Section.

Definition at line 407 of file inifile.h.

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

typedef std::map<std::string, SectionPtr, ltistr > Sections
 

mapping for sections.

Definition at line 410 of file inifile.h.

typedef SmartPtr<Inifile> InifilePtr
 

SmartPtr to Inifile.

Definition at line 558 of file inifile.h.

Referenced by readInifile(), readOrCreateInifile(), and writeInifile().

typedef void(* InifileCompleter)(InifilePtr)
 

function type used for readOrCreateInifile.

Definition at line 577 of file inifile.h.

Referenced by readOrCreateInifile().


Enumeration Type Documentation

enum ChangesState
 

How to handle changes

  • NO_CHANGES=ignore
  • MINOR_CHANGES=save
  • MAJOR_CHANGES=save & throw Error.

Enumeration values:
NO_CHANGES 
MINOR_CHANGES 
MAJOR_CHANGES 

Definition at line 53 of file inifile.h.

Referenced by Inifile::changesMade(), Section::changesMade(), Section::findOrCreateEntry(), Inifile::findOrCreateSection(), Section::insertEntry(), Inifile::insertSection(), readOrCreateInifile(), Inifile::set_changes_made(), and Section::set_changes_made().


Function Documentation

InifilePtr readInifile const string &    filename
 

Definition at line 330 of file inifile.cpp.

Referenced by readOrCreateInifile().

void writeInifile const string &    filename,
InifilePtr    ini
 

Definition at line 395 of file inifile.cpp.

Referenced by readOrCreateInifile().

InifilePtr readOrCreateInifile const string &    inifilename,
InifileCompleter    complete_ini
 

Definition at line 405 of file inifile.cpp.

InifilePtr readInifile const std::string &    filename
 

read inifile from file.

Parameters:
filename  name of inifile
Returns:
Inifile
Exceptions:
Error 

void writeInifile const std::string &    filename,
InifilePtr    ini
 

save inifile to file.

Parameters:
filename  name of inifile
ini  inifile to save
Exceptions:
Error  (in case of I/O problems)
Note:
Use readOrCreateInifile to open an inifile
Calls Inifile::fixState

InifilePtr readOrCreateInifile const std::string &    inifilename,
InifileCompleter    complete_ini
 

read inifile or create from scratch.

Parameters:
inifilename  name of inifile
complete_ini  user function which inserts default values into the inifile. This is called in both cases (read and create) and should look for all needed sections/entries. If a section (or entry) does not exist it has to be created and inserted.
Exceptions:
Error  (if MAJOR_CHANGES were done in complete_ini() or in case of I/O problems)
See also:
findOrCreateSection , findOrCreateEntry , readInifile


Variable Documentation

bool need_check_for_changes = false
 

Definition at line 37 of file inifile.cpp.

Referenced by Section::changesMade(), and Section::set_changes_made().

const char comment_char = ';'
 

Definition at line 46 of file inifile.h.

Referenced by Comment::dump(), and Comment::split_multiline().


Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen