INISection Class Reference

Section of ini file. More...

#include <inisection.h>

List of all members.

Public Member Functions

const char * GetName () const
bool ReadString (const char *const name, const char *&out) const
 Read a string value from given tag.
bool ReadInt (const char *const name, int &out) const
 Read an int value from given tag.
bool ReadFloat (const char *const name, float &out) const
 Read a float value from given tag.
bool ReadBool (const char *const name, bool &out) const
 Read a bool value from given tag.
unsigned ReadStrings (const char *const name, const char **out, const unsigned cap) const
 Read an array of strings from a sequence of tags with given base name.
unsigned ReadInts (const char *const name, int *out, const unsigned cap) const
 Read an array of ints from a sequence of tags with given base name.
unsigned ReadFloats (const char *const name, float *out, const unsigned cap) const
 Read an array of floats from a sequence of tags with given base name.
unsigned ReadBools (const char *const name, bool *out, const unsigned cap) const
 Read an array of bools from a sequence of tags with given base name.
unsigned GetLength () const

Detailed Description

Section of ini file.

Definition at line 14 of file inisection.h.


Member Function Documentation

unsigned INISection::GetLength (  )  const
Returns:
number of tags in the section.

Definition at line 604 of file inisection.cpp.

const char * INISection::GetName (  )  const
Returns:
name of this section.

Definition at line 227 of file inisection.cpp.

bool INISection::ReadBool ( const char *const   name,
bool &  out 
) const

Read a bool value from given tag.

Parameters:
name Name of the tag to read from. Must be a valid zero terminated string.
out Reference to variable to read to.
Returns:
true if the value was read succesfully
false if the tag does not exist (value was not read)

Definition at line 361 of file inisection.cpp.

unsigned INISection::ReadBools ( const char *const   name,
bool *  out,
const unsigned  cap 
) const

Read an array of bools from a sequence of tags with given base name.

Reads values from tags named name1=, name2=, etc. where name is the given base name for the tags. Continues to read successive elements until it either reads as many elements as given capacity, there are no more elements left in section, or it encounters an element in wrong order, e.g. name4= after name2= .

Parameters:
name Base name of the tags to read from. Must be a valid zero terminated string.
out Pointer to buffer to read to.
cap Capacity of the buffer.
Returns:
number of values read

Definition at line 563 of file inisection.cpp.

bool INISection::ReadFloat ( const char *const   name,
float &  out 
) const

Read a float value from given tag.

Parameters:
name Name of the tag to read from. Must be a valid zero terminated string.
out Reference to variable to read to.
Returns:
true if the value was read succesfully
false if the tag does not exist (value was not read)

Definition at line 324 of file inisection.cpp.

unsigned INISection::ReadFloats ( const char *const   name,
float *  out,
const unsigned  cap 
) const

Read an array of floats from a sequence of tags with given base name.

Reads values from tags named name1=, name2=, etc. where name is the given base name for the tags. Continues to read successive elements until it either reads as many elements as given capacity, there are no more elements left in section, or it encounters an element in wrong order, e.g. name4= after name2= .

Parameters:
name Base name of the tags to read from. Must be a valid zero terminated string.
out Pointer to buffer to read to.
cap Capacity of the buffer.
Returns:
number of values read

Definition at line 511 of file inisection.cpp.

bool INISection::ReadInt ( const char *const   name,
int &  out 
) const

Read an int value from given tag.

Parameters:
name Name of the tag to read from. Must be a valid zero terminated string.
out Reference to variable to read to.
Returns:
true if the value was read succesfully
false if the tag does not exist (value was not read)

Definition at line 286 of file inisection.cpp.

unsigned INISection::ReadInts ( const char *const   name,
int *  out,
const unsigned  cap 
) const

Read an array of ints from a sequence of tags with given base name.

Reads values from tags named name1=, name2=, etc. where name is the given base name for the tags. Continues to read successive elements until it either reads as many elements as given capacity, there are no more elements left in section, or it encounters an element in wrong order, e.g. name4= after name2= .

Parameters:
name Base name of the tags to read from. Must be a valid zero terminated string.
out Pointer to buffer to read to.
cap Capacity of the buffer.
Returns:
number of values read

Definition at line 458 of file inisection.cpp.

bool INISection::ReadString ( const char *const   name,
const char *&  out 
) const

Read a string value from given tag.

Note that unlike other ReadXXX methods, ReadString only gives a pointer to data inside the INISection. If you want to use this data after INIFile is destroyed, you have to copy it.

Parameters:
name Name of the tag to read from. Must be a valid zero terminated string.
out Reference to variable to read to.
Returns:
true if the value was read succesfully
false if the tag does not exist (value was not read)

Definition at line 232 of file inisection.cpp.

unsigned INISection::ReadStrings ( const char *const   name,
const char **  out,
const unsigned  cap 
) const

Read an array of strings from a sequence of tags with given base name.

Reads values from tags named name1=, name2=, etc. where name is the given base name for the tags. Continues to read successive elements until it either reads as many elements as given capacity, there are no more elements left in section, or it encounters an element in wrong order, e.g. name4= after name2= . Note that unlike other ReadXXXs methods, ReadStrings only gives a pointer to data inside the INISection. If you want to use this data after INIFile is destroyed, you have to copy it.

Parameters:
name Base name of the tags to read from. Must be a valid zero terminated string.
out Pointer to buffer to read to.
cap Capacity of the buffer.
Returns:
number of values read

Definition at line 386 of file inisection.cpp.


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

Generated by  doxygen 1.6.2