[Libreoffice] [PATCH] ure/sal/inc/rtl/ustring.hxx - new method isEmpty()

Thomas Arnhold thomas at arnhold.org
Thu Feb 3 13:41:55 PST 2011


Hi,

as I understand this, it would be nice to have this method in OString,
too. I've attached the patch.

Thomas

On 01/21/2011 05:55 PM, Michael Meeks wrote:
> Hi Thomas,
> 
> On Fri, 2011-01-21 at 13:52 +0100, Thomas Arnhold wrote:
>> New method: isEmpty() - Checks if a string is empty.
> 
> 	I like it.
> 
> 	There are lots of use-cases that we need to get into sal: that we sadly
> don't have at the moment: to make writing code easier and less
> error-prone.
> 
>> With isEmpty() this looks like:
>> if (aStr.isEmpty()) {...}
>> if (!aStr.isEmpty()) {...}
> 
> 	Prettier for sure.
> 
> 	There are some methods that are all 'pure' and all that (like those for
> tokenising rtl::OUStrings) that get used in fairly unreadable ways
> around the place. In a world of iterators, it is unclear to me why we
> need to be managing string offsets and odd loops using 'getToken()'
> 
> 	Really, we need to be making OUStrings and StringBuffers easier to use,
> so that we can use them everywhere - in place of the obsolete (mutable)
> tools/inc/tools/string.hxx (UniString) - (mostly called 'String' outside
> there).
> 
> 	I suppose, simply porting a good number of String instances would help
> us fall over the missing pieces there.
> 
> 	Anyhow - nice patch, pushed to master; I added a:
> 
> 	@since LibreOffice 3.4
> 
> 	tag to the method call, since this low level piece is intended to be a
> stable ABI that is managed in that way.
> 
> 	Thanks !
> 
> 		Michael.
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-OString-New-method-isEmpty.patch
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110203/0ed2ada4/attachment.asc>


More information about the LibreOffice mailing list