version 5.0.0_beta

integrate PIRegularExpression into PIString and PIDir
add piliterals_regularexpression.h for ""_regex and ""_glob literals
This commit is contained in:
2025-08-13 18:48:01 +03:00
parent 7a6936ccd9
commit b6c5d65a8d
9 changed files with 158 additions and 57 deletions

View File

@@ -192,25 +192,8 @@ int PIRegularExpression::captureGroupIndex(const PIString & gname) const {
}
PIRegularExpression::Matcher PIRegularExpression::matchIterator(PIString & subject, size_t offset) {
PIRegularExpression::Matcher ret(this);
ret.start_offset = offset;
ret.subject = &subject;
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::matchIterator(PIString && subject, size_t offset) {
PIRegularExpression::Matcher ret(this);
ret.start_offset = offset;
ret.subject_own = std::move(subject);
ret.subject = &ret.subject_own;
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::matchIterator(const PIString & subject, size_t offset) {
PIRegularExpression::Matcher ret(this);
PIRegularExpression::Matcher PIRegularExpression::matchIterator(const PIString & subject, size_t offset) const {
PIRegularExpression::Matcher ret(const_cast<PIRegularExpression *>(this));
ret.start_offset = offset;
ret.subject_own = subject;
ret.subject = &ret.subject_own;
@@ -218,27 +201,44 @@ PIRegularExpression::Matcher PIRegularExpression::matchIterator(const PIString &
}
PIRegularExpression::Matcher PIRegularExpression::match(PIString & subject, size_t offset) {
PIRegularExpression::Matcher PIRegularExpression::matchIterator(PIString & subject, size_t offset) const {
PIRegularExpression::Matcher ret(const_cast<PIRegularExpression *>(this));
ret.start_offset = offset;
ret.subject = &subject;
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::matchIterator(PIString && subject, size_t offset) const {
PIRegularExpression::Matcher ret(const_cast<PIRegularExpression *>(this));
ret.start_offset = offset;
ret.subject_own = std::move(subject);
ret.subject = &ret.subject_own;
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::match(const PIString & subject, size_t offset) const {
PIRegularExpression::Matcher ret = matchIterator(subject, offset);
PRIVATE->match(ret);
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::match(PIString && subject, size_t offset) {
PIRegularExpression::Matcher PIRegularExpression::match(PIString & subject, size_t offset) const {
PIRegularExpression::Matcher ret = matchIterator(subject, offset);
PRIVATE->match(ret);
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::match(PIString && subject, size_t offset) const {
PIRegularExpression::Matcher ret = matchIterator(std::move(subject), offset);
PRIVATE->match(ret);
return ret;
}
PIRegularExpression::Matcher PIRegularExpression::match(const PIString & subject, size_t offset) {
PIRegularExpression::Matcher ret = matchIterator(subject, offset);
PRIVATE->match(ret);
return ret;
}
PIRegularExpression::Matcher::Matcher(PIRegularExpression * p): parent(p) {}