MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CClass

Method CClass

extern/re2/re2/prefilter.cc:452–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450// Constructs Prefilter::Info for a character class.
451typedef CharClass::iterator CCIter;
452Prefilter::Info* Prefilter::Info::CClass(CharClass *cc,
453 bool latin1) {
454 if (ExtraDebug) {
455 LOG(ERROR) << "CharClassInfo:";
456 for (CCIter i = cc->begin(); i != cc->end(); ++i)
457 LOG(ERROR) << " " << i->lo << "-" << i->hi;
458 }
459
460 // If the class is too large, it's okay to overestimate.
461 if (cc->size() > 10)
462 return AnyCharOrAnyByte();
463
464 Prefilter::Info *a = new Prefilter::Info();
465 for (CCIter i = cc->begin(); i != cc->end(); ++i)
466 for (Rune r = i->lo; r <= i->hi; r++) {
467 if (latin1) {
468 a->exact_.insert(RuneToStringLatin1(ToLowerRuneLatin1(r)));
469 } else {
470 a->exact_.insert(RuneToString(ToLowerRune(r)));
471 }
472 }
473
474
475 a->is_exact_ = true;
476
477 if (ExtraDebug)
478 LOG(ERROR) << " = " << a->ToString();
479
480 return a;
481}
482
483class Prefilter::Info::Walker : public Regexp::Walker<Prefilter::Info*> {
484 public:

Callers

nothing calls this directly

Calls 9

RuneToStringLatin1Function · 0.85
ToLowerRuneLatin1Function · 0.85
RuneToStringFunction · 0.85
ToLowerRuneFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected