/* Blinker
Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#include <fstream>
#include <string>
#include "File.h"
#include "SettingFile.h"
namespace Blinker {
/**
* @brief constructor from path
* @param[in] path path to file
*/
SettingFile::SettingFile(const std::string &path):
File(path)
{
}
/**
* @brief constructor from basic file
* @param[in] file basic file object
*/
SettingFile::SettingFile(const File &file):
File(file)
{
}
/**
* @brief assignment operator
* @param[in] file basic file object
*/
const SettingFile & SettingFile::operator=(const File &file)
{
File::operator=(file);
return *this;
}
/**
* @brief get setting as string
* @param[out] val setting read from file
* @param[in] def default setting (to return on error)
* @return if setting was successfully read from file
*/
bool SettingFile::getStr(std::string &val,
const std::string &def /*= ""*/) const
{
std::ifstream ifstrm(m_path.c_str(), std::ios::in);