Crystal Space: C.1.5 String Changes

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### C.1.5 String Changes

The class hierarchy of ``csString'` has changed. Most functionality is now provided by the new superclass ``csStringBase'`. From this, `csStringFast<>` is subclassed, and ``csString'` descends from `csStringFast<>`. `csStringFast<>` is a templated class featuring an internal character buffer which is used instead of dynamically heap-allocated memory when the string length is sufficently short (as controlled by the class template argument). This generalization can make ``csStringFast<>'` (and its subclass ``csString'`) much faster when used as automatic (stack-allocated) variables, even when declared inside ``for{}'`-loops, since slow heap-allocation often can be avoided.

For simplification purposes, several methods have been removed from ``csString'` and ``iString'` (when present):

- Static `PadFoo()` methods. The same functionality can be achieved with the remaining instance `PadFoo()` methods.
- `AsPadFoo()` instance methods. The same functionality can be achieved with the remaining instance `PadFoo()` methods.
- Static integer and float `Format()` methods. The same functionality can be achieved by utilizing the remaining `Replace()` or `Format()` methods.
- `SetGrowsExponentially()` and `GetGrowsExponentially()`. The same functionality is provided by `SetGrowsBy(0)` and `GetGrowsBy()`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.