diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2013-03-06 22:19:30 +0100 |
---|---|---|
committer | Muthu Subramanian K <muthusuba@gmail.com> | 2013-03-07 08:49:44 +0000 |
commit | 98645ae6d4bc7b85730a0a9f00bd2de86dd09be9 (patch) | |
tree | 511a6b1382efde977a6e1524c2e35c47262dd47c /sal | |
parent | Start hacking on scrolling (diff) | |
download | core-98645ae6d4bc7b85730a0a9f00bd2de86dd09be9.tar.gz core-98645ae6d4bc7b85730a0a9f00bd2de86dd09be9.zip |
add copy() to OUStringBuffer
Change-Id: Ibac7f624f1a1dcce653dff4bec573be457d70075
Reviewed-on: https://gerrit.libreoffice.org/2125
Reviewed-by: Muthu Subramanian K <muthusuba@gmail.com>
Tested-by: Muthu Subramanian K <muthusuba@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index a7d57481fd1f..8a509466371c 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. */ |