[Libreoffice-commits] .: 2 commits - sal/inc

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Dec 2 02:09:01 PST 2011


 sal/inc/rtl/strbuf.hxx  |   38 ++++++++++++++++++++++++++++++++++++++
 sal/inc/rtl/ustrbuf.hxx |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)

New commits:
commit 0b14a86f8a1c77683db2e81cb4604c077b572cf7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 2 11:07:51 2011 +0100

    Mark rtl::O[U]StringBuffer::{charAt,setCharAt} as SAL_DEPRECATED.

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 3ea6bc0..2f92b0f 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -281,6 +281,7 @@ public:
         @param      index   the index of the desired character.
         @return     the character at the specified index of this string buffer.
     */
+    SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
     sal_Char charAt( sal_Int32 index )
     {
         assert(index >= 0 && index < pData->length);
@@ -297,6 +298,7 @@ public:
         @param      index   the index of the character to modify.
         @param      ch      the new character.
      */
+    SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
     OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
     {
         assert(index >= 0 && index < pData->length);
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index b4d4871..d9c3893 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -260,6 +260,7 @@ public:
         @param      index   the index of the desired character.
         @return     the character at the specified index of this string buffer.
      */
+    SAL_DEPRECATED("use rtl::OUStringBuffer::operator [] instead")
     sal_Unicode charAt( sal_Int32 index ) const
     {
         assert(index >= 0 && index < pData->length);
@@ -276,6 +277,7 @@ public:
         @param      index   the index of the character to modify.
         @param      ch      the new character.
      */
+    SAL_DEPRECATED("use rtl::OUStringBuffer::operator [] instead")
     OUStringBuffer & setCharAt(sal_Int32 index, sal_Unicode ch)
     {
         assert(index >= 0 && index < pData->length);
commit 05fddab006719d9d023787d7e6ee9b979907c048
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 2 08:43:50 2011 +0100

    Revert "Remove charAt/setCharAt once and for all"
    
    For backwards compatibility, they should not be removed before LO 4.
    They should be marked as SAL_DEPRECATED, however.
    This reverts commit 1820e7f575dffe53062f50f08cebf0efa37e2cc2.

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index e3ae74b..3ea6bc0 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -269,6 +269,42 @@ public:
     }
 
     /**
+        Returns the character at a specific index in this string buffer.
+
+        The first character of a string buffer is at index
+        <code>0</code>, the next at index <code>1</code>, and so on, for
+        array indexing.
+        <p>
+        The index argument must be greater than or equal to
+        <code>0</code>, and less than the length of this string buffer.
+
+        @param      index   the index of the desired character.
+        @return     the character at the specified index of this string buffer.
+    */
+    sal_Char charAt( sal_Int32 index )
+    {
+        assert(index >= 0 && index < pData->length);
+        return pData->buffer[ index ];
+    }
+
+    /**
+        The character at the specified index of this string buffer is set
+        to <code>ch</code>.
+
+        The index argument must be greater than or equal to
+        <code>0</code>, and less than the length of this string buffer.
+
+        @param      index   the index of the character to modify.
+        @param      ch      the new character.
+     */
+    OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
+    {
+        assert(index >= 0 && index < pData->length);
+        pData->buffer[ index ] = ch;
+        return *this;
+    }
+
+    /**
         Return a null terminated character array.
      */
     const sal_Char* getStr() const { return pData->buffer; }
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 624b6f0..b4d4871 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -248,6 +248,42 @@ public:
     }
 
     /**
+        Returns the character at a specific index in this string buffer.
+
+        The first character of a string buffer is at index
+        <code>0</code>, the next at index <code>1</code>, and so on, for
+        array indexing.
+        <p>
+        The index argument must be greater than or equal to
+        <code>0</code>, and less than the length of this string buffer.
+
+        @param      index   the index of the desired character.
+        @return     the character at the specified index of this string buffer.
+     */
+    sal_Unicode charAt( sal_Int32 index ) const
+    {
+        assert(index >= 0 && index < pData->length);
+        return pData->buffer[ index ];
+    }
+
+    /**
+        The character at the specified index of this string buffer is set
+        to <code>ch</code>.
+
+        The index argument must be greater than or equal to
+        <code>0</code>, and less than the length of this string buffer.
+
+        @param      index   the index of the character to modify.
+        @param      ch      the new character.
+     */
+    OUStringBuffer & setCharAt(sal_Int32 index, sal_Unicode ch)
+    {
+        assert(index >= 0 && index < pData->length);
+        pData->buffer[ index ] = ch;
+        return *this;
+    }
+
+    /**
         Return a null terminated unicode character array.
      */
     const sal_Unicode*  getStr() const { return pData->buffer; }


More information about the Libreoffice-commits mailing list