Pol  Rev 533
ConfigFile Class Reference

#include <cfgfile.h>

+ Inheritance diagram for ConfigFile:
+ Collaboration diagram for ConfigFile:

List of all members.

Public Member Functions

 ConfigFile (const char *filename=NULL, const char *allowed_types=NULL)
 ConfigFile (const std::string &filename, const char *allowed_types=NULL)
virtual ~ConfigFile ()
unsigned element_line_start () const
const std::string & filename () const
const time_t modified () const
void open (const char *i_filename)
bool read (ConfigElem &elem)
void readraw (ConfigElem &elem)

Protected Member Functions

bool _read (ConfigElem &elem)
bool _read (VectorConfigElem &elem)
void display_and_rethrow_exception ()
void display_error (const std::string &msg, bool show_curline=true, const ConfigElemBase *elem=NULL, bool error=true) const
void init (const char *i_filename, const char *allowed_types_str)
bool read_properties (ConfigElem &elem)
bool read_properties (VectorConfigElem &elem)
bool readline (std::string &strbuf)
void register_allowed_type (const char *allowed_type)

Private Types

typedef std::set< string,
ci_cmp_pred
AllowedTypesCont

Private Attributes

int _cur_line
int _element_line_start
std::string _filename
time_t _modified
AllowedTypesCont allowed_types_
FILE * fp

Static Private Attributes

static char buffer [1024]

Friends

class ConfigElem
class ConfigSection

Detailed Description

Definition at line 47 of file cfgfile.h.


Member Typedef Documentation

typedef std::set<string, ci_cmp_pred> ConfigFile::AllowedTypesCont [private]

Definition at line 92 of file cfgfile.h.


Constructor & Destructor Documentation

ConfigFile::ConfigFile ( const char *  filename = NULL,
const char *  allowed_types = NULL 
) [explicit]

Definition at line 609 of file cfgfile.cpp.

References init().

+ Here is the call graph for this function:

ConfigFile::ConfigFile ( const std::string &  filename,
const char *  allowed_types = NULL 
) [explicit]

Definition at line 624 of file cfgfile.cpp.

References init().

+ Here is the call graph for this function:

ConfigFile::~ConfigFile ( ) [virtual]

Definition at line 696 of file cfgfile.cpp.

References fp.


Member Function Documentation

bool ConfigFile::_read ( ConfigElem elem) [protected]

Definition at line 904 of file cfgfile.cpp.

References _cur_line, _element_line_start, allowed_types_, buffer, commentline(), fp, OSTRINGSTREAM, OSTRINGSTREAM_STR, ConfigElem::properties, read_properties(), readline(), ConfigElemBase::rest_, splitnamevalue(), and ConfigElemBase::type_.

Referenced by read().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 1070 of file cfgfile.cpp.

References display_error().

Referenced by read(), and readraw().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ConfigFile::display_error ( const std::string &  msg,
bool  show_curline = true,
const ConfigElemBase elem = NULL,
bool  error = true 
) const [protected, virtual]

Implements ConfigSource.

Definition at line 1040 of file cfgfile.cpp.

References _cur_line, _element_line_start, _filename, ConfigElemBase::rest(), and ConfigElemBase::type().

Referenced by display_and_rethrow_exception(), and ConfigSection::~ConfigSection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned ConfigFile::element_line_start ( ) const

Definition at line 665 of file cfgfile.cpp.

References _element_line_start.

const string & ConfigFile::filename ( ) const

Definition at line 657 of file cfgfile.cpp.

References _filename.

Referenced by ConfigSection::~ConfigSection().

+ Here is the caller graph for this function:

void ConfigFile::init ( const char *  i_filename,
const char *  allowed_types_str 
) [protected]

Definition at line 639 of file cfgfile.cpp.

References allowed_types_, ISTRINGSTREAM, and open().

Referenced by ConfigFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const time_t ConfigFile::modified ( ) const

Definition at line 661 of file cfgfile.cpp.

References _modified.

Referenced by StoredConfigFile::load(), and load_mime_config().

+ Here is the caller graph for this function:

void ConfigFile::open ( const char *  i_filename)

Definition at line 670 of file cfgfile.cpp.

References _filename, _modified, and fp.

Referenced by FindNpcTemplate(), init(), read_combat_config(), read_extobj(), read_servspecopt(), and set_watch_vars().

+ Here is the caller graph for this function:

bool ConfigFile::read_properties ( ConfigElem elem) [protected]

Definition at line 839 of file cfgfile.cpp.

References _cur_line, commentline(), decodequotedstring(), ISTRINGSTREAM, ConfigElem::properties, readline(), and splitnamevalue().

Referenced by _read(), and readraw().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ConfigFile::read_properties ( VectorConfigElem elem) [protected]

Definition at line 870 of file cfgfile.cpp.

References _cur_line, commentline(), decodequotedstring(), ISTRINGSTREAM, VectorConfigElem::properties, readline(), and splitnamevalue().

+ Here is the call graph for this function:

bool ConfigFile::readline ( std::string &  strbuf) [protected]

Definition at line 811 of file cfgfile.cpp.

References buffer, and fp.

Referenced by _read(), and read_properties().

+ Here is the caller graph for this function:

void ConfigFile::readraw ( ConfigElem elem)

Definition at line 1110 of file cfgfile.cpp.

References ConfigElemBase::_source, display_and_rethrow_exception(), and read_properties().

Referenced by read_combat_config(), read_extobj(), read_pol_config(), read_servspecopt(), set_watch_vars(), and xmain().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ConfigFile::register_allowed_type ( const char *  allowed_type) [protected]

Friends And Related Function Documentation

friend class ConfigElem [friend]

Definition at line 66 of file cfgfile.h.

friend class ConfigSection [friend]

Definition at line 67 of file cfgfile.h.


Member Data Documentation

int ConfigFile::_cur_line [private]

Definition at line 90 of file cfgfile.h.

Referenced by _read(), display_error(), and read_properties().

Definition at line 89 of file cfgfile.h.

Referenced by _read(), display_error(), and element_line_start().

std::string ConfigFile::_filename [private]

Definition at line 81 of file cfgfile.h.

Referenced by display_error(), filename(), and open().

time_t ConfigFile::_modified [private]

Definition at line 82 of file cfgfile.h.

Referenced by modified(), and open().

Definition at line 93 of file cfgfile.h.

Referenced by _read(), ConfigSection::ConfigSection(), and init().

char ConfigFile::buffer [static, private]

Definition at line 87 of file cfgfile.h.

Referenced by _read(), and readline().

FILE* ConfigFile::fp [private]

Definition at line 86 of file cfgfile.h.

Referenced by _read(), open(), readline(), and ~ConfigFile().


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