#include <rutz/assocarray.h>
Public Member Functions | |
typedef void() | kill_func_t (void *) |
Function type for destroying elements. | |
assoc_array_base (kill_func_t *f, const char *descr, bool nocase) | |
Default constructor. | |
~assoc_array_base () | |
Virtual destructor. | |
rutz::fstring | get_known_keys (const char *sep) const |
Get a list of known keys, separated by sep. | |
void | throw_for_key (const char *key, const rutz::file_pos &pos) const |
Raise an exception reporting an unknown key. | |
void | throw_for_key (const rutz::fstring &key, const rutz::file_pos &pos) const |
Raise an exception reporting an unknown key. | |
void * | get_value_for_key (const rutz::fstring &name) const |
Retrieve the object associated with the tag name. | |
void * | get_value_for_key (const char *name) const |
Retrieve the object associated with the tag name. | |
void | set_value_for_key (const char *name, void *ptr) |
Associate the object at ptr with the tag name. | |
void | clear () |
Clear all entries, calling the kill function for each. | |
Classes | |
struct | impl |
The use must provide a pointer to a function that knows how to properly destroy the actual contained objects according to their true type.
Definition at line 48 of file assocarray.h.
rutz::assoc_array_base::assoc_array_base | ( | kill_func_t * | f, | |
const char * | descr, | |||
bool | nocase | |||
) |
Default constructor.
descr | a human-readable description of what this array's keys represent; this is used in error messages, e.g. if descr is "frobnicator", then error messages would include "unknown frobnicator" | |
nocase | true if the array should use case-insensitive string comparisons (default is false, giving normal case-sensitive string comparisons) |
Definition at line 91 of file assocarray.cc.