#include <StorageBuffer.h>
Inheritance diagram for StorageBuffer:

Public Methods | |
| StorageBuffer (const char *str=0) | |
| Construct object out of any string buffer. More... | |
| StorageBuffer (const char *str, size_t len) | |
| Construct object out of any string buffer. More... | |
| StorageBuffer (const unsigned char *str, size_t len) | |
| Construct object out of any string buffer. More... | |
| StorageBuffer (const StorageBuffer& buf) | |
| Invoke StorageBuffer::operator=(). | |
| StorageBuffer& | operator= (const StorageBuffer& buf) |
| Can either use this copying method or increment and decrement the ref_count of storage buffers. More... | |
| virtual | ~StorageBuffer () |
| Invoke destroy_obj() on destruction. More... | |
| virtual void | destroy_obj () |
| Release storage on destruction. More... | |
| const unsigned char* | getBuffer () const |
| Return 'unmodifyable' pointer to actual string buffer. More... | |
| unsigned char* | getBufferForWrite () |
| Return 'modifyable' pointer to actual string buffer. More... | |
| int | getAllocation () const |
| Return allocation. More... | |
| int | getLength () const |
| Return length. More... | |
| size_t | getRefCount () const |
| Return refCount. More... | |
| size_t | hash () const |
| Dragon's book's algorithm for hash values. More... | |
| StorageBuffer* | setLength (int aVal) |
| Set length of string. More... | |
| virtual int | largeModelBuffer () const |
| Whether or not this string is large string model object. More... | |
| virtual size_t | nextAllocation (size_t alloc) const |
| Return the next allocation size for the buffer. More... | |
| virtual StorageBuffer* | duplicateStorage () const |
| Duplicate the storage and return a new buffer. More... | |
| StorageBuffer* | duplicate () |
| Duplicate this object. More... | |
| void | allocateStorage (size_t alloc) |
| Allocate storage to fit request. More... | |
| void | initializeStorage (char ic) |
| Initialize storage to specified character. More... | |
| void | releaseStorage () |
| Release any dynamically allocated storage and point buffer to statically allocated stateBuffer. | |
| int | isShared () const |
| Is the string buffer shared (reference count > 0)? More... | |
| void | incrRefCount () |
| Increment the reference count by 1. | |
| void | decrRefCount () |
| If the reference count is already 0, release the storage, otherwise reduce the reference count by 1. | |
| StorageBuffer* | setStorage (const StorageBuffer& buf) |
| Set the string to the specified buf. More... | |
| StorageBuffer* | setStorage (const char *str, size_t len) |
| Set the string to the specified string buffer of specified length. More... | |
| StorageBuffer* | setStorage (const unsigned char *str, size_t len) |
| Set the string to the specified string buffer of specified length. More... | |
| void | setStorageStr (const char *str, size_t len) |
| Set the string to the specified string of specified length. More... | |
| void | setStorageStr (const unsigned char *str, size_t len) |
| Set the string to the specified string of specified length. More... | |
| StorageBuffer* | appendStorage (const StorageBuffer& buf) |
| Append the specified string to the current string. More... | |
| StorageBuffer* | appendStorage (const char *str, size_t len) |
| Append specified string buffer of specified length to current string. More... | |
| StorageBuffer* | appendStorage (const unsigned char *str, size_t len) |
| Append specified string buffer of specified length to current string. More... | |
| void | appendStorageStr (const char *str, size_t len) |
| Append specified string of specified length to the current string. More... | |
| void | appendStorageStr (const unsigned char *str, size_t len) |
| Append specified string of specified length to the current string. More... | |
| StorageBuffer* | prependStorage (const StorageBuffer& buf) |
| Prepend the specified string to the current string. More... | |
| StorageBuffer* | prependStorage (const char *str, size_t len) |
| Prepend specified string buffer of specified length to current string. More... | |
| StorageBuffer* | prependStorage (const unsigned char *str, size_t len) |
| Prepend specified string buffer of specified length to current string. More... | |
| void | prependStorageStr (const char *str, size_t len) |
| Prepend specified string of specified length to the current string. More... | |
| void | prependStorageStr (const unsigned char *str, size_t len) |
| Prepend specified string of specified length to the current string. More... | |
| void | setLengthFromStrlen () |
| Set the length of the string from the string length (strlen) of the current buffer. | |
| unsigned char& | operator[] (int i) |
| Return reference to ith member of the string. More... | |
| const unsigned char& | operator[] (int i) const |
| Return reference to ith member of the string. More... | |
| int | compare (const StorageBuffer& b) const |
| Compare two strings. More... | |
| int | compare_no_case (const StorageBuffer& b) const |
| Compare two strings paying no attention to case. More... | |
Static Public Methods | |
| size_t | StringLength (const char *iBuffer) |
| Return the string length so that inline functions don't directly see strlen which is included from different places on different platforms. | |
Protected Attributes | |
| unsigned char* | buffer |
| Pointer to current string. | |
| unsigned char | staticBuffer [static_buffer_size] |
| Statically allocated buffer for short strings. | |
| size_t | allocation |
| Current total allocation. | |
| size_t | length |
| Current length of the string. | |
| size_t | refCount |
| Reference count to storage. More... | |
Friends | |
| int | operator== (const StorageBuffer& a, const StorageBuffer& b) |
| Returns 1 if strings a and b are equal (strcmp). More... | |
| int | operator!= (const StorageBuffer& a, const StorageBuffer& b) |
| Return !StorageBuffer::operator==. | |
Manages setting, appending and prepending of strings. Variety of constructors for ease of use with character buffers (char *'s) and literal strings (const char *).
|
|
Construct object out of any string buffer. Initializes string to nil then appends passed string. If str not specified or is 0, string is empty string.
|
|
|
Construct object out of any string buffer. Initializes string to nil then appends passed string.
|
|
|
Construct object out of any string buffer. Initializes string to nil then appends passed string.
|
|
|
Invoke destroy_obj() on destruction. Having method destroy_obj() allows object to be used in type_allocator lists.
|
|
|
Can either use this copying method or increment and decrement the ref_count of storage buffers. The copy model leaves ref_count alone. Ie, the model is that the storage stored in one buffer is copied to another, but the number of objects that own the storage described by this allocator is the same. Releases current storage before the copy.
|
|
|
Release storage on destruction.
Reimplemented in RFBoco, RFName, RFNameValue, and RFResult. |
|
|
Return 'unmodifyable' pointer to actual string buffer.
|
|
|
Return 'modifyable' pointer to actual string buffer.
|
|
|
Return allocation.
|
|
|
Return length.
|
|
|
Return refCount.
|
|
|
Dragon's book's algorithm for hash values.
|
|
|
Set length of string.
|
|
|
Whether or not this string is large string model object. Application might choose to manipulate large strings differently.
Reimplemented in LargeStorageBuffer. |
|
|
Return the next allocation size for the buffer. StorageBuffer allocates space in blocks.
Reimplemented in LargeStorageBuffer. |
|
|
Duplicate the storage and return a new buffer.
Reimplemented in LargeStorageBuffer. |
|
|
Duplicate this object. Used right before we reset the string for this object so that shared buffer not destroyed.
|
|
|
Allocate storage to fit request.
|
|
|
Initialize storage to specified character.
|
|
|
Is the string buffer shared (reference count > 0)?
|
|
|
Set the string to the specified buf. Invoke setStorage(const char *, size_t).
|
|
|
Set the string to the specified string buffer of specified length. Invokes setStorage(const unsigned char *, size_t)
|
|
|
Set the string to the specified string buffer of specified length. Duplicates storage (so as to maintain shared copies of current buffer), then updates the string.
|
|
|
Set the string to the specified string of specified length.
|
|
|
Set the string to the specified string of specified length. Releases current storage then copies string to buffer.
|
|
|
Append the specified string to the current string. Invoke setStorage(const char *, size_t).
|
|
|
Append specified string buffer of specified length to current string. Invokes appendStorage()(const unsigned char *, size_t).
|
|
|
Append specified string buffer of specified length to current string. Duplicates storage (so as to maintain shared copies of current buffer), then updates the string.
|
|
|
Append specified string of specified length to the current string.
|
|
|
Append specified string of specified length to the current string.
|
|
|
Prepend the specified string to the current string. Invoke setStorage(const char *, size_t).
|
|
|
Prepend specified string buffer of specified length to current string. Invokes appendStorage()(const unsigned char *, size_t).
|
|
|
Prepend specified string buffer of specified length to current string. Duplicates storage (so as to maintain shared copies of current buffer), then updates the string.
|
|
|
Prepend specified string of specified length to the current string.
|
|
|
Prepend specified string of specified length to the current string.
|
|
|
Return reference to ith member of the string.
Reimplemented in LargeStorageBuffer. |
|
|
Return reference to ith member of the string.
Reimplemented in LargeStorageBuffer. |
|
|
Compare two strings.
|
|
|
Compare two strings paying no attention to case.
|
|
|
Returns 1 if strings a and b are equal (strcmp).
|
|
|
Reference count to storage. This object is designed for use in larger systems that reference count. Users can use reference count externally or simply copy the string.
|
1.2.0 written by Dimitri van Heesch,
© 1997-2000