* Reads the null or length terminated string from the buffer. * * @param pos The poisition in the buffer where to start reading. * @param maxLength The maximal length of the string that is read. If this is 0, * the length limit is ignored and the string is read up to the next * 0 byte. * * @return String read from buffer. */
| 232 | * @return String read from buffer. |
| 233 | */ |
| 234 | std::string DynamicBuffer::readString(uint32_t pos, uint32_t maxLength) const |
| 235 | { |
| 236 | std::string str; |
| 237 | char ch; |
| 238 | |
| 239 | while (((ch = read<char>(pos++)) != 0) |
| 240 | && (!maxLength || str.length() < maxLength)) |
| 241 | str += ch; |
| 242 | |
| 243 | return str; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Writes the single byte into the buffer for repeating amount of times. |
no test coverage detected