presage  0.9.2~beta
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Profile Class Reference

#include <profile.h>

Inheritance diagram for Profile:
Inheritance graph
Collaboration diagram for Profile:
Collaboration graph

Classes

class  ProfileException
 

Public Member Functions

 Profile (const std::string &filename)
 
virtual ~Profile ()
 
void read_into_configuration (Configuration *configuration)
 
void read_from_configuration (Configuration *configuration)
 
bool file_read_ok () const
 
bool write_to_file () const
 

Protected Member Functions

void init_configuration (Configuration *config, TiXmlDocument *node)
 
void visit_node (Configuration *config, TiXmlNode *node, std::vector< std::string > variable)
 

Protected Attributes

TiXmlDocument * xmlProfileDoc
 
std::string xml_filename
 
bool xml_profile_read_ok
 

Detailed Description

Profile provides access to the active profile configuration variables.

Profile only provides an accessor method to read configuration values. The class is immutable. It is not possible to modify configuration values. Configuration values are set when the Profile is constructed.

Profile acts as an interface to ProfileManager. It converts simple requests for configuration variable values from client objects (such as Plugin objects) into requests to ProfileManager. There is no need to have a map containing the variable, value pairs. It is sufficient to keep a reference to ProfileManager and have ProfileManager expose an interface that Profile can use to query variable values.

Definition at line 56 of file profile.h.

Constructor & Destructor Documentation

◆ Profile()

Profile::Profile ( const std::string &  filename)

Profile constructor.

Parameters
filenamewhere profile is saved to

Definition at line 30 of file profile.cpp.

References xml_filename, xml_profile_read_ok, and xmlProfileDoc.

◆ ~Profile()

Profile::~Profile ( )
virtual

Profile destructor.

Destructor deallocates the Configuration object passed in costructor.

Definition at line 40 of file profile.cpp.

References xmlProfileDoc.

Member Function Documentation

◆ file_read_ok()

bool Profile::file_read_ok ( ) const

Definition at line 45 of file profile.cpp.

References xml_profile_read_ok.

Referenced by ProfileManager::create_profile_from_xml(), and ProfileManager::init_profiles().

Here is the caller graph for this function:

◆ init_configuration()

void Profile::init_configuration ( Configuration config,
TiXmlDocument *  node 
)
protected

Definition at line 55 of file profile.cpp.

References config, and visit_node().

Referenced by read_into_configuration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_from_configuration()

void Profile::read_from_configuration ( Configuration configuration)

Definition at line 102 of file profile.cpp.

References Configuration::begin(), Configuration::end(), Variable::string_to_vector(), and xmlProfileDoc.

Referenced by ProfileManager::save_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_into_configuration()

void Profile::read_into_configuration ( Configuration configuration)

Writes configuration from XML DOM document into configuration.

Definition at line 50 of file profile.cpp.

References config, init_configuration(), and xmlProfileDoc.

Referenced by ProfileManager::init_profiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visit_node()

void Profile::visit_node ( Configuration config,
TiXmlNode *  node,
std::vector< std::string >  variable 
)
protected

Definition at line 62 of file profile.cpp.

References Configuration::insert(), and Variable::vector_to_string().

Referenced by init_configuration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_to_file()

bool Profile::write_to_file ( ) const

Definition at line 96 of file profile.cpp.

References xml_filename, and xmlProfileDoc.

Referenced by ProfileManager::save_profile().

Here is the caller graph for this function:

Member Data Documentation

◆ xml_filename

std::string Profile::xml_filename
protected

Definition at line 100 of file profile.h.

Referenced by Profile(), and write_to_file().

◆ xml_profile_read_ok

bool Profile::xml_profile_read_ok
protected

Definition at line 101 of file profile.h.

Referenced by file_read_ok(), and Profile().

◆ xmlProfileDoc

TiXmlDocument* Profile::xmlProfileDoc
protected

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