ztring.c: A few important extension for <string.h>
|
Contains a memory block of 'SIZE' characters in between 3 memory blocks of that same 'zchz::SIZE'. More...
#include <zchz.h>
Public Member Functions | |
zchz (size_t n) | |
Constructor. More... | |
zchz (const char *str) | |
Constructor. More... | |
size_t | strsz () const |
Get current block size. More... | |
zchz & | operator++ () |
++p More... | |
zchz & | operator+= (size_t n) |
ZCHZ[i]. More... | |
char & | operator[] (size_t i) |
ZCHZ += i. More... | |
operator char * () | |
Returns the stored string (non-const operator). More... | |
operator const char * () const | |
Returns the stored string (const operator). More... | |
Private Types | |
enum | { SIZE = 200, adjust_SIZE = (SIZE+1)*16, real_SIZE = ( SIZE%16==0 ? SIZE : adjust_SIZE/16 ), RZ = real_SIZE } |
enum | { before_overwrite = 1, after_overwrite = 2, size_is_0_or_too_large = 3, pointer_out_of_bounce = 4, index_out_of_bounce = 5, invalid_pointer_difference = 6, unknow_error = 7 } |
Private Member Functions | |
void | set (size_t size) |
Set the internal will have size equal to 'size'. More... | |
void | set (const char *str) |
Set the internal block to the value to 'str'. More... | |
void | reset_filling () |
Initializes the block that surroung the stored value. More... | |
void | check () |
Checks whether the memory around the string value holds the value stored method set(). More... | |
Private Attributes | |
int | m_errno |
Error code. More... | |
size_t | m_idx |
Current offset for pointer access. More... | |
size_t | m_size |
Current size of stored value. More... | |
char | m_block [3 *real_SIZE] |
Stored string value. More... | |
Friends | |
ptrdiff_t | operator- (char *l, zchz &r) |
ptrdiff_t | operator- (zchz &l, char *r) |
char * | operator+ (zchz &l, int i) |
Contains a memory block of 'SIZE' characters in between 3 memory blocks of that same 'zchz::SIZE'.
The stored value can be retrieved using 'operator char*()' and it is aligned to an 16 byte word.
|
private |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |