diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-03-28 22:31:25 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-03-28 23:00:54 +0200 |
commit | bd577aa7f8252f3f95276cd17c93beae1902fd96 (patch) | |
tree | 48a6177d9e3977c00d6b444c47625eaf0230e7b9 /sal | |
parent | bf68985627a7e0520674a8eb0d0f037e71f432fe (diff) |
string literal overload for OUStringBuffer::insert()
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 13 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index ee17f77d3815..99afe44b782b 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -635,6 +635,19 @@ public: } /** + @overload + This function accepts an ASCII string literal as its argument. + @since LibreOffice 3.6 + */ + template< typename T > + typename internal::ConstCharArrayDetector< T, OUStringBuffer& >::Type insert( sal_Int32 offset, T& literal ) + { + rtl_uStringbuffer_insert_ascii( &pData, &nCapacity, offset, literal, + internal::ConstCharArrayDetector< T, void >::size - 1 ); + return *this; + } + + /** Inserts the string representation of the <code>sal_Bool</code> argument into this string buffer. diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 2783571736d3..ddac4d62e35f 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -178,6 +178,8 @@ void test::oustring::StringLiterals::checkBuffer() CPPUNIT_ASSERT_EQUAL( buf.toString(), rtl::OUString( "foo" )); buf.append( "bar" ); CPPUNIT_ASSERT_EQUAL( buf.toString(), rtl::OUString( "foobar" )); + buf.insert( 3, "baz" ); + CPPUNIT_ASSERT_EQUAL( buf.toString(), rtl::OUString( "foobazbar" )); } }} // namespace |