From 0e6a2601b39cbadaff7f7506ba9e804f108060db Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 23 Oct 2013 13:29:32 +0200 Subject: Convert code that calls OUString::getStr()[] to use the [] operator This also means that this code now gets bounds checked in debug builds. Change-Id: Id777f85eaee6a737bbcb84625e6e110abe0e0f27 --- include/rtl/ustrbuf.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/rtl') diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index f7d640c0e415..baf6daf014b8 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -383,6 +383,21 @@ public: return pData->buffer[index]; } + /** + Access to individual characters. + + @param index must be non-negative and less than length. + + @return a reference to the character at the given index. + + @since LibreOffice 4.2 + */ + const sal_Unicode & operator [](sal_Int32 index) const + { + assert(index >= 0 && index < pData->length); + return pData->buffer[index]; + } + /** Return a OUString instance reflecting the current content of this OUStringBuffer. -- cgit