diff options
author | David Ostrovsky <david@ostrovsky.org> | 2013-02-04 11:40:14 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-02-04 14:35:26 +0100 |
commit | 751950edc84e0069e5bce1083160d46d9ba1bf33 (patch) | |
tree | 1526682400b50bd756d446ee9c0cfc237f03de43 /sal/inc/rtl | |
parent | 55576105d3c9b0a116d7707a6c46b67f7b20a0ce (diff) |
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
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/inc/rtl')
-rw-r--r-- | sal/inc/rtl/string.hxx | 20 | ||||
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 20 |
2 files changed, 36 insertions, 4 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 69592f93e12d..9ed01e5824cb 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -1490,9 +1490,25 @@ public: @param b a sal_Bool. @return a string with the string representation of the argument. - @deprecated there is no replacement, use 'condition ? OString( "true" ) : OString( "false" )' + @deprecated use boolean() */ - 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 boolean 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 8190d208ae68..7cdbb4e22d90 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -2141,9 +2141,25 @@ public: @param b a sal_Bool. @return a string with the string representation of the argument. - @deprecated there is no replacement, use 'condition ? OString( "true" ) : OString( "false" )' + @deprecated use boolean() */ - 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 boolean 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; |