Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On 10/29/2011 10:18 PM, Chr. Rossmanith wrote:
the deprecated string classes have a Fill(n,c) method which fills a
string with a single character c repeated n times. I found ~50
occurrences of Fill() using "git grep", so it might be worth to add a
Fill() method to OUString. Maybe the name of the new method could be a
bit more verbose e.g. fillWithChar().

Probably I would have to add something similar to "OUString
fillWithChar(sal_uInt32 nNumber,|sal_Unicode cChar=' '|)" to ustring.hxx
and something like rtl_ustr_fillWithChar() to ustring.c|

This functionality IMO only makes sense as a constructor (esp. for immutable OUString), like

  rtl::OUString::OUString(sal_Unicode value, sal_Int32 count);

and probably some underlying C function like

  void rtl_uString_newFromValueAndCount(
    rtl_uString **, sal_Unicode value, sal_Int32 count);

However, I would also be sceptical that there are that many places that actually need to construct such an (immutable!) string---maybe at least some of the places are misguided attempts at preallocating some buffer of a given length? Those should then be rewritten to use rtl::OUStringBuffer instead.

Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.