MCPcopy Create free account
hub / github.com/Rezonality/zep / Find

Method Find

src/buffer.cpp:323–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323GlyphIterator 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
374GlyphIterator ZepBuffer::FindOnLineMotion(GlyphIterator start, const uint8_t* pCh, Direction dir) const
375{

Callers 1

HandleExCommandMethod · 0.80

Calls 3

GlyphIteratorClass · 0.85
ValidMethod · 0.80
CharMethod · 0.80

Tested by

no test coverage detected