Poco::Data

class RowFilter

Library: Data
Package: DataCore
Header: Poco/Data/RowFilter.h

Description

RowFilter class provides row filtering functionality. A filter contains a set of criteria (field name, value and logical operation) for row filtering. Additionally, a row filter contains a map of pointers to other filters with related logical operations between filters. RowFilter is typically added to recordset in order to filter its content. Since the recordset own iteration is dependent upon filtering, whenever the filtering criteria is changed, the filter automatically notifies all associated recordsets by rewinding them to the first position.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Member Summary

Member Functions: add, addAnd, addFilter, addOr, exists, has, isAllowed, isEmpty, isNot, remove, removeFilter, toggleNot

Inherited Functions: duplicate, referenceCount, release

Types

CompT

typedef bool (* CompT)(const Poco::Dynamic::Var &, const Poco::Dynamic::Var &);

Types Aliases

ComparisonEntry

using ComparisonEntry = Tuple < Poco::Dynamic::Var, Comparison, LogicOperator >;

ComparisonMap

using ComparisonMap = std::multimap < std::string, ComparisonEntry >;

Comparisons

using Comparisons = std::map < std::string, Comparison >;

FilterMap

using FilterMap = std::map < AutoPtr < RowFilter >, LogicOperator >;

Ptr

using Ptr = AutoPtr < RowFilter >;

Enumerations

Comparison

VALUE_LESS_THAN

VALUE_LESS_THAN_OR_EQUAL

VALUE_EQUAL

VALUE_GREATER_THAN

VALUE_GREATER_THAN_OR_EQUAL

VALUE_NOT_EQUAL

VALUE_IS_NULL

LogicOperator

OP_AND

OP_OR

OP_NOT

Constructors

RowFilter

RowFilter(
    RecordSet * pRecordSet
);

Creates the top-level RowFilter and associates it with the recordset.

RowFilter

RowFilter(
    Ptr pParent,
    LogicOperator op = OP_OR
);

Creates child RowFilter and associates it with the parent filter.

Destructor

~RowFilter virtual

~RowFilter();

Destroys the RowFilter.

Member Functions

add inline

template < typename T > void add(
    const std::string & name,
    Comparison comparison,
    const T & value,
    LogicOperator op = OP_OR
);

Adds value to the filter.

add inline

template < typename T > void add(
    const std::string & name,
    const std::string & comp,
    const T & value,
    LogicOperator op = OP_OR
);

Adds value to the filter.

addAnd inline

template < typename T > void addAnd(
    const std::string & name,
    const std::string & comp,
    const T & value
);

Adds logically AND-ed value to the filter.

addFilter

void addFilter(
    Ptr pFilter,
    LogicOperator comparison
);

Appends another filter to this one.

addOr inline

template < typename T > void addOr(
    const std::string & name,
    const std::string & comp,
    const T & value
);

Adds logically OR-ed value to the filter.

exists inline

bool exists(
    const std::string & name
) const;

Returns true if name is known to this row filter.

has inline

bool has(
    Ptr pFilter
) const;

Returns true if this filter is parent of pFilter;

isAllowed

bool isAllowed(
    std::size_t row
) const;

Returns true if name and value are allowed.

isEmpty inline

bool isEmpty() const;

Returns true if there is not filtering criteria specified.

isNot inline

bool isNot() const;

Returns true if filter is NOT-ed, false otherwise.

remove

int remove(
    const std::string & name
);

Removes named comparisons from the filter. All comparisons with specified name are removed. Returns the number of comparisons removed.

removeFilter

void removeFilter(
    Ptr pFilter
);

Removes filter from this filter.

toggleNot inline

void toggleNot();

Togless the NOT operator for this filter;