| 297 | } |
| 298 | |
| 299 | virtual bool result() |
| 300 | { |
| 301 | UCharBuffer utfBuffer; |
| 302 | const auto charSetId = textType->getCharSet()->getId(); |
| 303 | UCharBuffer* bufferPtr = &buffer; |
| 304 | |
| 305 | if (charSetId != CS_NONE && charSetId != CS_BINARY && charSetId != CS_UTF8) |
| 306 | { |
| 307 | converter.convert(buffer.getCount(), buffer.begin(), utfBuffer); |
| 308 | bufferPtr = &utfBuffer; |
| 309 | } |
| 310 | |
| 311 | if (textType->getAttributes() & TEXTTYPE_ATTR_ACCENT_INSENSITIVE) |
| 312 | UnicodeUtil::utf8Normalize(*bufferPtr); |
| 313 | |
| 314 | if (!regex->matches((const char*) bufferPtr->begin(), bufferPtr->getCount(), &resultStart, &resultLength)) |
| 315 | return false; |
| 316 | |
| 317 | if (charSetId != CS_NONE && charSetId != CS_BINARY) |
| 318 | { |
| 319 | // Get the character positions in the utf-8 string. |
| 320 | auto utf8CharSet = IntlUtil::getUtf8CharSet(); |
| 321 | resultLength = utf8CharSet->length(resultLength, bufferPtr->begin() + resultStart, true); |
| 322 | resultStart = utf8CharSet->length(resultStart, bufferPtr->begin(), true); |
| 323 | } |
| 324 | |
| 325 | return true; |
| 326 | } |
| 327 | |
| 328 | virtual void getResultInfo(unsigned* start, unsigned* length) |
| 329 | { |
nothing calls this directly
no test coverage detected