* Initialize the textbuffer by supplying it the buffer to write into * and the maximum length of this buffer * @param max_bytes maximum size in bytes, including terminating '\0' * @param max_chars maximum size in chars, including terminating '\0' */
| 401 | * @param max_chars maximum size in chars, including terminating '\0' |
| 402 | */ |
| 403 | Textbuf::Textbuf(uint16_t max_bytes, uint16_t max_chars) |
| 404 | : char_iter(StringIterator::Create()) |
| 405 | { |
| 406 | assert(max_bytes != 0); |
| 407 | assert(max_chars != 0); |
| 408 | |
| 409 | this->afilter = CS_ALPHANUMERAL; |
| 410 | this->max_bytes = max_bytes; |
| 411 | this->max_chars = max_chars == UINT16_MAX ? max_bytes : max_chars; |
| 412 | this->caret = true; |
| 413 | this->DeleteAll(); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Copy a string into the textbuffer. |