activemq-cpp-3.9.5
AbstractStringBuilder.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_LANG_ABSTRACTSTRINGBUILDER_H_
19#define _DECAF_LANG_ABSTRACTSTRINGBUILDER_H_
20
21#include <decaf/util/Config.h>
22#include <decaf/lang/String.h>
23
25
26namespace decaf {
27namespace lang {
28
29 class AbstractStringBuilderImpl;
30
41 protected:
42
43 static const int INITIAL_CAPACITY;
44
45 private:
46
47 AbstractStringBuilderImpl* impl;
48
49 public:
50
52
54
56
57 AbstractStringBuilder(const std::string& source);
58
60
62
63 public:
64
72 virtual int capacity() const;
73
82 virtual char charAt(int index) const;
83
96 virtual void ensureCapacity(int minCapacity);
97
120 virtual void getChars(int start, int end, char* dst, int dstSize, int dstStart) const;
121
130 virtual int indexOf(const String& value) const;
131
143 virtual int indexOf(const String& value, int start) const;
144
154 virtual int lastIndexOf(const String& value) const;
155
168 virtual int lastIndexOf(const String& value, int start) const;
169
175 virtual int length() const;
176
189 virtual void setLength(int length);
190
201 virtual void setCharAt(int index, char value);
202
216 virtual String substring(int start) const;
217
234 virtual String substring(int start, int end) const;
235
253 virtual CharSequence* subSequence(int start, int end) const;
254
260 virtual String toString() const;
261
269 virtual void trimToSize();
270
271 protected:
272
277
284 void doAppend(const char value);
285
294 void doAppend(const char* value);
295
311 void doAppend(const char* value, int offset, int length);
312
321 void doAppend(const CharSequence* value);
322
338 void doAppend(const CharSequence* value, int offset, int length);
339
346 void doAppend(const std::string& value);
347
354 void doAppend(const String& value);
355
362 void doAppend(const AbstractStringBuilder& value);
363
372 void doDeleteRange(int start, int end);
373
380 void doDeleteCharAt(int index);
381
390 void doInsert(int index, char value);
391
400 void doInsert(int index, const char* value);
401
410 void doInsert(int index, const String& value);
411
420 void doInsert(int index, const std::string& value);
421
439 void doInsert(int index, const char* value, int offset, int length);
440
452 void doInsert(int index, const CharSequence* value);
453
472 void doInsert(int index, const CharSequence* value, int start, int end);
473
490 void doReplace(int start, int end, const String& value);
491
495 void doReverse();
496
497 };
498
499}}
500
501#endif /* _DECAF_LANG_ABSTRACTSTRINGBUILDER_H_ */
A convenience class used by some Decaf classes to implement the Synchronizable interface when there i...
Definition SynchronizableImpl.h:36
void doDeleteRange(int start, int end)
Delete the characters in the range start - end.
virtual int indexOf(const String &value, int start) const
Search for the index within this string of the first occurrence of the specified substring starting a...
void doInsert(int index, char value)
Inserts a single char value at the given index.
virtual int length() const
Returns the current length of the String that has been built.
void doReverse()
Reverses the characters contained in this character buffer.
virtual CharSequence * subSequence(int start, int end) const
Creates and returns a new CharSequence object that is a subset of the characters contained in this ch...
void doAppend(const CharSequence *value)
Appends the given CharSequence to this buffer.
AbstractStringBuilder(const String &source)
void doInsert(int index, const CharSequence *value, int start, int end)
Inserts the given CharSequence at the given index in this buffer starting at the given index and endi...
void doDeleteCharAt(int index)
Deletes the character at the given index from this buffer.
void doAppend(const std::string &value)
Append the given std::string to this buffer.
AbstractStringBuilder(const std::string &source)
virtual char charAt(int index) const
Returns the character at the given index.
virtual String substring(int start, int end) const
Returns a new String that contains a subset of the characters currently contained in this character b...
void doAppend(const CharSequence *value, int offset, int length)
Appends the given CharSequence to this buffer starting at the given offset and ending after the lengt...
virtual void getChars(int start, int end, char *dst, int dstSize, int dstStart) const
Copies characters from this character buffer into the given character array.
void doInsert(int index, const std::string &value)
Inserts a std::string value at the given index.
virtual int lastIndexOf(const String &value, int start) const
Search for the last index within this string where the given substring can be found starting from the...
virtual int capacity() const
Returns the current capacity.
AbstractStringBuilder(const CharSequence *source)
void doReplace(int start, int end, const String &value)
Replace some number of characters in this Buffer with the value given.
virtual void setCharAt(int index, char value)
Sets the character at the specified index to the new char value given.
void doAppend(const char value)
Appends the given char to this buffer.
virtual void trimToSize()
Attempts to reduce storage used for the character sequence.
void doAppend(const AbstractStringBuilder &value)
Append the given AbstractStringBuilder to this buffer.
virtual int indexOf(const String &value) const
Search for the index within this string of the first occurrence of the specified substring.
virtual void setLength(int length)
Sets the length of this character buffer.
virtual String substring(int start) const
Returns a new String that contains a subset of the characters currently contained in this character b...
static const int INITIAL_CAPACITY
Definition AbstractStringBuilder.h:43
virtual String toString() const
Returns a String that represents the contents of this buffer.
virtual void ensureCapacity(int minCapacity)
Ensures that the capacity is at least equal to the specified min value.
void doInsert(int index, const CharSequence *value)
Inserts the given CharSequence at the given index in this buffer.
void doInsert(int index, const String &value)
Inserts a String value at the given index.
void doAppend(const String &value)
Append the given String to this buffer.
virtual int lastIndexOf(const String &value) const
Search for the last index within this string where the given substring can be found.
void doAppendNull()
Appends the string "null" to the current character buffer.
void doAppend(const char *value, int offset, int length)
Appends the given C string to this buffer starting at the given offset and ending after the length nu...
void doAppend(const char *value)
Appends the given C string to this buffer.
void doInsert(int index, const char *value, int offset, int length)
Inserts the given C string at the given index in this buffer starting at the given offset and ending ...
void doInsert(int index, const char *value)
Inserts a C string value at the given index.
A CharSequence is a readable sequence of char values.
Definition CharSequence.h:36
An immutable sequence of characters.
Definition String.h:57
#define DECAF_API
Definition Config.h:29
Definition ThreadingTypes.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25