Public Member Functions

Barry::GlobalConfigFile Class Reference

Collaboration diagram for Barry::GlobalConfigFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GlobalConfigFile ()
 Loads the global config file.
 GlobalConfigFile (const std::string &appname)
 Loads the global config file, as well as any application-specific keywords and variables.
bool Save ()
 Save the current global config, overwriting or creating as needed.
void SetKey (const std::string &key, const std::string &value)
 Throws std::logic_error if not constructed with an appname.
std::string GetKey (const std::string &key, const std::string &default_value="") const
 Returns value for key, and returns default_value if key does not exist in the config file.

Detailed Description

Definition at line 149 of file configfile.h.


Constructor & Destructor Documentation

Barry::GlobalConfigFile::GlobalConfigFile (  ) 

Loads the global config file.

Throws ConfigFileError on error, but it is not an error if the config does not exist.

Definition at line 412 of file configfile.cc.

Barry::GlobalConfigFile::GlobalConfigFile ( const std::string &  appname  ) 

Loads the global config file, as well as any application-specific keywords and variables.

Use this if you wish to make use of SetKey() and GetKey(), otherwise these functions will throw and exception since they don't have an application name.

Definition at line 420 of file configfile.cc.


Member Function Documentation

std::string Barry::GlobalConfigFile::GetKey ( const std::string &  key,
const std::string &  default_value = "" 
) const

Returns value for key, and returns default_value if key does not exist in the config file.

Throws std::logic_error if not constructed with an appname

Definition at line 541 of file configfile.cc.

bool Barry::GlobalConfigFile::Save (  ) 

Save the current global config, overwriting or creating as needed.

Definition at line 499 of file configfile.cc.

void Barry::GlobalConfigFile::SetKey ( const std::string &  key,
const std::string &  value 
)

Throws std::logic_error if not constructed with an appname.

Definition at line 529 of file configfile.cc.


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