#ifndef _CONFIG_FILE_
#define _CONFIG_FILE_


#include <string>
#include <map>

#include <boost/lexical_cast.hpp>

#include "Exception.hpp"

///Provides an easy way to get Values from an config File
/**
Note: All Whitespaces are ignored!
*/
class ConfigFile
{
public:
	///Opens the file and reads all values
	ConfigFile(std::string ConfigFileName);

	/// returns the Value, casted to t
	template<typename t> t GetValue(std::string Name);
private:
	std::map<std::string, std::string> m_Values;
};

template<typename t> t ConfigFile::GetValue(std::string Name)
{
	if(m_Values.find(Name)==m_Values.end())
		THROW(Exception() << ex_message("Value not found") << ex_detail(Name));

	return lexical_cast<t>(m_Values[Name]);
}

#endif