C++ Portable Types Library (PTypes) Version 1.7

Top: Basic types: Lists: strmap: Manipulation

#include <ptypes.h>

void  clear(strmap& s);
void  put(strmap& s, const string& str, unknown* obj);
void  del(strmap& s, const string& str);

clear(strmap& s) clears all items of the string map s. This function may also destroy all objects if the flag SL_OWNOBJECTS was specified during construction of the string map.

put(strmap& s, const string& str, unknown* obj) adds the given string str to the list and associates the string with the object obj. If an item associated with the same string already exists in the map, the previous object is removed from the map, and the new one is placed instead. Additionally, the previous object may be destroyed if the string map object was created with the flag SL_OWNOBJECTS. If the parameter obj is NULL, the item is removed from the map.

del(strlist& s, const string& str) removes the item associated with the string str from the map. Calling put(s, str, NULL) has the same effect.

See also: Constructors/destructors, Search

PTypes home