Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
WsGlobalProperties Class Reference

Global properties class. More...

#include <WsGlobalProperties.h>

Inheritance diagram for WsGlobalProperties:
Inheritance graph
Collaboration diagram for WsGlobalProperties:
Collaboration graph

Public Member Functions

std::string get (const std::string &section, const std::string &id, const std::string &def)
 
void set (const std::string &section, std::string key, std::string value)
 Changes or sets the propety with key 'key' to value 'value' If the property already exist, it will be overriden This method does not however, update the config file. More...
 
std::string getAndReplace (const std::string &section, const std::string &id, const std::string &newVal, const std::string &def)
 Search for property id and replaces the $1 in the string with newVal. If the property is not found, def will be returned. More...
 

Static Public Member Functions

static WsGlobalPropertiesinstance ()
 

Protected Member Functions

 WsGlobalProperties ()
 Constructor. More...
 
int parse (const std::string &path)
 parse the Json config file More...
 

Protected Attributes

Json::Value m_root
 
bool m_parsed
 

Static Private Attributes

static WsGlobalPropertiesm_instance = 0
 

Detailed Description

Global properties class.

Contains settings for running wittyshare

Definition at line 26 of file WsGlobalProperties.h.

Constructor & Destructor Documentation

WsGlobalProperties::WsGlobalProperties ( )
protected

Constructor.

Definition at line 23 of file WsGlobalProperties.cpp.

Here is the caller graph for this function:

Member Function Documentation

std::string WsGlobalProperties::get ( const std::string &  section,
const std::string &  id,
const std::string &  def 
)
virtual

Implements WsAbstractProperties.

Definition at line 38 of file WsGlobalProperties.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string WsGlobalProperties::getAndReplace ( const std::string &  section,
const std::string &  id,
const std::string &  newVal,
const std::string &  def 
)

Search for property id and replaces the $1 in the string with newVal. If the property is not found, def will be returned.

Parameters
sectionthe section in the Json file
idthe key in the Json file
newValthe value that will replace the $1
defthe default value returned if not found
Returns
the value with $1 replaced with newVal or def otherwise

Definition at line 52 of file WsGlobalProperties.cpp.

Here is the call graph for this function:

WsGlobalProperties * WsGlobalProperties::instance ( )
static

Definition at line 28 of file WsGlobalProperties.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsAbstractProperties::parse ( const std::string &  path)
protectedinherited

parse the Json config file

Parameters
paththe path to the configuration file
Returns
SUCCESS if file is ok, FAILURE otherwise

Definition at line 28 of file WsAbstractProperties.cpp.

Here is the caller graph for this function:

void WsGlobalProperties::set ( const std::string &  section,
std::string  key,
std::string  value 
)

Changes or sets the propety with key 'key' to value 'value' If the property already exist, it will be overriden This method does not however, update the config file.

Parameters
keythe key in the Json file
valuethe value assigned to the key

Definition at line 70 of file WsGlobalProperties.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

WsGlobalProperties * WsGlobalProperties::m_instance = 0
staticprivate

Definition at line 68 of file WsGlobalProperties.h.

bool WsAbstractProperties::m_parsed
protectedinherited

True or false whether the configuration file has already be parsed or no This flag is changed by the WsAbstractProperties::parse method

Definition at line 66 of file WsAbstractProperties.h.

Json::Value WsAbstractProperties::m_root
protectedinherited

Root of the Json tree where. This is where the contents of Json parsed file is stored

Definition at line 60 of file WsAbstractProperties.h.


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