fgms 0.11.8
The
FlightGear MultiPlayer Server
project
FG_CONFIG Class Reference

Simple config file parser. More...

#include <fg_config.hxx>

Public Member Functions

void Dump ()
 Just for debugging to cout. More...
 
std::string Get (const std::string &VarName)
 Find a variable in the internal list and return its value. More...
 
std::string GetName ()
 Returns the complete name of the current variable. More...
 
std::string GetNext ()
 Get the value of the next variable in list. More...
 
std::string GetSecNextVal ()
 Return variable value of next variable in section. More...
 
std::string GetSecNextVar ()
 Get the next variable name in current section. More...
 
std::string GetValue ()
 Returns the current variable's value. More...
 
int Next ()
 Set internal pointer to the next var. More...
 
int Read (const std::string &ConfigName)
 Read in the config file. More...
 
int SecNext ()
 Set internal pointer to next variable in a section. More...
 
int SetSection (const std::string &SecName)
 Set internal pointer to the first variable of a section. More...
 
void SetStart ()
 Set internal pointer to the first variable in list. More...
 

Private Types

typedef std::list< mT_VarValuemT_VarList
 
typedef std::pair< std::string, std::string > mT_VarValue
 

Private Member Functions

int ParseLine (const std::string &ConfigLine)
 Parse the given line, split it into name/value pairs and put in the internal list. More...
 

Private Attributes

std::string m_CurrentSection
 
mT_VarList::iterator m_CurrentVar
 
mT_VarList m_VarList
 

Detailed Description

Simple config file parser.

Definition at line 46 of file fg_config.hxx.

Member Typedef Documentation

typedef std::list<mT_VarValue> FG_CONFIG::mT_VarList
private

Definition at line 63 of file fg_config.hxx.

typedef std::pair<std::string,std::string> FG_CONFIG::mT_VarValue
private

Definition at line 62 of file fg_config.hxx.

Member Function Documentation

void FG_CONFIG::Dump ( )

Just for debugging to cout.

Definition at line 290 of file fg_config.cxx.

std::string FG_CONFIG::Get ( const std::string &  VarName)

Find a variable in the internal list and return its value.

Parameters
VarName- the variable to find
Return values
string- with contents of variable, or blank string if not found

Definition at line 81 of file fg_config.cxx.

Referenced by ProcessConfig().

std::string FG_CONFIG::GetName ( )

Returns the complete name of the current variable.

Return values
stringThe variable name, or empty string if not found.

Definition at line 141 of file fg_config.cxx.

Referenced by ProcessConfig().

std::string FG_CONFIG::GetNext ( )

Get the value of the next variable in list.

Return values
stringThe value or empty string if not found

Definition at line 273 of file fg_config.cxx.

std::string FG_CONFIG::GetSecNextVal ( )

Return variable value of next variable in section.

Return values
stringThe value or empty string if not found

Definition at line 250 of file fg_config.cxx.

std::string FG_CONFIG::GetSecNextVar ( )

Get the next variable name in current section.

Return values
stringThe variable name, or empty string if not found

Definition at line 227 of file fg_config.cxx.

std::string FG_CONFIG::GetValue ( )

Returns the current variable's value.

Return values
stringThe variable name, or empty string if not found.

Definition at line 159 of file fg_config.cxx.

Referenced by ProcessConfig().

int FG_CONFIG::Next ( )

Set internal pointer to the next var.

Return values
int1 for success, else 0

Definition at line 118 of file fg_config.cxx.

int FG_CONFIG::ParseLine ( const std::string &  ConfigLine)
private

Parse the given line, split it into name/value pairs and put in the internal list.

Parameters
ConfigLineThe line to parse
Return values
int

Definition at line 318 of file fg_config.cxx.

int FG_CONFIG::Read ( const std::string &  ConfigName)

Read in the config file.

Parameters
ConfigName- the file to read
Return values
int1 for error, 0 for success

Definition at line 42 of file fg_config.cxx.

Referenced by ProcessConfig().

int FG_CONFIG::SecNext ( )

Set internal pointer to next variable in a section.

Return values
int1 on success, 0 else

Definition at line 205 of file fg_config.cxx.

Referenced by ProcessConfig().

int FG_CONFIG::SetSection ( const std::string &  SecName)

Set internal pointer to the first variable of a section.

Todo:
Sort the variable list
Parameters
SecNameString with section name
Return values
int1 on success, else 0

Definition at line 179 of file fg_config.cxx.

Referenced by ProcessConfig().

void FG_CONFIG::SetStart ( )

Set internal pointer to the first variable in list.

Definition at line 105 of file fg_config.cxx.

Member Data Documentation

std::string FG_CONFIG::m_CurrentSection
private

Definition at line 67 of file fg_config.hxx.

mT_VarList::iterator FG_CONFIG::m_CurrentVar
private

Definition at line 66 of file fg_config.hxx.

mT_VarList FG_CONFIG::m_VarList
private

Definition at line 65 of file fg_config.hxx.


The documentation for this class was generated from the following files: