(svn r21407) -Codechange: prepare the text buffer code for limiting on number of characters besides the number of bytes

This commit is contained in:
rubidium
2010-12-05 22:22:54 +00:00
parent 28da832781
commit 5c2674ec77
4 changed files with 43 additions and 11 deletions

View File

@@ -62,8 +62,9 @@ public:
struct QueryStringBaseWindow : public Window, public QueryString {
char *edit_str_buf; ///< Buffer for string.
const uint16 edit_str_size; ///< Maximum length of string (in bytes), including terminating '\0'.
const uint16 max_chars; ///< Maximum length of string (in characters), including terminating '\0'.
QueryStringBaseWindow(uint16 size) : Window(), edit_str_size(size)
QueryStringBaseWindow(uint16 size, uint16 chars = UINT16_MAX) : Window(), edit_str_size(size), max_chars(chars == UINT16_MAX ? size : chars)
{
assert(size != 0);
this->edit_str_buf = CallocT<char>(size);