00001 #ifndef _CONFIGSECTION_H
00002 #define _CONFIGSECTION_H
00003
00004 #include <map>
00005 #include <string>
00006 #include <fstream>
00007 #include "ConfigItem.h"
00008 #include "Vector.h"
00009 #include "Matrix.h"
00010
00013 class ConfigSection
00014 {
00015 public:
00017 ~ConfigSection();
00018
00023 void unsetItem(std::string name);
00024
00029 ConfigItem &getItem(std::string name);
00030
00035 template<typename T>
00036 T get(std::string name) { return getItem(name).get<T>(); }
00037
00043 Vector3d getVector3d(std::string name);
00044
00050 Matrix<double> getMatrixDouble(std::string name);
00051
00056 void save(std::ofstream &file);
00061 void load(std::string &content);
00062
00068 template<typename T>
00069 void setItem(std::string name, T value)
00070 {
00071 setItem(name, convertTo<T, std::string>(value));
00072 }
00073
00079 void setVector3d(std::string name, Vector3d &value);
00080
00086 void setMatrixDouble(std::string name, Matrix<double> &matrix);
00087
00093 void setItem(std::string name, std::string value);
00094
00095 private:
00096 typedef std::map<std::string, ConfigItem> ItemMap;
00097 ItemMap m_items;
00098 };
00099
00100 #endif