diff options
Diffstat (limited to 'include/rtl/ustrbuf.hxx')
-rw-r--r-- | include/rtl/ustrbuf.hxx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index 07188a73921e..7a9448d02d5d 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -162,6 +162,13 @@ public: libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); } + + /** @overload @since LibreOffice 5.4 */ + OUStringBuffer(OUStringLiteral const & literal): + pData(nullptr), nCapacity(literal.size + 16) //TODO: check for overflow + { + rtl_uString_newFromLiteral(&pData, literal.data, literal.size, 16); + } #endif #ifdef RTL_STRING_UNITTEST @@ -282,6 +289,21 @@ public: pData->length = n; return *this; } + + /** @overload @since LibreOffice 5.4 */ + OUStringBuffer & operator =(OUStringLiteral const & literal) { + sal_Int32 const n = literal.size; + if (n >= nCapacity) { + ensureCapacity(n + 16); //TODO: check for overflow + } + char const * from = literal.data; + sal_Unicode * to = pData->buffer; + for (sal_Int32 i = 0; i <= n; ++i) { + to[i] = from[i]; + } + pData->length = n; + return *this; + } #endif #if defined LIBO_INTERNAL_ONLY @@ -590,6 +612,13 @@ public: libreoffice_internal::ConstCharArrayDetector<T>::length); return *this; } + + /** @overload @since LibreOffice 5.4 */ + OUStringBuffer & append(OUStringLiteral const & literal) { + rtl_uStringbuffer_insert_ascii( + &pData, &nCapacity, getLength(), literal.data, literal.size); + return *this; + } #endif #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" @@ -956,6 +985,13 @@ public: libreoffice_internal::ConstCharArrayDetector<T>::length); return *this; } + + /** @overload @since LibreOffice 5.4 */ + OUStringBuffer & insert(sal_Int32 offset, OUStringLiteral const & literal) { + rtl_uStringbuffer_insert_ascii( + &pData, &nCapacity, offset, literal.data, literal.size); + return *this; + } #endif /** @@ -1360,6 +1396,16 @@ public: libreoffice_internal::ConstCharArrayDetector<T>::length); return n < 0 ? n : n + fromIndex; } + + /** @overload @since LibreOffice 5.4 */ + sal_Int32 indexOf(OUStringLiteral const & literal, sal_Int32 fromIndex = 0) + const + { + sal_Int32 n = rtl_ustr_indexOfAscii_WithLength( + pData->buffer + fromIndex, pData->length - fromIndex, literal.data, + literal.size); + return n < 0 ? n : n + fromIndex; + } #endif /** @@ -1438,6 +1484,12 @@ public: libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); } + + /** @overload @since LibreOffice 5.4 */ + sal_Int32 lastIndexOf(OUStringLiteral const & literal) const { + return rtl_ustr_lastIndexOfAscii_WithLength( + pData->buffer, pData->length, literal.data, literal.size); + } #endif /** |