INIFile Class Reference

#include <inifile.h>

List of all members.

Public Member Functions

 INIFile ()
 Empty constructor.
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
 Loads given INI file. (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 36 of file inifile.h.


Constructor & Destructor Documentation

INIFile::INIFile (  )  [inline]

Empty constructor.

Definition at line 28 of file inifile.h.

INIFile::~INIFile (  ) 

Destructor.

Deletes loaded INI file (if any)

Definition at line 259 of file inifile.cpp.


Member Function Documentation

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

Definition at line 126 of file inifile.h.

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

Loads given INI file. (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 91 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 273 of file inifile.cpp.

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

Definition at line 132 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 196 of file inifile.cpp.

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 53 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 22 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 118 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 104 of file inifile.h.


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

MiniINI was written by Ferdinand Majerech kiithsacmp[at]gmail.com
Generated on Sun Apr 11 17:08:19 2010 for MiniINI by  Doxygen 1.6.3