00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef Properties_h
00039 #define Properties_h
00040
00041
00042 #include <string>
00043 #include <map>
00044 #include <vector>
00045
00046
00047 namespace RTC
00048 {
00108 class Properties
00109 : public std::map<std::string, std::string>
00110 {
00111 public:
00127 Properties(){};
00128
00129
00145 Properties(const std::map<std::string, std::string>& defaults);
00146
00147
00193 Properties(const char* defaults[], long num = LONG_MAX);
00194
00195
00207 virtual ~Properties();
00208
00209
00237 std::string getProperty(const std::string& key) const;
00238
00268 std::string getProperty(const std::string& key,
00269 const std::string& defaultValue) const;
00270
00292 void list(std::ostream& out);
00293
00294
00453 void load(std::istream& inStream);
00454
00455
00481 std::vector<std::string> propertyNames();
00482
00483
00507 void save(std::ostream& out, const std::string& header);
00508
00509
00536 std::string setProperty(const std::string& key, const std::string& value);
00537
00538
00619 void store(std::ostream& out, const std::string& header);
00620
00621 protected:
00622 void splitKeyValue(const std::string& str, std::string& key,
00623 std::string& value);
00624
00625 std::map<std::string, std::string> m_defaults;
00626 typedef std::map<std::string, std::string>::iterator Itr;
00627
00628 };
00629 };
00630 #endif // Properties_h
00631