rutz::assoc_array_base Class Reference

A non-typesafe wrapper around std::map<string, void*>. More...

#include <rutz/assocarray.h>

Collaboration diagram for rutz::assoc_array_base:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

A non-typesafe wrapper around std::map<string, void*>.

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.


Constructor & Destructor Documentation

rutz::assoc_array_base::assoc_array_base ( kill_func_t *  f,
const char *  descr,
bool  nocase 
)

Default constructor.

Parameters:
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.


The documentation for this class was generated from the following files:

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:31 2008 by Doxygen version 1.5.5.