60 #ifdef _MSC_VER // Microsoft
61 #pragma warning (disable:4786) // Disable decorated name truncation warnings
62 #pragma warning (disable:4503) // Disable decorated name truncation warnings
69 #include <boost/lexical_cast.hpp>
76 #define CAN_NOT_OPEN_FILE -1
79 #define CAN_NOT_CREATE_FILE -2
85 std::string parameter;
97 short read_conf(std::ifstream & inconffile);
102 bool parameter_exists(
const std::string & section,
const std::string & parameter)
const;
105 template<
typename T>
bool select(
const std::string & section,
const std::string & parameter,
112 for(Conf_data::const_iterator iter =
conf.begin(); iter !=
conf.end(); ++iter)
114 if( (iter->section == section) && (iter->parameter == parameter) )
118 value = boost::lexical_cast<T>(iter->value);
120 catch (boost::bad_lexical_cast & e)
130 short write_conf(std::ofstream & outconffile,
const std::string & file_title,
131 const int space_between_column);
133 template <
typename T>
bool add(
const std::string & section,
const std::string & parameter,
142 dataSet.section = section;
143 dataSet.parameter = parameter;
146 dataSet.value = boost::lexical_cast<std::string>(value);
148 catch (boost::bad_lexical_cast & e)
153 for(Conf_data::iterator iterConf =
conf.begin(); iterConf !=
conf.end(); ++iterConf)
155 if(section == iterConf->section)
157 if(parameter == iterConf->parameter)
161 iterConf->value = boost::lexical_cast<std::string>(value);
163 catch (boost::bad_lexical_cast & e)
169 for(Conf_data::iterator iterConf2 = iterConf; iterConf2 !=
conf.end(); ++iterConf2)
171 if(section != iterConf2->section)
173 conf.insert(iterConf2, dataSet);
180 conf.push_back(dataSet);