25 #ifndef TBX_PROPERTYSET_H_ 26 #define TBX_PROPERTYSET_H_ 49 bool exists(std::string name)
const;
57 void set(std::string name, std::string value);
65 void set(std::string name,
const char *value);
74 std::string
get(std::string name,
const char *def =
"")
const;
82 void set(std::string name,
int value);
91 int get(std::string name,
int def)
const;
99 void set(std::string name,
bool value);
107 bool get(std::string name,
bool def)
const;
115 bool erase(std::string name);
127 void set_indexed(std::string name,
int index, std::string value);
139 std::string
get_indexed(std::string name,
int index,
const char *def =
"")
const;
150 void set_indexed(std::string name,
int index,
int value);
162 int get_indexed(std::string name,
int index,
int def)
const;
173 void set_indexed(std::string name,
int index,
bool value);
185 bool get_indexed(std::string name,
int index,
bool def)
const;
210 bool write(std::ostream &os)
const;
223 bool read(std::istream &is);
240 bool save(std::string file_name)
const;
247 bool load(std::string file_name);
std::map< std::string, std::string > _properties
Underlying map to contain the properties.
Definition: propertyset.h:253
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
bool save(std::string file_name) const
Save property set to a file.
Definition: propertyset.cc:225
bool erase_indexed(std::string name, int index)
Erase an indexed property.
Definition: propertyset.cc:147
void set_indexed(std::string name, int index, std::string value)
Set an indexed string property.
Definition: propertyset.cc:86
bool exists_indexed(std::string name, int index)
Check if the property set contains the indexed property.
Definition: propertyset.cc:140
bool empty()
Check if property set is empty.
Definition: propertyset.cc:220
bool load(std::string file_name)
Load property set from a file.
Definition: propertyset.cc:232
Maintain a simple set of string properties with their values.
Definition: propertyset.h:40
bool read(std::istream &is)
Reads the properties from a stream.
Definition: propertyset.cc:174
bool exists(std::string name) const
Check if property is a member of this property set.
Definition: propertyset.cc:32
void clear()
Remove all properties from the property set.
Definition: propertyset.cc:215
bool erase(std::string name)
Erases a property from the set.
Definition: propertyset.cc:128
std::string get_indexed(std::string name, int index, const char *def="") const
Get the value of an indexed string property.
Definition: propertyset.cc:93
bool write(std::ostream &os) const
Writes the property list to a stream.
Definition: propertyset.cc:155