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 
26 namespace decaf {
27 namespace 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 
53  AbstractStringBuilder(int capacity);
54 
55  AbstractStringBuilder(const String& source);
56 
57  AbstractStringBuilder(const std::string& source);
58 
59  AbstractStringBuilder(const CharSequence* source);
60 
61  virtual ~AbstractStringBuilder();
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 
276  void doAppendNull();
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_ */
static const int INITIAL_CAPACITY
Definition: AbstractStringBuilder.h:43
A CharSequence is a readable sequence of char values.
Definition: CharSequence.h:36
A convenience class used by some Decaf classes to implement the Synchronizable interface when there i...
Definition: SynchronizableImpl.h:36
A modifiable sequence of characters for use in creating and modifying Strings.
Definition: AbstractStringBuilder.h:40
An immutable sequence of characters.
Definition: String.h:57
#define DECAF_API
Definition: Config.h:29