summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-27 14:52:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-03 09:26:35 +0200
commit8cfa7f4dc00f3dd37e57917ef25c806b0e9e6e73 (patch)
tree35408cf40d7bf3f93ff7405695f48796abc6089b /include/rtl
parent93f1c3665fcdc31c36078f179ac37fd69d3ebb00 (diff)
add more append methods to *StringBuffer
which performs the append without needing the creation of a temporary *String Change-Id: If9ad3222275f26659db2e7df8d34f068977c4d17 Reviewed-on: https://gerrit.libreoffice.org/69826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/strbuf.hxx20
-rw-r--r--include/rtl/ustrbuf.hxx20
2 files changed, 40 insertions, 0 deletions
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index c674f34d997c..81100919353b 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -482,6 +482,26 @@ public:
}
/**
+ Appends a portion of the string to this string buffer.
+
+ The characters of the <code>OUString</code> argument are appended, in
+ order, to the contents of this string buffer, increasing the
+ length of this string buffer by the length of the argument.
+
+ @param str a string.
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return this string buffer.
+ @since Libreoffice 6.4
+ */
+ OStringBuffer & append(const OString &str, sal_Int32 beginIndex, sal_Int32 count)
+ {
+ assert( count == 0 || (beginIndex >= 0 && beginIndex < str.getLength()) );
+ assert( beginIndex <= str.getLength() - count );
+ return append( str.getStr() + beginIndex, count );
+ }
+
+ /**
Appends the string representation of the <code>char</code> array
argument to this string buffer.
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 62ba9f6b2cd7..9f3c8d1650ff 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -536,6 +536,26 @@ public:
return append( str.getStr(), str.getLength() );
}
+ /**
+ Appends a portion of the string to this string buffer.
+
+ The characters of the <code>OUString</code> argument are appended, in
+ order, to the contents of this string buffer, increasing the
+ length of this string buffer by the length of the argument.
+
+ @param str a string.
+ @param beginIndex the beginning index, inclusive.
+ @param count the number of characters.
+ @return this string buffer.
+ @since Libreoffice 6.4
+ */
+ OUStringBuffer & append(const OUString &str, sal_Int32 beginIndex, sal_Int32 count)
+ {
+ assert( count == 0 || (beginIndex >= 0 && beginIndex < str.getLength()) );
+ assert( beginIndex <= str.getLength() - count );
+ return append( str.getStr() + beginIndex, count );
+ }
+
#if defined LIBO_INTERNAL_ONLY
OUStringBuffer & append(std::u16string_view sv) {
if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {