In file name_map.h:

class name_map

Map names using a simple thesaurus.

Public Methods

name_map(char *raw_equiv)
Create a new instance of the thesaurus.
name_map()
Create an empty thesaurus
void add(char *raw_equiv)
Add a new entry to the thesaurus
string lookup(string name, const bool canonical_names = false)
Lookup a word in the thesaurus
void delete_all()
Delete all the entries from the thesaurus

Documentation

This class can be used to build up a simple thesaurus which maps names from one string to another. The thesaurus is built by calling the #add# mfunc with a string of the form #:# where ## and ## are string literals. Once the thesaurus is built, the #lookup# mfunc can be used to get the equivalent of any string in the thesaurus. As an additional feature, this class can canonicalize an identifier (remove non-alphanumeric characters) when performing the lookup operation. This is performed as a separate step from the thesaurus scan so words with no entry in the thesaurus will still be canonicalized. You can interleave calls to #add# and calls to #lookup#.
name_map(char *raw_equiv)
Create a new instance of the thesaurus and add the first equivalence string to it.

name_map()
Create an empty thesaurus

void add(char *raw_equiv)
Add a new entry to the thesaurus. The form of the new entry is :.

string lookup(string name, const bool canonical_names = false)
Lookup a word in the thesaurus. If the name appears in the thesaurus, return its equivalent. If #canonical_names# is true, pass the string #name# or its equivalent through a filter to replace all characters that are not alphanumerics with the underscore. Sequences matching `%[0-9][0-9a-fA-F]' are considered to be hex escape codes and are replaced by a single underscore.
Returns:
The string #name#, its equivalent or its canonicalized equivalent.

void delete_all()
Delete all the entries from the thesaurus


This class has no child classes.
Author:
jhrg

alphabetic index hierarchy of classes


generated by doc++