libDwm-0.6.0
Dwm::Registry Class Reference

This class encapsulates a simple registry file, which contains lines of the form: key = "value" If value contains quotes, they must be escaped in the registry file. More...

#include <DwmRegistry.hh>

Public Member Functions

 Registry (const std::string &filename)
 Constructor.
 
bool Reload ()
 
bool Save () const
 Save the registry to its file. Returns true on success.
 
std::string Get (const std::string &key) const
 Gets the value for key in the registry. More...
 
const std::string & Set (const std::string &key, const std::string &value)
 Sets the value for key in the registry. More...
 

Protected Attributes

std::string _filename
 
std::map< std::string, std::string > _map
 

Detailed Description

This class encapsulates a simple registry file, which contains lines of the form: key = "value" If value contains quotes, they must be escaped in the registry file.

For example: dwm = "Daniel \"Dano" McRobb" The Save() member will take care of escaping quotes for the caller. Comments lines are permitted in the registry file; they must start with a '#' in the first column. Note that comments will not be saved by Save(); this may be fixed at a later date.

Member Function Documentation

◆ Get()

std::string Dwm::Registry::Get ( const std::string &  key) const

Gets the value for key in the registry.

If \ key does not exist in the registry, returns an empty string.

◆ Set()

const std::string& Dwm::Registry::Set ( const std::string &  key,
const std::string &  value 
)

Sets the value for key in the registry.

Returns the value.


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