csStringFast< LEN > Class Template Reference
Subclass of csStringBase that contains an internal buffer which is faster than the always dynamically allocated buffer of csStringBase. More...
#include <csutil/csstring.h>
Inheritance diagram for csStringFast< LEN >:

Public Member Functions | |
csStringFast (unsigned char c) | |
Create a csStringFast object from a single unsigned character. | |
csStringFast (char c) | |
Create a csStringFast object from a single signed character. | |
csStringFast (const char *src, size_t _length) | |
Create a csStringFast object from a C string, given the length. | |
csStringFast (const char *src) | |
Create a csStringFast object from a null-terminated C string. | |
csStringFast (const csStringFast ©) | |
Copy constructor. | |
csStringFast (const csStringBase ©) | |
Copy constructor. | |
csStringFast (size_t Length) | |
Create a csStringFast object and reserve space for at least Length characters. | |
csStringFast () | |
Create an empty csStringFast object. | |
virtual char * | Detach () |
Detach the low-level null-terminated C-string buffer from the csString object. | |
virtual void | Free () |
Free the memory allocated for the string. | |
virtual size_t | GetCapacity () const |
Return the current capacity, not including the space for the implicit null terminator. | |
virtual char const * | GetData () const |
Get a pointer to the null-terminated character array. | |
template<typename T> | |
const csStringFast & | operator= (T const &s) |
Assign a formatted value to this string. | |
const csStringFast & | operator= (const csStringBase ©) |
Assign a value to this string. | |
virtual void | ShrinkBestFit () |
Set string buffer capacity to hold exactly the current content. | |
virtual | ~csStringFast () |
Destroy the csStringFast. | |
Protected Member Functions | |
virtual char * | GetDataMutable () |
Get a pointer to the null-terminated character array. | |
virtual void | SetCapacityInternal (size_t NewSize, bool soft) |
Set the buffer to hold NewSize bytes. | |
Protected Attributes | |
char | minibuff [LEN] |
Internal buffer; used when capacity fits within LEN bytes. | |
size_t | miniused |
Amount of minibuff allocated by SetCapacityInternal(); not necessarily same as Size. |
Detailed Description
template<int LEN = 36>
class csStringFast< LEN >
Subclass of csStringBase that contains an internal buffer which is faster than the always dynamically allocated buffer of csStringBase.
Definition at line 918 of file csstring.h.
Constructor & Destructor Documentation
|
Create an empty csStringFast object.
Definition at line 964 of file csstring.h. |
|
Create a csStringFast object and reserve space for at least Length characters.
Definition at line 969 of file csstring.h. References csStringBase::SetCapacity(). |
|
Copy constructor.
Definition at line 974 of file csstring.h. References csStringBase::Append(). |
|
Copy constructor.
Definition at line 979 of file csstring.h. References csStringBase::Append(). |
|
Create a csStringFast object from a null-terminated C string.
Definition at line 984 of file csstring.h. References csStringBase::Append(). |
|
Create a csStringFast object from a C string, given the length.
Definition at line 989 of file csstring.h. References csStringBase::Append(). |
|
Create a csStringFast object from a single signed character.
Definition at line 994 of file csstring.h. References csStringBase::Append(). |
|
Create a csStringFast object from a single unsigned character.
Definition at line 997 of file csstring.h. References csStringBase::Append(). |
|
Destroy the csStringFast.
Definition at line 1000 of file csstring.h. |
Member Function Documentation
|
Detach the low-level null-terminated C-string buffer from the csString object.
Reimplemented from csStringBase. Definition at line 1042 of file csstring.h. References CS_ASSERT, csStrNew(), csStringBase::Data, csStringBase::Detach(), csStringBase::MaxSize, csStringFast< LEN >::minibuff, csStringFast< LEN >::miniused, and csStringBase::Size. |
|
Free the memory allocated for the string.
Reimplemented from csStringBase. Definition at line 1040 of file csstring.h. References csStringBase::Free(), and csStringFast< LEN >::miniused. |
|
Return the current capacity, not including the space for the implicit null terminator.
Reimplemented from csStringBase. Definition at line 1013 of file csstring.h. References csStringBase::Data, csStringBase::GetCapacity(), and csStringFast< LEN >::miniused. |
|
Get a pointer to the null-terminated character array.
Reimplemented from csStringBase. Definition at line 1010 of file csstring.h. References csStringBase::Data, csStringFast< LEN >::minibuff, and csStringFast< LEN >::miniused. Referenced by csDebugImageWriter::DebugImageWrite(), csMeasureTime::PrintIntermediate(), csIdentStrings::StringForIdent(), and csMeasureTime::~csMeasureTime(). |
|
Get a pointer to the null-terminated character array.
Reimplemented from csStringBase. Definition at line 957 of file csstring.h. References csStringBase::Data, csStringFast< LEN >::minibuff, and csStringFast< LEN >::miniused. |
|
Assign a formatted value to this string.
Reimplemented from csStringBase. Definition at line 1008 of file csstring.h. References csStringBase::Replace(). |
|
Assign a value to this string.
Reimplemented from csStringBase. Reimplemented in csString. Definition at line 1003 of file csstring.h. References csStringBase::Replace(). |
|
Set the buffer to hold NewSize bytes. If soft is true it means the buffer can be rounded up to reduce the number of allocations needed. Reimplemented from csStringBase. Definition at line 933 of file csstring.h. References csStringBase::ComputeNewSize(), CS_ASSERT, csStringBase::Data, csStringBase::MaxSize, csStringFast< LEN >::minibuff, csStringFast< LEN >::miniused, csStringBase::SetCapacityInternal(), and csStringBase::Size. |
|
Set string buffer capacity to hold exactly the current content.
Reimplemented from csStringBase. Definition at line 1016 of file csstring.h. References csStringBase::Data, csStringBase::Free(), csStringFast< LEN >::minibuff, csStringFast< LEN >::miniused, csStringBase::ShrinkBestFit(), and csStringBase::Size. |
Member Data Documentation
|
Internal buffer; used when capacity fits within LEN bytes.
Definition at line 922 of file csstring.h. Referenced by csStringFast< LEN >::Detach(), csStringFast< LEN >::GetData(), csStringFast< LEN >::GetDataMutable(), csStringFast< LEN >::SetCapacityInternal(), and csStringFast< LEN >::ShrinkBestFit(). |
|
Amount of minibuff allocated by SetCapacityInternal(); not necessarily same as Size. This is analogous to MaxSize in csStringBase. We need it to determine if minibuff was ever used in order to return NULL if not (to emulate the NULL returned by csStringBase when no buffer has been allocated). We also use minibuff to emulate GetCapacity(), which is a predicate of several memory management methods, such as ExpandIfNeeded(). Definition at line 931 of file csstring.h. Referenced by csStringFast< LEN >::Detach(), csStringFast< LEN >::Free(), csStringFast< LEN >::GetCapacity(), csStringFast< LEN >::GetData(), csStringFast< LEN >::GetDataMutable(), csStringFast< LEN >::SetCapacityInternal(), and csStringFast< LEN >::ShrinkBestFit(). |
The documentation for this class was generated from the following file:
- csutil/csstring.h
Generated for Crystal Space by doxygen 1.4.6