Using a real parser generator to parse numbers (and dates)

Lionel Elie Mamane lionel at mamane.lu
Wed Feb 29 09:41:01 PST 2012


On Wed, Feb 29, 2012 at 02:57:09PM +0100, Stephan Bergmann wrote:
> On 02/29/2012 11:49 AM, Lionel Elie Mamane wrote:

>>2) I add a const_iterator interface to rtl::OUString. Instead of
>>    coding it manually to use iterateCodePoints, I again reuse the
>>    power of boost.

>>    That's also more generally a more "C++ natural" interface to
>>    OUStrings, so we can use it throughout our codebase instead of
>>    iterateCodePoints.

>>    I don't define an iterator interface, as this could be *extremely*
>>    slow: writing one character in the middle of a string is O(n)
>>    (linear in the length of the string) when replacing a
>>    surrogates-encoded codepoint by a non-surrogate encoded one and
> >    vice-versa.
> [...]

>>5) I've stuck the LibreOffice<->Spirit integration in
>>    svl/source/numbers/spirit/, but possibly we could move it to a more
>>    general location (sal/rtl?) so that it can be reused in other parts
>>    of LibreOffice.

> Note that the stable sal interface historically stays clear of
> boost, because of differences in the various boost versions
> available in the various environments.

OK, two prongs:


1) Use of boost in rtl/ustring.hxx

   But this is completely header-only code, so no ABI probl...^W Ah
   no, you are right; if the size or memory layout of a
   boost::u16_to_u32_iterator changes, there will be problems when
   passing a const_iterator between old binaries and new binaries.

   So here's the patch for a boost-free OUString, with manually
   implemented const_iterator.


2) So, OK if we don't put the LibO<->spirit integration in sal/,
   what's the right place? In tools? I didn't envision it becoming
   part of our "external" ABI, only for internal use in LibO's source
   code.


-- 
Lionel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use_spirit_rtl_noboost.patch
Type: text/x-diff
Size: 4372 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120229/9d3e6451/attachment-0001.patch>


More information about the LibreOffice mailing list