INIFile Class Reference

Reads data from an INI file and gives access to its sections. More...

#include <inifile.h>

List of all members.

Public Member Functions

 INIFile ()
 Empty constructor.
void Reset ()
 Resets iteration.
bool Next ()
 Advances iteration to the next section.
bool OpenFile (const char *const fname)
 Loads data from an INI file.
bool OpenFile (const std::string &fname)
 Loads data from an INI file (STL version).
bool LoadBuffer (const char *buf, unsigned size)
 Loads data from a buffer.
 ~INIFile ()
 Destructor.
INISectionGetSection (const char *const name) const
 Gets pointer a section.
INISectionGetSection (const std::string &name) const
 Gets pointer to a 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
 Gets number of sections in the file.
bool IsValid () const
 Determines if the INIFile is initialized.

Detailed Description

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

Definition at line 30 of file inifile.h.


Constructor & Destructor Documentation

INIFile::INIFile (  )  [inline]

Empty constructor.

Definition at line 47 of file inifile.h.

INIFile::~INIFile (  ) 

Destructor.

Deletes loaded INI data (if any).

Definition at line 176 of file inifile.cpp.


Member Function Documentation

unsigned INIFile::GetLength (  )  const [inline]

Gets number of sections in the file.

Returns:
number of sections in the file.

Definition at line 160 of file inifile.h.

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

Gets pointer to a section (STL version).

Parameters:
name Name of the section to get.
Returns:
pointer to the section if it exists.
NULL if the section doesn't exist.

Definition at line 127 of file inifile.h.

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

Gets pointer a section.

Parameters:
name Name of the section to get. Must be a zero terminated string.
Returns:
pointer to the section if it exists.
NULL if the section doesn't exist.

Definition at line 190 of file inifile.cpp.

bool INIFile::IsValid (  )  const [inline]

Determines if the INIFile is initialized.

Returns:
true if this INIFile is initialized.
false if this INIFile is not initialized.

Definition at line 169 of file inifile.h.

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

Loads data from a buffer.

Note:
You can only call LoadBuffer on an uninitialized INIFile.
Given buffer must end with a zero character.
Buffer will be loaded even if it's empty, and even empty sections will be read. Useful when loading from archives.
Parameters:
buf Buffer to load from. Must be zero terminated.
size Size of the buffer in bytes (including terminating zero).
Returns:
true if successfully loaded.
false if there was an error and the buffer was not loaded.

Definition at line 104 of file inifile.cpp.

bool INIFile::Next (  )  [inline]

Advances iteration to the next section.

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

Definition at line 64 of file inifile.h.

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

Loads data from an INI file (STL version).

Note:
You can only call OpenFile on an uninitialized INIFile.
File will be loaded even if it's empty, and even empty sections will be read.
Parameters:
fname Name of the file to load.
Returns:
true if the file is successfully loaded.
false if the file couldn't be loaded.

Definition at line 91 of file inifile.h.

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

Loads data from an INI file.

Note:
You can only call OpenFile on an uninitialized INIFile.
File will be loaded even if it's empty, and even empty sections will be read.
Parameters:
fname Name of the file to load. Must be a zero terminated string.
Returns:
true if the file was successfully loaded.
false if the file couldn't be loaded.

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 the section if it exists.
NULL if the section doesn't exist.

Definition at line 151 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 zero terminated string.
Returns:
pointer to the section if it exists.
NULL if the section doesn't exist.

Definition at line 138 of file inifile.h.

void INIFile::Reset (  )  [inline]

Resets iteration.

Definition at line 55 of file inifile.h.


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

Copyright © Ferdinand Majerech 2009-2010 kiithsacmp[at]gmail.com
Generated on Fri Jul 9 15:09:53 2010 for MiniINI by  Doxygen 1.6.3