From 56aec836a0505ca5c54d0b29b8c96b130ebe287b Mon Sep 17 00:00:00 2001 From: August Sodora Date: Thu, 1 Dec 2011 17:53:15 -0500 Subject: Add back setCharAt/charAt for now --- sal/inc/rtl/strbuf.hxx | 36 ++++++++++++++++++++++++++++++++++++ sal/inc/rtl/ustrbuf.hxx | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) (limited to 'sal') diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index e3ae74bc3b5f..3ea6bc0db216 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -268,6 +268,42 @@ public: } } + /** + Returns the character at a specific index in this string buffer. + + The first character of a string buffer is at index + 0, the next at index 1, and so on, for + array indexing. +

+ The index argument must be greater than or equal to + 0, 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 ch. + + The index argument must be greater than or equal to + 0, 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. */ diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index 624b6f046258..b4d4871e6d2f 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -247,6 +247,42 @@ public: } } + /** + Returns the character at a specific index in this string buffer. + + The first character of a string buffer is at index + 0, the next at index 1, and so on, for + array indexing. +

+ The index argument must be greater than or equal to + 0, 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 ch. + + The index argument must be greater than or equal to + 0, 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. */ -- cgit