|
enum | { buf_len = 32
} |
|
enum | { off_len = buf_len - 1
} |
|
enum | { max_len = buf_len - 2
} |
|
|
size_t | len () const |
|
const char * | c_str () const |
|
char * | c_str () |
|
char * | mem (const char *, size_t n) |
|
|
struct sierra::implementation::StringData::Large | large |
|
char | small [buf_len] |
|
- Objectives:
- Don't allocate for short strings, strings <= max_len
- buf_len == sizeof(String)
- buf_len % sizeof(unsigned long) == 0
- Limitations:
- sizeof(StringData::Large) + 2 <= buf_len < ( 127 == 0x7f )
- Memory layout for short strings that are <= max_len
- buf[ 0 .. max_len - 1 ] = buffer for characters
- buf[ max_len ] = null
- buf[ off_len ] = length of string
- data = must not be used
- Memory layout for long strings that are > max_len
- data.ptr = pointer to allocated memory
- data.len = length of string
- data.siz = allocated size
- buf[ max_len ] != null
- buf[ 0 .. max_len - 1 ] = must not be used
Definition at line 248 of file String.hpp.
◆ mem()
char * sierra::implementation::StringData::mem |
( |
const char * |
cs, |
|
|
size_t |
n |
|
) |
| |
Assigns memory and copy contents
Definition at line 119 of file String.cpp.
The documentation for this union was generated from the following files: