Changeset 6417 for code/trunk/src/libraries/core/input/InputBuffer.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/input/InputBuffer.cc
r6105 r6417 39 39 RegisterRootObject(InputBuffer); 40 40 41 this->buffer_ = "";42 41 this->cursor_ = 0; 42 this->maxLength_ = 1024; 43 43 this->allowedChars_ = "abcdefghijklmnopqrstuvwxyz \ 44 44 ABCDEFGHIJKLMNOPQRSTUVWXYZ \ … … 59 59 RegisterRootObject(InputBuffer); 60 60 61 this->maxLength_ = 1024; 61 62 this->allowedChars_ = allowedChars; 62 this->buffer_ = "";63 63 this->cursor_ = 0; 64 64 … … 93 93 } 94 94 95 void InputBuffer::setMaxLength(unsigned int length) 96 { 97 this->maxLength_ = length; 98 if (this->buffer_.size() > length) 99 this->buffer_.resize(length); 100 } 101 95 102 void InputBuffer::set(const std::string& input, bool update) 96 103 { … … 117 124 if (this->charIsAllowed(input)) 118 125 { 126 if (this->buffer_.size() >= this->maxLength_) 127 return; 119 128 this->buffer_.insert(this->cursor_, 1, input); 120 129 ++this->cursor_; … … 127 136 void InputBuffer::clear(bool update) 128 137 { 129 this->buffer_ = "";138 this->buffer_.clear(); 130 139 this->cursor_ = 0; 131 140 … … 177 186 bool InputBuffer::charIsAllowed(const char& input) 178 187 { 179 if (this->allowedChars_ == "")188 if (this->allowedChars_.empty()) 180 189 return true; 181 190 else
Note: See TracChangeset
for help on using the changeset viewer.