rutz::assoc_array is a typesafe wrapper of rutz::assoc_array_base. More...
#include <rutz/assocarray.h>
Public Member Functions | |
assoc_array (const char *descr, bool nocase=false) | |
Default constructor. | |
rutz::fstring | get_known_keys (const char *sep) const |
Get a string listing of known keys, separated by the string 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. | |
value_t * | get_ptr_for_key (const rutz::fstring &key) const |
Get the object associated with the given key. | |
value_t * | get_ptr_for_key (const char *key) const |
Get the object associated with the given key. | |
void | set_ptr_for_key (const char *key, value_t *ptr) |
Associate the object at ptr with the given key. |
rutz::assoc_array is a typesafe wrapper of rutz::assoc_array_base.
Definition at line 104 of file assocarray.h.
rutz::assoc_array< value_t >::assoc_array | ( | const char * | descr, | |
bool | nocase = false | |||
) | [inline] |
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 117 of file assocarray.h.
rutz::fstring rutz::assoc_array< value_t >::get_known_keys | ( | const char * | sep | ) | const [inline] |
Get a string listing of known keys, separated by the string sep.
Definition at line 121 of file assocarray.h.
Referenced by rutz::factory< nub::ref< P > >::get_known_keys().
value_t* rutz::assoc_array< value_t >::get_ptr_for_key | ( | const char * | key | ) | const [inline] |
Get the object associated with the given key.
Definition at line 139 of file assocarray.h.
value_t* rutz::assoc_array< value_t >::get_ptr_for_key | ( | const rutz::fstring & | key | ) | const [inline] |
Get the object associated with the given key.
Definition at line 135 of file assocarray.h.
Referenced by rutz::factory< nub::ref< P > >::find_creator(), and rutz::factory< nub::ref< P > >::register_alias().
void rutz::assoc_array< value_t >::set_ptr_for_key | ( | const char * | key, | |
value_t * | ptr | |||
) | [inline] |
Associate the object at ptr with the given key.
Definition at line 143 of file assocarray.h.
Referenced by rutz::factory< nub::ref< P > >::register_alias(), and rutz::factory< nub::ref< P > >::register_creator().
void rutz::assoc_array< value_t >::throw_for_key | ( | const rutz::fstring & | key, | |
const rutz::file_pos & | pos | |||
) | const [inline] |
Raise an exception reporting an unknown key.
Definition at line 130 of file assocarray.h.
void rutz::assoc_array< value_t >::throw_for_key | ( | const char * | key, | |
const rutz::file_pos & | pos | |||
) | const [inline] |
Raise an exception reporting an unknown key.
Definition at line 125 of file assocarray.h.
Referenced by rutz::factory< nub::ref< P > >::new_checked_object().