00001 #ifndef GPROPERTIES_H 00002 #define GPROPERTIES_H 00003 00004 #include <cstdlib> 00005 #include <string> 00006 #include <iostream> 00007 #include <map> 00008 #include "gmathcore/GObject.h" 00009 00010 namespace GMathLib{ 00011 namespace Util{ 00012 00018 class GProperties : public GObject 00019 { 00020 public: 00021 typedef std::map<std::string, std::string> PropertyMap; 00022 00026 GProperties(); 00027 00031 ~GProperties(){} 00032 00040 void Load(const std::string filename); 00041 00042 00050 std::string GetProperty(const std::string key); 00051 00059 double GetProperty_d(const std::string key) 00060 { 00061 std::string val = GetProperty(key); 00062 return std::atof(val.c_str()); 00063 //std::cout << "error" << std::endl; 00064 //return 0; 00065 } 00066 00071 PropertyMap Get_List() const{ return m_map;} 00072 00076 void Print_All_Properties(); 00077 00078 private: 00079 PropertyMap m_map; 00080 bool load_flag; 00081 }; 00082 00083 } 00084 } 00085 00086 #endif