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


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1981

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/81/1981/1

Strings: boolean() as a replacement for valueOf(sal_Bool)

valueOf(?) has been superseded by number(?).
O(U)String::valueOf(sal_Bool) has been deprecated without providing an
alternative method. Use boolean() method as a replacement for it.

Change-Id: I7eb74574fa8f1a3cf007cb0cbc32e681007ffb92
---
M sal/inc/rtl/string.hxx
M sal/inc/rtl/ustring.hxx
M sal/qa/rtl_strings/rtl_OString.cxx
M sal/qa/rtl_strings/rtl_OUString.cxx
4 files changed, 42 insertions(+), 10 deletions(-)



diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 69592f9..79ce923 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -1492,7 +1492,23 @@
       @return   a string with the string representation of the argument.
       @deprecated there is no replacement, use 'condition ? OString( "true" ) : OString( "false" )'
     */
-    SAL_DEPRECATED_INTERNAL("write explicit code") static OString valueOf( sal_Bool b ) 
SAL_THROW(())
+    SAL_DEPRECATED_INTERNAL("use boolean()") static OString valueOf( sal_Bool b ) SAL_THROW(())
+    {
+        return boolean(b);
+    }
+
+    /**
+      Returns the string representation of the sal_Bool argument.
+
+      If the sal_Bool is true, the string "true" is returned.
+      If the sal_Bool is false, the string "false" is returned.
+      This function can't be used for language specific conversion.
+
+      @param    b   a sal_Bool.
+      @return   a string with the string representation of the argument.
+      @since LibreOffice 4.1
+    */
+    static OString boolean( sal_Bool b ) SAL_THROW(())
     {
         sal_Char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
         rtl_String* pNewData = 0;
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 192ba2b..eb87152 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -2129,7 +2129,23 @@
       @return   a string with the string representation of the argument.
       @deprecated there is no replacement, use 'condition ? OString( "true" ) : OString( "false" )'
     */
-    SAL_DEPRECATED_INTERNAL("write explicit condition") static OUString valueOf( sal_Bool b ) 
SAL_THROW(())
+    SAL_DEPRECATED_INTERNAL("use boolean()") static OUString valueOf( sal_Bool b ) SAL_THROW(())
+    {
+        return boolean(b);
+    }
+
+    /**
+      Returns the string representation of the sal_Bool argument.
+
+      If the sal_Bool is true, the string "true" is returned.
+      If the sal_Bool is false, the string "false" is returned.
+      This function can't be used for language specific conversion.
+
+      @param    b   a sal_Bool.
+      @return   a string with the string representation of the argument.
+      @since LibreOffice 4.1
+    */
+    static OUString boolean( sal_Bool b ) SAL_THROW(())
     {
         sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
         rtl_uString* pNewData = 0;
diff --git a/sal/qa/rtl_strings/rtl_OString.cxx b/sal/qa/rtl_strings/rtl_OString.cxx
index cea3cb1..1934f06 100644
--- a/sal/qa/rtl_strings/rtl_OString.cxx
+++ b/sal/qa/rtl_strings/rtl_OString.cxx
@@ -1785,9 +1785,9 @@
 
 
 //------------------------------------------------------------------------
-// testing the method valueOf( sal_Bool b )
+// testing the method boolean( sal_Bool b )
 //------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_sal_Bool(
+sal_Bool SAL_CALL test_rtl_OString_boolean(
                                                 hTestResult hRtlTestResult )
 {
     sal_Char methName[MAXBUFLENGTH];
@@ -1813,7 +1813,7 @@
     for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
     {
         ::rtl::OString aStr1;
-        aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
+        aStr1 = aStr1.boolean( arrTestCase[i].input1 );
         sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
 
         c_rtl_tres_state
@@ -2446,7 +2446,7 @@
                                                 hTestResult hRtlTestResult )
 {
     c_rtl_tres_state_start(hRtlTestResult, "valueOf");
-    sal_Bool bTState = test_rtl_OString_valueOf_sal_Bool( hRtlTestResult );
+    sal_Bool bTState = test_rtl_OString_boolean( hRtlTestResult );
 
     bTState &= test_rtl_OString_valueOf_sal_Char( hRtlTestResult );
 
diff --git a/sal/qa/rtl_strings/rtl_OUString.cxx b/sal/qa/rtl_strings/rtl_OUString.cxx
index 4982f29..3ba20e7 100644
--- a/sal/qa/rtl_strings/rtl_OUString.cxx
+++ b/sal/qa/rtl_strings/rtl_OUString.cxx
@@ -1262,9 +1262,9 @@
 
 
 //------------------------------------------------------------------------
-//       testing the method valueOf( sal_Bool b )
+//       testing the method boolean( sal_Bool b )
 //------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf_sal_Bool(
+extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_boolean(
     hTestResult hRtlTestResult )
 {
     c_rtl_tres_state_start( hRtlTestResult, "Bool");
@@ -1300,7 +1300,7 @@
     for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
     {
         sal_Bool lastRes=(*arrTestCase[i].expVal==
-                          OUString::valueOf(arrTestCase[i].input1)
+                          OUString::boolean(arrTestCase[i].input1)
 
                           );
 
@@ -3347,7 +3347,7 @@
     test_rtl_OUString_equalsAscii( hRtlTestResult );
     test_rtl_OUString_equalsAsciiL( hRtlTestResult );
     test_rtl_OUString_compareToAscii( hRtlTestResult );
-    test_rtl_OUString_valueOf_sal_Bool( hRtlTestResult );
+    test_rtl_OUString_boolean( hRtlTestResult );
     test_rtl_OUString_valueOf_sal_Unicode( hRtlTestResult );
     test_rtl_OUString_valueOf( hRtlTestResult );
     test_rtl_OUString_createFromAscii( hRtlTestResult );

-- 
To view, visit https://gerrit.libreoffice.org/1981
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eb74574fa8f1a3cf007cb0cbc32e681007ffb92
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: David Ostrovsky <David.Ostrovsky@gmx.de>

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.