casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::TBFilterRule Class Reference

Rule that can be used to filter rows based upon field values. More...

#include <TBFilterRules.qo.h>

List of all members.

Public Member Functions

 TBFilterRule (String field, Comparator comparator, TBData *value, TBData *value2=NULL, bool isNot=false, bool anyField=false)
 Constructor that takes the rule parameters.
 ~TBFilterRule ()
String getField ()
 Returns the field this rule applies to, or blank if it applies to any field.
Comparator getComparator ()
 Returns this rule's comparator.
TBDatagetValue ()
 Returns this rule's value.
TBDatagetValue2 ()
 Returns this rule's second value, or blank if it doesn't have one.
bool getIsNot ()
 Returns true if this rule is negated (i.e., "not equal" rather than "equal"), false otherwise.
bool getAnyField ()
 Returns true if this rule applies to any field, false otherwise.
bool equals (TBFilterRule *r)
 Returns true if this rule is equal to the given rule, false otherwise.
int rowPasses (TBTable *table, int row)
 Checks the given row in the given table.

Private Member Functions

int anyFieldPasses (TBTable *table, int row)
 Checks all fields in the given row.

Private Attributes

String field
 This rule's field.
Comparator comparator
 This rule's comparator.
TBDatavalue
 This rule's value.
TBDatavalue2
 This rule's second value.
bool isNot
 Indicates whether this rule is negated or not.
bool anyField
 Indicates whether this rule applies to any field or not.

Detailed Description

Rule that can be used to filter rows based upon field values.

Synopsis

A TBFilterRule is a single rule that consists of a field, a Comparator, and the rule parameters. A rule consists of one comparator and at least one value. A rule can be negated (i.e., "not equal"), or applied to any field (i.e., any field with a value > 5).

Definition at line 57 of file TBFilterRules.qo.h.


Constructor & Destructor Documentation

casa::TBFilterRule::TBFilterRule ( String  field,
Comparator  comparator,
TBData value,
TBData value2 = NULL,
bool  isNot = false,
bool  anyField = false 
)

Constructor that takes the rule parameters.

value should be the value being compared against; value2 can only be NULL if the comparator only takes one argument. isNot should be true for negated rules, false otherwise. anyField should be true if the rule applies to any field, false otherwise. The rule "owns" value and value2 in that, upon deletion, they are deleted as well.


Member Function Documentation

int casa::TBFilterRule::anyFieldPasses ( TBTable table,
int  row 
) [private]

Checks all fields in the given row.

If any of the fields pass, the index of the first field to pass is returned; otherwise, -1 is returned.

Returns true if this rule is equal to the given rule, false otherwise.

Returns true if this rule applies to any field, false otherwise.

Returns this rule's comparator.

Returns the field this rule applies to, or blank if it applies to any field.

Returns true if this rule is negated (i.e., "not equal" rather than "equal"), false otherwise.

Returns this rule's value.

Returns this rule's second value, or blank if it doesn't have one.

int casa::TBFilterRule::rowPasses ( TBTable table,
int  row 
)

Checks the given row in the given table.

If the row passes, the index of the first field to pass is returned; if the row does not pass, -1 is returned.


Member Data Documentation

Indicates whether this rule applies to any field or not.

Definition at line 117 of file TBFilterRules.qo.h.

This rule's comparator.

Definition at line 105 of file TBFilterRules.qo.h.

This rule's field.

Definition at line 102 of file TBFilterRules.qo.h.

bool casa::TBFilterRule::isNot [private]

Indicates whether this rule is negated or not.

Definition at line 114 of file TBFilterRules.qo.h.

This rule's value.

Definition at line 108 of file TBFilterRules.qo.h.

This rule's second value.

Definition at line 111 of file TBFilterRules.qo.h.


The documentation for this class was generated from the following file: