summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-30 09:12:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-30 11:35:56 +0100
commit1a2912eed9980d7ded481bc60a81597b0c699481 (patch)
tree6528508c2e04c31345ad1a4392638b118b561b40 /sal/inc
parent4312ed8c4f85575ab125da84ba09f02430ee9a89 (diff)
add StringBuffers ::remove
Diffstat (limited to 'sal/inc')
-rw-r--r--sal/inc/rtl/strbuf.h19
-rw-r--r--sal/inc/rtl/strbuf.hxx29
-rw-r--r--sal/inc/rtl/ustrbuf.h18
-rw-r--r--sal/inc/rtl/ustrbuf.hxx31
4 files changed, 92 insertions, 5 deletions
diff --git a/sal/inc/rtl/strbuf.h b/sal/inc/rtl/strbuf.h
index 584137f6d38c..78f604009c11 100644
--- a/sal/inc/rtl/strbuf.h
+++ b/sal/inc/rtl/strbuf.h
@@ -105,7 +105,6 @@ void SAL_CALL rtl_stringbuffer_ensureCapacity( /*inout*/rtl_String ** This,
@param offset the offset.
@param ch a character array.
@param len the number of characters to append.
- @return this string buffer.
*/
void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This,
/*inout*/sal_Int32 * capacity,
@@ -113,6 +112,24 @@ void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This,
const sal_Char * str,
sal_Int32 len);
+/**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ extends to the character at index <code>end - 1</code> or to
+ the end of the sequence if no such character exists. If
+ <code>start</code> is equal to <code>end</code>, no changes
+ are made.
+
+ start must be >= 0 && <= This->length && <= end
+
+ @param start The beginning index, inclusive
+ @param end The ending index, exclusive
+ */
+void SAL_CALL rtl_stringbuffer_remove( /*inout*/rtl_String ** This,
+ sal_Int32 start,
+ sal_Int32 end );
+
#ifdef __cplusplus
}
#endif
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 918f2e6e6fa7..48a55683bd46 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -54,7 +54,7 @@ namespace rtl
is compiled to the equivalent of:
<p><blockquote><pre>
x = new OStringBuffer().append("a").append(4).append("c")
- .toString()
+ .makeStringAndClear()
</pre></blockquote><p>
The principal operations on a <code>OStringBuffer</code> are the
<code>append</code> and <code>insert</code> methods, which are
@@ -670,6 +670,33 @@ public:
sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
}
+
+ /**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ extends to the character at index <code>end - 1</code> or to
+ the end of the sequence if no such character exists. If
+ <code>start</code> is equal to <code>end</code>, no changes
+ are made.
+
+ start must be >= 0 && <= getLength() && <= end
+
+ As is usual for the rtl string classes, this is based
+ on an analogous Java StringBuffer member. In this
+ case <code>delete</code>, but because that's a reserved
+ keyword in C++, this is named <code>remove</code>.
+
+ @param start The beginning index, inclusive
+ @param end The ending index, exclusive
+ @return this string buffer.
+ */
+ OStringBuffer & remove( sal_Int32 start, sal_Int32 end )
+ {
+ rtl_stringbuffer_remove( &pData, start, end );
+ return *this;
+ }
+
private:
/**
A pointer to the data structur which contains the data.
diff --git a/sal/inc/rtl/ustrbuf.h b/sal/inc/rtl/ustrbuf.h
index a7295f5e5324..36e5652000db 100644
--- a/sal/inc/rtl/ustrbuf.h
+++ b/sal/inc/rtl/ustrbuf.h
@@ -159,6 +159,24 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This,
const sal_Char * str,
sal_Int32 len);
+/**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ extends to the character at index <code>end - 1</code> or to
+ the end of the sequence if no such character exists. If
+ <code>start</code> is equal to <code>end</code>, no changes
+ are made.
+
+ start must be >= 0 && <= This->length && <= end
+
+ @param start The beginning index, inclusive
+ @param end The ending index, exclusive
+ */
+void SAL_CALL rtl_uStringbuffer_remove( /*inout*/rtl_uString ** This,
+ sal_Int32 start,
+ sal_Int32 end );
+
#ifdef __cplusplus
}
#endif
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 3f3498aa2ecf..bde72fc0cde2 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -53,7 +53,7 @@ namespace rtl
is compiled to the equivalent of:
<p><blockquote><pre>
x = new OUStringBuffer().append("a").append(4).append("c")
- .toString()
+ .makeStringAndClear()
</pre></blockquote><p>
The principal operations on a <code>OUStringBuffer</code> are the
<code>append</code> and <code>insert</code> methods, which are
@@ -95,7 +95,7 @@ public:
Allocates a new string buffer that contains the same sequence of
characters as the string buffer argument.
- @param value a <code>OStringBuffer</code>.
+ @param value a <code>OUStringBuffer</code>.
*/
OUStringBuffer( const OUStringBuffer & value )
: pData(NULL)
@@ -280,7 +280,6 @@ public:
*/
const OUString toString() const { return OUString(pData->buffer); }
-
/**
The character at the specified index of this string buffer is set
to <code>ch</code>.
@@ -739,6 +738,32 @@ public:
return *this;
}
+ /**
+ Removes the characters in a substring of this sequence.
+
+ The substring begins at the specified <code>start</code> and
+ extends to the character at index <code>end - 1</code> or to
+ the end of the sequence if no such character exists. If
+ <code>start</code> is equal to <code>end</code>, no changes
+ are made.
+
+ start must be >= 0 && <= getLength() && <= end
+
+ As is usual for the rtl string classes, this is based
+ on an analogous Java StringBuffer member. In this
+ case <code>delete</code>, but because that's a reserved
+ keyword in C++, this is named <code>remove</code>.
+
+ @param start The beginning index, inclusive
+ @param end The ending index, exclusive
+ @return this string buffer.
+ */
+ OUStringBuffer & remove( sal_Int32 start, sal_Int32 end )
+ {
+ rtl_uStringbuffer_remove( &pData, start, end );
+ return *this;
+ }
+
/** Allows access to the internal data of this OUStringBuffer, for effective
manipulation.