[gtkmm] Announce: v. 1.0.3 of string composition library



Friends,

Barnaby Gray pointed out that there was a bug in the handling of
string conversions in ucompose.hpp and was even kind enough to suggest
a solution. Thanks a lot!

So I've reworked the internals of ucompose.hpp somewhat. The result is
that it is now faster and less error-prone (std::string, Glib::ustring
and char * are never converted from and to UTF-8 now), and actually
correct (or so I certainly hope). Also, I've fixed the name clashes
with compose.hpp so that it is possible to use both headers at the
same time.

So if you have been using ucompose.hpp, I urge you to upgrade now.
Hopefully, this will be the last version. It is too bad that the
standard library does not have a better way of handling formatting
than the monstrous iostreams.

The library can be downloaded from here:

  http://www.cs.auc.dk/~olau/compose/


For the uninitiated, it is small library (i.e. one header) which
defines a bunch of overloaded functions for allowing this syntax:

  compose("The species '%1' has %2 lives.", animal, lives)

    -> "The species 'cat' has 9 lives."

It exist because the native C++ construct

  std::string lives_str = ...;  // convert

  "The species '" + animal + "' has " + lives_str + " lives."

is tedious, error-prone, difficult to read and impossible to i18nize
(which means your translators will hate you).

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]