[Libreoffice-commits] core.git: sal/inc

Chr. Rossmanith ChrRossmanith at gmx.de
Thu Mar 7 00:50:04 PST 2013


 sal/inc/rtl/ustrbuf.hxx |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

New commits:
commit 98645ae6d4bc7b85730a0a9f00bd2de86dd09be9
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Wed Mar 6 22:19:30 2013 +0100

    add copy() to OUStringBuffer
    
    Change-Id: Ibac7f624f1a1dcce653dff4bec573be457d70075
    Reviewed-on: https://gerrit.libreoffice.org/2125
    Reviewed-by: Muthu Subramanian K <muthusuba at gmail.com>
    Tested-by: Muthu Subramanian K <muthusuba at gmail.com>

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index a7d5748..8a50946 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -1309,6 +1309,40 @@ public:
     {
         return stripStart(c) + stripEnd(c);
     }
+    /**
+      Returns a new string buffer that is a substring of this string.
+
+      The substring begins at the specified beginIndex. If
+      beginIndex is negative or be greater than the length of
+      this string, behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @return    the specified substring.
+      @since LibreOffice 4.1
+    */
+    OUStringBuffer copy( sal_Int32 beginIndex ) const SAL_THROW(())
+    {
+        return copy( beginIndex, getLength() - beginIndex );
+    }
+    /**
+      Returns a new string buffer that is a substring of this string.
+
+      The substring begins at the specified beginIndex and contains count
+      characters.  If either beginIndex or count are negative,
+      or beginIndex + count are greater than the length of this string
+      then behaviour is undefined.
+
+      @param     beginIndex   the beginning index, inclusive.
+      @param     count        the number of characters.
+      @return    the specified substring.
+      @since LibreOffice 4.1
+    */
+    OUStringBuffer copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
+    {
+        rtl_uString *pNew = 0;
+        rtl_uStringbuffer_newFromStr_WithLength( &pNew, getStr() + beginIndex, count );
+        return OUStringBuffer( pNew, count + 16 );
+    }
 
 #ifdef LIBO_INTERNAL_ONLY
     // This is to complement the RTL_FAST_STRING operator+, which allows any combination of valid operands,
@@ -1326,6 +1360,12 @@ public:
 #endif
 
 private:
+    OUStringBuffer( rtl_uString * value, const sal_Int32 capacity )
+    {
+        pData = value;
+        nCapacity = capacity;
+    }
+
     /**
         A pointer to the data structur which contains the data.
      */


More information about the Libreoffice-commits mailing list