|
JASSv2
|
C++ slices (string-descriptors) More...
#include <slice.h>
Public Member Functions | |
| slice (void *pointer=nullptr, size_t length=0) | |
| Constructor. More... | |
| slice (void *start, void *end) | |
| Constructor. More... | |
| slice (const char *message) | |
| Constructor. Construct as a pointer to message and with length strlen(message). Does not copy, points to. More... | |
| slice (allocator &pool, void *start, void *end) | |
| Construct a slice by copying the data into allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task. More... | |
| slice (allocator &pool, const char *start, const char *end) | |
| Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task. More... | |
| slice (allocator &pool, const unsigned char *start, const unsigned char *end) | |
| Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task. More... | |
| slice (allocator &pool, const char *start) | |
| Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task. More... | |
| slice (allocator &pool, const unsigned char *start) | |
| Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task. More... | |
| slice (allocator &pool, const slice &from) | |
| Construct a slice by copying its contents into the pool allocator. More... | |
| slice (allocator &pool, size_t bytes) | |
| Construct a slice by allocating bytes of memory from a pool allocator. More... | |
| slice (allocator &pool) | |
| Construct an empty slice with a pool allocator. More... | |
| void | clear (void) |
| Construct an empty slice with a pool allocator. More... | |
| slice & | operator= (const slice &with) |
| Operator = (asignment operator) More... | |
| size_t | size (void) const |
| Return the length of this slice. More... | |
| void * | address (void) const |
| Extract the pointer value from the slice. More... | |
| void | resize (size_t new_size) |
| Change the length of the slice. More... | |
| uint8_t & | operator[] (size_t index) const |
| Return a reference to the n'th byte past the start of the slice. More... | |
| bool | operator< (const slice &with) const |
| Return true if this < with. More... | |
| bool | operator> (const slice &with) const |
| Return true if this > with. More... | |
| bool | operator== (const slice &with) const |
| Return true if this == with. More... | |
Static Public Member Functions | |
| static bool | strict_weak_order_less_than (const slice &me, const slice &with) |
| Return true if this < with. More... | |
| static void | unittest (void) |
| Unit test this class. | |
Protected Attributes | |
| void * | pointer |
| The start of the data. | |
| size_t | length |
| The length of the data (in bytes). | |
C++ slices (string-descriptors)
|
inline |
Constructor.
| pointer | [in] The start address of the memory this slice represents. |
| length | [in] The length (in bytes) of this slice. |
|
inline |
Constructor.
| start | [in] The start address of the memory this slice represents. |
| end | [in] The end address of the memory this slice represents. |
|
inline |
Constructor. Construct as a pointer to message and with length strlen(message). Does not copy, points to.
| message | [in] A pointer to a '\0' terminated 'C' string. |
|
inline |
Construct a slice by copying the data into allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task.
| pool | [in] An allocator to allocate the memory from. |
| start | [in] The start address of the memory this slice represents. |
| end | [in] The end address of the memory this slice represents. |
|
inline |
Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task.
| pool | [in] An allocator to allocate the memory from. |
| start | [in] The start address of the C string. |
| end | [in] The end address of the C string. |
|
inline |
Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task.
| pool | [in] An allocator to allocate the memory from. |
| start | [in] The start address of the C string. |
| end | [in] The end address of the C string. |
|
inline |
Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task.
| pool | [in] An allocator to allocate the memory from. |
| start | [in] The start address of the C string. |
|
inline |
Construct a slice by copying and '\0' termainating a string, using the allocator's pool of memory. This does NOT ever delete the memory, that is the allocator's task.
| pool | [in] An allocator to allocate the memory from. |
| start | [in] The start address of the C string. |
Construct a slice by copying its contents into the pool allocator.
| pool | [in] An allocator to allocate the memory from. |
| from | [in] The slice to copy. |
|
inline |
Construct a slice by allocating bytes of memory from a pool allocator.
| pool | [in] An allocator to allocate from. |
| bytes | [in] The number of bytes of memory to allocate from the pool. |
|
inline |
Construct an empty slice with a pool allocator.
| pool | [in] An allocator to allocate from. |
|
inline |
Extract the pointer value from the slice.
|
inline |
Construct an empty slice with a pool allocator.
| pool | [in] An allocator to allocate from. |
|
inline |
Return true if this < with.
The colaiting sequence is: shorter strings are "less" then longer strings. For strings of equal length memcmp() us used.
| with | [in] The slice to compare to. |
Operator = (asignment operator)
| with | [in] The slice to copy to. |
|
inline |
Return true if this == with.
| with | [in] The slice to compare to. |
|
inline |
Return true if this > with.
| with | [in] The slice to compare to. |
The colaiting sequence is: shorter strings are "less" then longer strings. For strings of equal length memcmp() us used.
|
inline |
Return a reference to the n'th byte past the start of the slice.
| index | [in] Which byte to return. |
No safety comparison is performed. Out of range indexing will result in undefined behaviour
|
inline |
Change the length of the slice.
| new_size | [in] The new size (in bytes) of the slice. |
|
inline |
Return the length of this slice.
|
inlinestatic |
Return true if this < with.
The colaiting sequence is memcmp().
| me | [in] The slice to compare. |
| with | [in] The slice to compare to. |
1.8.13