Re: UT_Pair


Subject: Re: UT_Pair
From: Vlad Harchev (hvv@hippo.ru)
Date: Fri Nov 10 2000 - 09:14:31 CST


On Fri, 10 Nov 2000, Mike Nordell wrote:

> 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
>

 Do you see any use of it in AW? I think UT_Hash (or what's there) is enough.
 The UT_Pair is used not very intensively, and only by the CJK-support patch
specific code.

 But if you will rewrite UT_Pair as you wish provided that all other places
where it's used are also updated and overall logic is preserved and no new
bugs are introduced - I won't mind. But I don't see any use of all this. I
don't think UT_Pair will be used in other places.

 There are several hundreds of bugs in bugzilla - why don't check them
instead?

 Best regards,
  -Vlad



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