[Libreoffice-commits] .: sal/inc

August Sodora augsod at kemper.freedesktop.org
Thu Dec 1 14:54:18 PST 2011


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

New commits:
commit 56aec836a0505ca5c54d0b29b8c96b130ebe287b
Author: August Sodora <augsod at gmail.com>
Date:   Thu Dec 1 17:53:15 2011 -0500

    Add back setCharAt/charAt for now

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