MercuryINI Class Reference

Framework for INI files. More...

#include <MercuryINI.h>

Collaboration diagram for MercuryINI:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MercuryINI ()
 MercuryINI (const MString &sFileName, bool bSaveOnExit)
 ~MercuryINI ()
bool Open (const MString &sFileName, bool bAddIncludes=true, bool bClearToStart=false)
 Open a INI from a file; bAddIncludes specifies whether or not to look at [AdditionalFiles], bClearToStart states whether or not all data should be erased when starting.
bool Load (const char *sIniText, long slen)
 Load an INI from a given c-style string.
bool Load (const MString &sIniText)
 Load an INI from a given string.
bool Save (const MString sFileName="")
 Save the INI file.
void Dump (MString &data)
 Dump the file into the incoming MString.
long Dump (char *&toDump)
 Dump the file into then c-style string, this will also allocate ram.
void EnumerateKeys (MVector< MString > &keys)
 Enumerate all keys in this ini file into keys.
void EnumerateValues (const MString &key, MVector< MString > &values)
 Enumerate all values in the given key to values.
void EnumerateValues (const MString &key, std::map< MString, MString > &values)
 Enumerate all values in the given key to a map.
MString GetValueS (const MString &key, const MString &value, MString sDefaultValue="", bool bMakeValIfNoExist=false)
 Return string value, blank if non-existant.
long GetValueI (const MString &key, const MString &value, long iDefaultValue=0, bool bMakeValIfNoExist=false)
 Return long value, 0 if non-existant.
float GetValueF (const MString &key, const MString &value, float fDefaultValue=0, bool bMakeValIfNoExist=false)
 Return float value, 0 if non-existant.
bool GetValueB (const MString &key, const MString &value, bool bDefaultValue=0, bool bMakeValIfNoExist=false)
 Return bool value, 0 if non-existant.
bool GetValue (const MString &key, const MString &value, MString &data)
 Return value through data, false if non-existant.
void SetValue (const MString &key, const MString &value, const MString &data)
 Set a value.
bool RemoveValue (const MString &key, const MString &value)
 Remove a value.
MString GetLastError ()
 Get the last error.
void ToggleSaveOnExit (bool toggle)

Private Attributes

bool m_bSaveOnExit
 [internal] save all of the values when this ini file is destroyed
MString m_sLastError
MString m_sFileName
std::map< MString, std::map<
MString, MString > > 
m_mDatas
std::map< MString, bool > m_mLoaded

Detailed Description

Framework for INI files.

Definition at line 9 of file MercuryINI.h.


Constructor & Destructor Documentation

MercuryINI::MercuryINI (  )  [inline]

Definition at line 12 of file MercuryINI.h.

MercuryINI::MercuryINI ( const MString sFileName,
bool  bSaveOnExit 
)

Definition at line 9 of file MercuryINI.cpp.

MercuryINI::~MercuryINI (  ) 

Definition at line 15 of file MercuryINI.cpp.


Member Function Documentation

bool MercuryINI::Open ( const MString sFileName,
bool  bAddIncludes = true,
bool  bClearToStart = false 
)

Open a INI from a file; bAddIncludes specifies whether or not to look at [AdditionalFiles], bClearToStart states whether or not all data should be erased when starting.

Definition at line 23 of file MercuryINI.cpp.

bool MercuryINI::Load ( const char *  sIniText,
long  slen 
)

Load an INI from a given c-style string.

Definition at line 58 of file MercuryINI.cpp.

bool MercuryINI::Load ( const MString sIniText  )  [inline]

Load an INI from a given string.

Definition at line 21 of file MercuryINI.h.

bool MercuryINI::Save ( const MString  sFileName = ""  ) 

Save the INI file.

Definition at line 93 of file MercuryINI.cpp.

void MercuryINI::Dump ( MString data  ) 

Dump the file into the incoming MString.

Definition at line 116 of file MercuryINI.cpp.

long MercuryINI::Dump ( char *&  toDump  ) 

Dump the file into then c-style string, this will also allocate ram.

Definition at line 106 of file MercuryINI.cpp.

void MercuryINI::EnumerateKeys ( MVector< MString > &  keys  ) 

Enumerate all keys in this ini file into keys.

Definition at line 149 of file MercuryINI.cpp.

void MercuryINI::EnumerateValues ( const MString key,
MVector< MString > &  values 
)

Enumerate all values in the given key to values.

Definition at line 157 of file MercuryINI.cpp.

void MercuryINI::EnumerateValues ( const MString key,
std::map< MString, MString > &  values 
) [inline]

Enumerate all values in the given key to a map.

Definition at line 35 of file MercuryINI.h.

MString MercuryINI::GetValueS ( const MString key,
const MString value,
MString  sDefaultValue = "",
bool  bMakeValIfNoExist = false 
)

Return string value, blank if non-existant.

Definition at line 165 of file MercuryINI.cpp.

long MercuryINI::GetValueI ( const MString key,
const MString value,
long  iDefaultValue = 0,
bool  bMakeValIfNoExist = false 
)

Return long value, 0 if non-existant.

Definition at line 178 of file MercuryINI.cpp.

float MercuryINI::GetValueF ( const MString key,
const MString value,
float  fDefaultValue = 0,
bool  bMakeValIfNoExist = false 
)

Return float value, 0 if non-existant.

Definition at line 191 of file MercuryINI.cpp.

bool MercuryINI::GetValueB ( const MString key,
const MString value,
bool  bDefaultValue = 0,
bool  bMakeValIfNoExist = false 
)

Return bool value, 0 if non-existant.

Definition at line 204 of file MercuryINI.cpp.

bool MercuryINI::GetValue ( const MString key,
const MString value,
MString data 
)

Return value through data, false if non-existant.

Definition at line 217 of file MercuryINI.cpp.

void MercuryINI::SetValue ( const MString key,
const MString value,
const MString data 
)

Set a value.

Definition at line 229 of file MercuryINI.cpp.

bool MercuryINI::RemoveValue ( const MString key,
const MString value 
)

Remove a value.

Definition at line 234 of file MercuryINI.cpp.

MString MercuryINI::GetLastError (  )  [inline]

Get the last error.

Definition at line 56 of file MercuryINI.h.

void MercuryINI::ToggleSaveOnExit ( bool  toggle  )  [inline]

Definition at line 58 of file MercuryINI.h.


Member Data Documentation

bool MercuryINI::m_bSaveOnExit [private]

[internal] save all of the values when this ini file is destroyed

Definition at line 62 of file MercuryINI.h.

MString MercuryINI::m_sLastError [private]

Definition at line 63 of file MercuryINI.h.

MString MercuryINI::m_sFileName [private]

Definition at line 64 of file MercuryINI.h.

std::map< MString, std::map< MString, MString > > MercuryINI::m_mDatas [private]

Definition at line 65 of file MercuryINI.h.

std::map< MString, bool > MercuryINI::m_mLoaded [private]

Definition at line 66 of file MercuryINI.h.


The documentation for this class was generated from the following files:
Hosted by SourceForge.net Logo