Andre Poenitz wrote:
On Wed, Aug 01, 2007 at 12:19:33AM -0400, Richard Heck wrote:
Yes, I agree. This is needed, IIRC (I did this a while ago), for certain constants, e.g.: static const docstring TheBibliographyRef(from_ascii("TheBibliographyRef")); which was in frontends/controllers/frontend_helpers.cpp and which I've moved (in effect) to the header.
So why not move it in the core if it is used there?
I tend to be cautious about that sort of thing, as I'm still new to this. But if you think that is best, I'll do it. Which you do, so I will.
-docstring const parseBibTeX(docstring data, std::string const & findkey);
+docstring const getValueForKey(KeyValMap data, std::string const & findkey);
Passing a  std::map<docstring, docstring>  by value seems wrong.
Yes. Made it const &. This required a const_cast, but that seems ok.
Not really.
It's necessary because I want to use operator[] on the map later, and that has no const version. That seems better than making it just &, without the const.
+       KeyValMap & data2 = const_cast<KeyValMap &>(data);
+       return data2[key];
        return data.find(key)->second;

Maybe even with ASSERETing on != data.end().
No, we don't want to do that. If the year field isn't given in a particular entry, say, then there won't be a year key in the map. But that's OK, and getValueForKey(data, "year") can just return docstring(). That's pretty much how BibTeX does it, too.

Richard

--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Reply via email to