UT_Pair


Subject: UT_Pair
From: Mike Nordell (tamlin@algonet.se)
Date: Fri Nov 10 2000 - 09:10:33 CST


This might be nit-picking to some.

The name "pair" (obviously?) suggested to me it's a template-less "pair"
(from ISO C++).

Looking at this class, I realize it's nothing like that. It's more of a
  map<string,string>
with the exception that it can also map "backwards" (i.e. from "second"
(value) to "first" (key)).

Since (currently) not too much depend upon this classname, may I humbly
suggest the following changes (in no particular order)?
- it gets renamed to something like UT_stringmap
- it uses it's own type UT_Pair::pair_data instead of the two char** members
- its pair_data gets renamed to something like string_pair
- the two getXxx members gets renamed to something like lookupFirst,
lookupSecond and perhaps returntype should be changed to the nested
pair_data (I'm not sure though).
- its member "add" taking a "const pair_data*" gets changed to take a "const
pair_data[]" *and* a size_t telling how many entries it should add.
- its member "add" taking two const char* asserts that the arguments are not
NULL.

As I wrote, it might be nit-picking, and I sure didn't intend to tick anyone
off by this, but the whole is the product of the details. :-)

/Mike



This archive was generated by hypermail 2b25 : Fri Nov 10 2000 - 09:09:11 CST