INIFile Class Reference

INI File. More...

#include <inifile.h>

List of all members.

Public Member Functions

 INIFile ()
 Empty constructor.
void Reset ()
 Resets iteration.
bool Next ()
 Advance iteration to the next section.
bool OpenFile (const char *const fname)
 Loads given INI file.
bool OpenFile (const std::string &fname)
 Loads given INI file. (STL version).
bool LoadBuffer (const char *buf, unsigned size)
 Loads INI file from given zero terminated buffer.
 ~INIFile ()
 Destructor.
INISectionGetSection (const char *const name) const
 Gets pointer to requested section.
INISectionGetSection (const std::string &name) const
 Gets pointer to requested section. (STL version).
INISectionoperator[] (const char *const name) const
 [] operator : alias for GetSection().
INISectionoperator[] (const std::string &name) const
 [] operator : alias for GetSection() (STL version).
unsigned GetLength () const
bool IsValid () const

Detailed Description

INI File.

Reads and stores data from an ini file and gives access to its sections.

Definition at line 17 of file inifile.h.


Constructor & Destructor Documentation

INIFile::INIFile (  )  [inline]

Empty constructor.

Definition at line 34 of file inifile.h.

INIFile::~INIFile (  ) 

Destructor.

Deletes loaded INI file (if any)

Definition at line 166 of file inifile.cpp.


Member Function Documentation

unsigned INIFile::GetLength (  )  const [inline]
Returns:
number of sections in the file.

Definition at line 152 of file inifile.h.

INISection* INIFile::GetSection ( const std::string &  name  )  const [inline]

Gets pointer to requested section. (STL version).

Parameters:
name Name of the section to get.
Returns:
pointer to requested section if the section exists.
NULL if the section does not exist.

Definition at line 119 of file inifile.h.

INISection * INIFile::GetSection ( const char *const   name  )  const

Gets pointer to requested section.

Parameters:
name Name of the section to get. Must be a valid, zero terminated string.
Returns:
pointer to requested section if the section exists.
NULL if the section does not exist.

Definition at line 180 of file inifile.cpp.

bool INIFile::IsValid (  )  const [inline]
Returns:
true if this INIFile() is initialised, false otherwise.

Definition at line 158 of file inifile.h.

bool INIFile::LoadBuffer ( const char *  buf,
unsigned  size 
)

Loads INI file from given zero terminated buffer.

Note:
File will be loaded even if it contains no ini sections, and even empty sections will be read. Useful e.g. for loading INI files from compressed files.
Parameters:
buf Buffer to load from. Must be zero terminated.
size Size of the buffer (including terminating zero).
Returns:
true if successfully loaded.
false if there was an error and the buffer was not loaded.

Definition at line 94 of file inifile.cpp.

bool INIFile::Next (  )  [inline]

Advance iteration to the next section.

Returns:
true if there is another section and internal index now points to it.
false if there are no more sections, i.e. we're finished with iteration.

Definition at line 52 of file inifile.h.

bool INIFile::OpenFile ( const std::string &  fname  )  [inline]

Loads given INI file. (STL version).

Note:
You can only call LoadBuffer on an INIFile that is not initialised, i.e. OpenFile or LoadBuffer was not called before.
File will be loaded even if it contains no ini sections, and even empty sections will be read.
Parameters:
fname Filename of the file to load.
Returns:
true if the file is succesfully loaded.
false if the file does not exist, can not be accessed or is otherwise invalid.

Definition at line 81 of file inifile.h.

bool INIFile::OpenFile ( const char *const   fname  ) 

Loads given INI file.

Note:
You can only call OpenFile on an INIFile that is not initialised, i.e. OpenFile or LoadBuffer was not called before.
File will be loaded even if it contains no ini sections, and even empty sections will be read.
Parameters:
fname Filename of the file to load. Must be a valid, zero terminated string.
Returns:
true if the file is succesfully loaded.
false if the file does not exist, can not be accessed or is otherwise invalid.

Definition at line 24 of file inifile.cpp.

INISection* INIFile::operator[] ( const std::string &  name  )  const [inline]

[] operator : alias for GetSection() (STL version).

Parameters:
name Name of the section to get.
Returns:
pointer to requested section if the section exists.
NULL if the section does not exist.

Definition at line 145 of file inifile.h.

INISection* INIFile::operator[] ( const char *const   name  )  const [inline]

[] operator : alias for GetSection().

Parameters:
name Name of the section to get. Must be a valid, zero terminated string.
Returns:
pointer to requested section if the section exists.
NULL if the section does not exist.

Definition at line 131 of file inifile.h.

void INIFile::Reset (  )  [inline]

Resets iteration.

Definition at line 42 of file inifile.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Defines

MiniINI was written by Ferdinand Majerech kiithsacmp[at]gmail.com
Generated on Wed Jun 16 18:51:44 2010 for MiniINI by  Doxygen 1.6.3