Pyrogenesis trunk
Namespaces | Macros | Typedefs | Functions | Variables
ConfigDB.cpp File Reference
#include "precompiled.h"
#include "ConfigDB.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/file/vfs/vfs_path.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "ps/Filesystem.h"
#include <boost/algorithm/string/predicate.hpp>
#include <mutex>
#include <unordered_set>
Include dependency graph for ConfigDB.cpp:

Namespaces

namespace  anonymous_namespace{ConfigDB.cpp}
 

Macros

#define CHECK_NS(rval)
 
#define GETVAL(type)
 

Typedefs

typedef std::map< CStr, CConfigValueSetTConfigMap
 

Functions

void anonymous_namespace{ConfigDB.cpp}::TriggerAllHooks (const std::multimap< CStr, std::function< void()> > &hooks, const CStr &name)
 
template<typename T >
void anonymous_namespace{ConfigDB.cpp}::Get (const CStr &value, T &ret)
 
template<>
void anonymous_namespace{ConfigDB.cpp}::Get (const CStr &value, bool &ret)
 
template<>
void anonymous_namespace{ConfigDB.cpp}::Get (const CStr &value, std::string &ret)
 
std::string anonymous_namespace{ConfigDB.cpp}::EscapeString (const CStr &str)
 

Variables

const std::unordered_set< std::string > anonymous_namespace{ConfigDB.cpp}::g_UnloggedEntries
 
std::unique_ptr< CConfigDBg_ConfigDBPtr
 

Macro Definition Documentation

◆ CHECK_NS

#define CHECK_NS (   rval)
Value:
do {\
if (ns < 0 || ns >= CFG_LAST)\
{\
debug_warn(L"CConfigDB: Invalid ns value");\
return rval;\
}\
} while (false)
@ CFG_LAST
Definition: ConfigDB.h:54

◆ GETVAL

#define GETVAL (   type)
Value:
void CConfigDB::GetValue(EConfigNamespace ns, const CStr& name, type& value)\
{\
CHECK_NS(;);\
std::lock_guard<std::recursive_mutex> s(m_Mutex);\
TConfigMap::iterator it = m_Map[CFG_COMMAND].find(name);\
if (it != m_Map[CFG_COMMAND].end())\
{\
if (!it->second.empty())\
Get(it->second[0], value);\
return;\
}\
for (int search_ns = ns; search_ns >= 0; --search_ns)\
{\
it = m_Map[search_ns].find(name);\
if (it != m_Map[search_ns].end())\
{\
if (!it->second.empty())\
Get(it->second[0], value);\
return;\
}\
}\
}
EConfigNamespace
Namespace priorities:
Definition: ConfigDB.h:47
@ CFG_COMMAND
Definition: ConfigDB.h:53
void GetValue(EConfigNamespace ns, const CStr &name, bool &value)
Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first...

Typedef Documentation

◆ TConfigMap

typedef std::map<CStr, CConfigValueSet> TConfigMap

Variable Documentation

◆ g_ConfigDBPtr

std::unique_ptr<CConfigDB> g_ConfigDBPtr