fgms 0.13.5
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

◆ mT_VarList

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

Definition at line 63 of file fg_config.hxx.

◆ mT_VarValue

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

Definition at line 62 of file fg_config.hxx.

Member Function Documentation

◆ Dump()

void FG_CONFIG::Dump ( )

Just for debugging to cout.

Definition at line 279 of file fg_config.cxx.

Referenced by GetNext().

◆ Get()

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 80 of file fg_config.cxx.

Referenced by ProcessConfig().

◆ GetName()

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 135 of file fg_config.cxx.

Referenced by ProcessConfig().

◆ GetNext()

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 262 of file fg_config.cxx.

Referenced by GetSecNextVal().

◆ GetSecNextVal()

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 239 of file fg_config.cxx.

Referenced by GetSecNextVar().

◆ GetSecNextVar()

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 216 of file fg_config.cxx.

Referenced by SecNext().

◆ GetValue()

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 152 of file fg_config.cxx.

Referenced by ProcessConfig().

◆ Next()

int FG_CONFIG::Next ( )

Set internal pointer to the next var.

Return values
int1 for success, else 0

Definition at line 113 of file fg_config.cxx.

Referenced by GetNext(), GetSecNextVal(), GetSecNextVar(), and SecNext().

◆ ParseLine()

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 307 of file fg_config.cxx.

Referenced by Dump().

◆ Read()

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().

◆ SecNext()

int FG_CONFIG::SecNext ( )

Set internal pointer to next variable in a section.

Return values
int1 on success, 0 else

Definition at line 194 of file fg_config.cxx.

Referenced by ProcessConfig().

◆ SetSection()

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 171 of file fg_config.cxx.

Referenced by ProcessConfig().

◆ SetStart()

void FG_CONFIG::SetStart ( )

Set internal pointer to the first variable in list.

Definition at line 101 of file fg_config.cxx.

Referenced by SetSection().

Member Data Documentation

◆ m_CurrentSection

std::string FG_CONFIG::m_CurrentSection
private

Definition at line 67 of file fg_config.hxx.

Referenced by GetSecNextVal(), GetSecNextVar(), SecNext(), and SetSection().

◆ m_CurrentVar

mT_VarList::iterator FG_CONFIG::m_CurrentVar
private

◆ m_VarList

mT_VarList FG_CONFIG::m_VarList
private

Definition at line 65 of file fg_config.hxx.

Referenced by Dump(), Get(), GetName(), GetValue(), Next(), ParseLine(), SetSection(), and SetStart().


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