Exemplo n.º 1
0
	bool PropertyFilter::match(const NumericFunction& numericF, const InfoFunction& infoF, const CustomFilterFunction& aCustomF) const {
		if (empty())
			return true;

		bool hasMatch = false;
		if (currentFilterProperty < 0 || currentFilterProperty >= propertyCount) {
			// Any column
			if (defMethod < StringMatch::METHOD_LAST && numComparisonMode == LAST) {
				for (auto i = 0; i < propertyCount; ++i) {
					if (propertyTypes[i].filterType == type && matchText(i, infoF)) {
						hasMatch = true;
						break;
					}
				}
			} else {
				for (auto i = 0; i < propertyCount; ++i) {
					if (type == propertyTypes[i].filterType && matchNumeric(i, numericF)) {
						hasMatch = true;
						break;
					}
				}
			}
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_LIST_NUMERIC || propertyTypes[currentFilterProperty].filterType == TYPE_LIST_TEXT) {
			// No default matcher for list properies
			hasMatch = aCustomF(currentFilterProperty, matcher, numericMatcher);
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_TEXT) {
			hasMatch = matchText(currentFilterProperty, infoF);
		} else {
			hasMatch = matchNumeric(currentFilterProperty, numericF);
		}
		return inverse ? !hasMatch : hasMatch;
	}
static int match( struct RE *rexp ){
  switch( rexp->type ){
  case POINT  : return text.pos < text.len;
  case SET    : return matchSet    ( *rexp );
  case BACKREF: return matchBackRef(  rexp );
  case RANGEAB: return matchRange( rexp, text.ptr[text.pos]  );
  case META   : return matchMeta ( rexp, text.ptr[text.pos]  );
  default     : return matchText ( rexp, text.ptr + text.pos );
  }
}