| 321 | } |
| 322 | |
| 323 | GlyphIterator ZepBuffer::Find(GlyphIterator start, const uint8_t* pBeginString, const uint8_t* pEndString) const |
| 324 | { |
| 325 | // Should be a valid start |
| 326 | assert(start.Valid()); |
| 327 | assert(pBeginString != nullptr); |
| 328 | |
| 329 | if (!start.Valid() && pBeginString) |
| 330 | { |
| 331 | return start; |
| 332 | } |
| 333 | |
| 334 | // Find the end of the test string |
| 335 | if (pEndString == nullptr) |
| 336 | { |
| 337 | pEndString = pBeginString; |
| 338 | while (*pEndString != 0) |
| 339 | { |
| 340 | pEndString++; |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | auto itrBuffer = start; |
| 345 | auto itrEnd = End(); |
| 346 | while (itrBuffer != itrEnd) |
| 347 | { |
| 348 | auto itrNext = itrBuffer; |
| 349 | |
| 350 | // Loop the string and match it to the buffer |
| 351 | auto pCurrent = pBeginString; |
| 352 | while (pCurrent != pEndString && itrNext != itrEnd) |
| 353 | { |
| 354 | if (*pCurrent != itrNext.Char()) |
| 355 | { |
| 356 | break; |
| 357 | } |
| 358 | pCurrent++; |
| 359 | itrNext++; |
| 360 | }; |
| 361 | |
| 362 | // We successfully got to the end |
| 363 | if (pCurrent == pEndString) |
| 364 | { |
| 365 | return itrBuffer; |
| 366 | } |
| 367 | |
| 368 | itrBuffer++; |
| 369 | }; |
| 370 | |
| 371 | return GlyphIterator(); |
| 372 | } |
| 373 | |
| 374 | GlyphIterator ZepBuffer::FindOnLineMotion(GlyphIterator start, const uint8_t* pCh, Direction dir) const |
| 375 | { |
no test coverage detected