# LogDoctor: FilterOps Namespace Reference

Loading...
Searching...
No Matches
FilterOps Namespace Reference

FilterOps. More...

## Functions

std::optional< QString > | parseNull (const QString &filter_str, const bool to_clean=true) noexcept
| Parses a filter for NULL or NOT NULL final values.
std::optional< QString > | parseNumericFilter (const QString &filter_str) noexcept
| Parses a filter for a log field with integer type.
std::optional< QString > | parseTextualFilter (const QString &filter_str) noexcept
| Parses a filter for a log field with text type.

## Detailed Description

FilterOps.

Operations on query filters

## Function Documentation

## parseNull()

std::optional< QString > FilterOps::parseNull | ( | const QString & | filter_str,
|  | const bool | to_clean = true )

noexcept

Parses a filter for NULL or NOT NULL final values.

Auxiliar function. Returns a value only if the string can be reduce to 'NULL' or 'NOT NULL', in any other case an empty object is returned.

Parameters

  field_str | The string to parse
  to_clean | Whether the filter_str should be cleaned before parsing (trimmed and uppercased)

Returns
  The resulting filter to apply to the query, if valid

## parseNumericFilter()

std::optional< QString > FilterOps::parseNumericFilter | ( | const QString & | filter_str | ) |

noexcept

Parses a filter for a log field with integer type.

The filter can be composed by anumber or by a comparison operator followed by a number. If the filter is just a number (N), it will be resolved to '= N'. Valid comparison operators are: '=' or '==', '!' or '!=', '<', '<=', '>', '>='. Literal comparison operators can be use as well: 'eq', 'ne', 'lt', 'le', 'gt', 'ge'.

Parameters

  field_str | The given filter

Returns
  The resulting filter to apply to the query, if valid

## parseTextualFilter()

std::optional< QString > FilterOps::parseTextualFilter | ( | const QString & | filter_str | ) |

noexcept

Parses a filter for a log field with text type.

Any filter not resolving to NULL or NOT NULL will be used as is. If the filter is exactly '*', il will be resolved as NOT NULL.

Parameters

  field_str | The given filter

Returns
  The resulting filter to apply to the query, if valid