[LMSAPI] Removed unused LMS API

This commit is contained in:
epoupon
2015-09-24 13:12:09 +02:00
parent 65006d5730
commit 40c6e80c2c
29 changed files with 7 additions and 3528 deletions
-98
View File
@@ -1,98 +0,0 @@
/*
* Copyright (C) 2013 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sstream>
#include "ConfigReader.hpp"
namespace {
}
ConfigReader::ConfigReader()
: _config (nullptr)
{
}
ConfigReader&
ConfigReader::instance()
{
static ConfigReader instance;
return instance;
}
void
ConfigReader::setFile(boost::filesystem::path p)
{
if (_config != nullptr)
delete _config;
_config = new libconfig::Config();
_config->readFile(p.string().c_str());
}
std::string
ConfigReader::getString(std::string setting, std::string def)
{
try {
return _config->lookup(setting);
}
catch (std::exception &e)
{
return def;
}
}
unsigned long
ConfigReader::getULong(std::string setting, unsigned long def)
{
try {
return static_cast<unsigned int>(_config->lookup(setting));
}
catch (...)
{
return def;
}
}
long
ConfigReader::getLong(std::string setting, long def)
{
try {
return _config->lookup(setting);
}
catch (...)
{
return def;
}
}
bool
ConfigReader::getBool(std::string setting, bool def)
{
try {
return _config->lookup(setting);
}
catch (...)
{
return def;
}
}
-50
View File
@@ -1,50 +0,0 @@
/*
* Copyright (C) 2013 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_READER_HPP
#define CONFIG_READER_HPP
#include <boost/filesystem.hpp>
#include <libconfig.h++>
class ConfigReader
{
public:
ConfigReader(const ConfigReader&) = delete;
ConfigReader& operator=(const ConfigReader&) = delete;
static ConfigReader& instance();
void setFile(boost::filesystem::path p);
/* Default values are returned in case of setting not found */
std::string getString(std::string setting, std::string def = "");
unsigned long getULong(std::string setting, unsigned long def = 0);
long getLong(std::string setting, long def = 0);
bool getBool(std::string setting, bool def = false);
private:
ConfigReader();
libconfig::Config *_config;
};
#endif