[Libreoffice-commits] .: 2 commits - sal/inc
Michael Meeks
mmeeks at kemper.freedesktop.org
Mon Jan 24 01:23:11 PST 2011
sal/inc/rtl/ustring.hxx | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
New commits:
commit a3ac06a43895aa44c03ce5f6900410986d415492
Author: Michael Meeks <michael.meeks at novell.com>
Date: Mon Jan 24 09:23:09 2011 +0000
add since version to new API
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 5fdbcc6..b4b8f4c 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -282,6 +282,8 @@ public:
@return sal_True if the string is empty;
sal_False, otherwise.
+
+ @since LibreOffice 3.4
*/
sal_Bool isEmpty() const SAL_THROW(())
{
commit 03177ac695d95fc41dc9e1f02dbf4fbc2af5e5a2
Author: Thomas Arnhold <thomas at arnhold.org>
Date: Fri Jan 21 13:43:52 2011 +0100
New method: isEmpty() - Checks if a string is empty.
This could simplify logics in the source. Now this test is done
like 'if (aStr.getLength() != 0) {...}' or 'if (!aStr.getLength()) {...}'.
With isEmpty() this looks like:
if (aStr.isEmpty()) {...}
if (!aStr.isEmpty()) {...}
I think this would make the code more readable.
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index a481be7..5fdbcc6 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -278,6 +278,20 @@ public:
sal_Int32 getLength() const SAL_THROW(()) { return pData->length; }
/**
+ Checks if a string is empty.
+
+ @return sal_True if the string is empty;
+ sal_False, otherwise.
+ */
+ sal_Bool isEmpty() const SAL_THROW(())
+ {
+ if ( pData->length )
+ return sal_False;
+ else
+ return sal_True;
+ }
+
+ /**
Returns a pointer to the Unicode character buffer from this string.
It isn't necessarily NULL terminated.
More information about the Libreoffice-commits
mailing list