Pol  Revision:4b29d2b
Pol::Clib::ConfigFile Class Reference

#include <cfgfile.h>

+ Inheritance diagram for Pol::Clib::ConfigFile:

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
 
time_t modified () const
 
void open (const char *i_filename)
 
bool read (ConfigElem &elem)
 
void readraw (ConfigElem &elem)
 
- Public Member Functions inherited from Pol::Clib::ConfigSource
virtual ~ConfigSource ()
 

Protected Member Functions

bool _read (ConfigElem &elem)
 
bool _read (VectorConfigElem &elem)
 
POL_NORETURN void display_and_rethrow_exception ()
 
virtual void display_error (const std::string &msg, bool show_curline=true, const ConfigElemBase *elem=NULL, bool error=true) const POL_OVERRIDE
 
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< std::string, ci_cmp_predAllowedTypesCont
 

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 44 of file cfgfile.h.

Member Typedef Documentation

typedef std::set<std::string, ci_cmp_pred> Pol::Clib::ConfigFile::AllowedTypesCont
private

Definition at line 88 of file cfgfile.h.

Constructor & Destructor Documentation

Pol::Clib::ConfigFile::ConfigFile ( const char *  filename = NULL,
const char *  allowed_types = NULL 
)
explicit

Definition at line 541 of file cfgfile.cpp.

References init().

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

Definition at line 555 of file cfgfile.cpp.

References init().

Member Function Documentation

void Pol::Clib::ConfigFile::display_and_rethrow_exception ( )
protected

Definition at line 989 of file cfgfile.cpp.

References display_error().

Referenced by read(), and readraw().

void Pol::Clib::ConfigFile::display_error ( const std::string &  msg,
bool  show_curline = true,
const ConfigElemBase elem = NULL,
bool  error = true 
) const
protectedvirtual
unsigned Pol::Clib::ConfigFile::element_line_start ( ) const

Definition at line 595 of file cfgfile.cpp.

References _element_line_start.

Referenced by ~ConfigFile().

const std::string & Pol::Clib::ConfigFile::filename ( ) const

Definition at line 587 of file cfgfile.cpp.

References _filename.

Referenced by Pol::Clib::ConfigSection::~ConfigSection().

void Pol::Clib::ConfigFile::init ( const char *  i_filename,
const char *  allowed_types_str 
)
protected

Definition at line 569 of file cfgfile.cpp.

References allowed_types_, ISTRINGSTREAM, and open().

Referenced by ConfigFile().

time_t Pol::Clib::ConfigFile::modified ( ) const

Definition at line 591 of file cfgfile.cpp.

References _modified.

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

void Pol::Clib::ConfigFile::open ( const char *  i_filename)
bool Pol::Clib::ConfigFile::read ( ConfigElem elem)

Definition at line 1015 of file cfgfile.cpp.

References _read(), Pol::Clib::ConfigElemBase::_source, and display_and_rethrow_exception().

Referenced by Pol::Core::FindEquipTemplate(), Pol::Core::FindNpcTemplate(), Pol::Core::import_new_data(), Pol::Plib::RealmDescriptor::Load(), Pol::Module::DataFileContents::load(), Pol::Core::StoredConfigFile::load(), Pol::Core::load_anim_xlate_cfg(), Pol::Mobile::load_armor_zones(), Pol::Core::load_circle_data(), Pol::Core::load_cmdlevels(), Pol::Core::ConsoleCommand::load_console_commands(), Pol::Module::load_fileaccess_cfg(), Pol::Core::load_incremental_indexes(), Pol::Core::load_mime_config(), Pol::Core::load_movecost(), Pol::Items::load_npc_intrinsic_equip(), Pol::Core::load_npc_templates(), Pol::Plib::load_packages(), Pol::Core::load_party_cfg(), Pol::Core::load_repsys_cfg(), Pol::Core::load_resource_cfg(), Pol::Core::load_spells_cfg(), Pol::Plib::MapWriter::OpenExistingFiles(), Pol::Core::process_package_cmds_cfg(), Pol::Core::Storage::read(), Pol::Accounts::read_account_data(), Pol::Network::read_bannedips_config(), Pol::Multi::read_boat_cfg(), Pol::Module::read_datastore_dat(), Pol::Core::read_gameservers(), Pol::Core::read_guilds_dat(), Pol::Items::read_itemdesc_file(), Pol::Core::Menu::read_menus(), Pol::Multi::read_multidefs(), Pol::Core::read_party_dat(), Pol::Core::read_region_data(), Pol::Core::read_resources_dat(), Pol::Core::read_stacking_cfg(), Pol::Core::read_starting_locations(), Pol::Accounts::reload_account_data(), and Pol::Core::slurp().

bool Pol::Clib::ConfigFile::read_properties ( ConfigElem elem)
protected
bool Pol::Clib::ConfigFile::read_properties ( VectorConfigElem elem)
protected
bool Pol::Clib::ConfigFile::readline ( std::string &  strbuf)
protected

Definition at line 739 of file cfgfile.cpp.

References buffer, and fp.

Referenced by _read(), and read_properties().

void Pol::Clib::ConfigFile::register_allowed_type ( const char *  allowed_type)
protected

Friends And Related Function Documentation

friend class ConfigElem
friend

Definition at line 63 of file cfgfile.h.

friend class ConfigSection
friend

Definition at line 64 of file cfgfile.h.

Member Data Documentation

int Pol::Clib::ConfigFile::_cur_line
private

Definition at line 86 of file cfgfile.h.

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

int Pol::Clib::ConfigFile::_element_line_start
private

Definition at line 85 of file cfgfile.h.

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

std::string Pol::Clib::ConfigFile::_filename
private

Definition at line 77 of file cfgfile.h.

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

time_t Pol::Clib::ConfigFile::_modified
private

Definition at line 78 of file cfgfile.h.

Referenced by modified(), and open().

AllowedTypesCont Pol::Clib::ConfigFile::allowed_types_
private

Definition at line 89 of file cfgfile.h.

Referenced by _read(), Pol::Clib::ConfigSection::ConfigSection(), init(), and ~ConfigFile().

char Pol::Clib::ConfigFile::buffer
staticprivate

Definition at line 83 of file cfgfile.h.

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

FILE* Pol::Clib::ConfigFile::fp
private

Definition at line 82 of file cfgfile.h.

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


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