| 412 | } |
| 413 | |
| 414 | void LineAnnotation::SetText(int line, const char *text) { |
| 415 | if (text && (line >= 0)) { |
| 416 | annotations.EnsureLength(line+1); |
| 417 | int style = Style(line); |
| 418 | if (annotations[line]) { |
| 419 | delete []annotations[line]; |
| 420 | } |
| 421 | annotations[line] = AllocateAnnotation(static_cast<int>(strlen(text)), style); |
| 422 | AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]); |
| 423 | pah->style = static_cast<short>(style); |
| 424 | pah->length = static_cast<int>(strlen(text)); |
| 425 | pah->lines = static_cast<short>(NumberLines(text)); |
| 426 | memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length); |
| 427 | } else { |
| 428 | if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) { |
| 429 | delete []annotations[line]; |
| 430 | annotations[line] = 0; |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | void LineAnnotation::ClearAll() { |
| 436 | for (int line = 0; line < annotations.Length(); line++) { |
no test coverage detected