MCPcopy Create free account
hub / github.com/Genivia/ugrep / cpp

Method cpp

src/output.hpp:542–558  ·  view source on GitHub ↗

output a match as a string in C/C++

Source from the content-addressed store, hash-verified

540
541 // output a match as a string in C/C++
542 inline void cpp(reflex::AbstractMatcher *matcher, int w = 0)
543 {
544 if (flag_only_matching)
545 {
546 cpp(matcher->begin(), matcher->size());
547 }
548 else
549 {
550 const char *e = matcher->eol(); // warning: must call eol() before bol()
551 const char *b = matcher->bol();
552 if (w > 0)
553 e = utf8pos(b, e - b, w);
554 else if (w < 0)
555 b = utf8back(b, e, -w);
556 cpp(b, e - b);
557 }
558 }
559
560 // output a match as a quoted string in CSV
561 inline void csv(reflex::AbstractMatcher *matcher, int w = 0)

Callers

nothing calls this directly

Calls 4

eolMethod · 0.80
bolMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected