Cute Chess  0.1
Public Types | Public Member Functions | List of all members
PgnGameFilter Class Reference

A filter for chess games in a PGN database. More...

#include <pgngamefilter.h>

Public Types

enum  Result {
  AnyResult, EitherPlayerWins, WhiteWins, BlackWins,
  FirstPlayerWins, FirstPlayerLoses, Draw, Unfinished
}
 
enum  Type { FixedString, Advanced }
 

Public Member Functions

const char * event () const
 
bool isResultInverted () const
 
const QDate & maxDate () const
 
int maxRound () const
 
const QDate & minDate () const
 
int minRound () const
 
const char * opponent () const
 
const char * pattern () const
 
 PgnGameFilter ()
 
 PgnGameFilter (const QString &pattern)
 
const char * player () const
 
Chess::Side playerSide () const
 
Result result () const
 
void setEvent (const QString &event)
 
void setMaxDate (const QDate &date)
 
void setMaxRound (int round)
 
void setMinDate (const QDate &date)
 
void setMinRound (int round)
 
void setOpponent (const QString &name)
 
void setPattern (const QString &pattern)
 
void setPlayer (const QString &name, Chess::Side side)
 
void setResult (Result result)
 
void setResultInverted (bool invert)
 
void setSite (const QString &site)
 
const char * site () const
 
Type type () const
 

Detailed Description

A filter for chess games in a PGN database.

A PgnGameFilter object can be used to filter games in a PGN database by matching the filtering terms to the games' PGN tags.

See also
PgnGameEntry

Member Enumeration Documentation

The result of the game.

Enumerator
AnyResult 

Any result (no filtering)

EitherPlayerWins 

Either player wins.

WhiteWins 

The white player wins.

BlackWins 

The black player wins.

FirstPlayerWins 

The first player wins.

FirstPlayerLoses 

The first player loses.

Draw 

The game is a draw.

Unfinished 

The game wasn't completed.

The type of the filter.

Enumerator
FixedString 

Filter all tags with a single fixed string.

Advanced 

Use invididual filtering terms for each tag.

Constructor & Destructor Documentation

PgnGameFilter::PgnGameFilter ( )

Creates a new empty filter.

An empty filter will not filter out any games. The filter's type is Advanced.

PgnGameFilter::PgnGameFilter ( const QString pattern)

Creates a new filter based on a fixed string.

Games that have tags matching pattern will be filtered in. The filter's type is FixedString.

Member Function Documentation

const char * PgnGameFilter::event ( ) const
inline

Returns the filter for the Event tag.

bool PgnGameFilter::isResultInverted ( ) const
inline

Returns true if the filter is looking for the inverse of result(); otherwise returns false.

const QDate & PgnGameFilter::maxDate ( ) const
inline

Returns the filter for the game's maximum starting date.

Note
A null QDate won't filter out any games.
int PgnGameFilter::maxRound ( ) const
inline

Returns the filter for the maximum round ordinal.

const QDate & PgnGameFilter::minDate ( ) const
inline

Returns the filter for the game's minimum starting date.

Note
A null QDate won't filter out any games.
int PgnGameFilter::minRound ( ) const
inline

Returns the filter for the minimum round ordinal.

const char * PgnGameFilter::opponent ( ) const
inline

Returns the filter for the opponent of the first player.

const char * PgnGameFilter::pattern ( ) const
inline

Returns the pattern for FixedString mode.

const char * PgnGameFilter::player ( ) const
inline

Returns the filter for the first player.

The first player's side/color is determined by the playerSide() member function.

Chess::Side PgnGameFilter::playerSide ( ) const
inline

Returns the filter for the side/color of the first player.

PgnGameFilter::Result PgnGameFilter::result ( ) const
inline

Returns the filter for the Result tag.

void PgnGameFilter::setEvent ( const QString event)

Sets the Event tag filter to event.

void PgnGameFilter::setMaxDate ( const QDate &  date)

Sets the maximum starting date filter to date.

void PgnGameFilter::setMaxRound ( int  round)

Sets the maximum round ordinal filter to round.

void PgnGameFilter::setMinDate ( const QDate &  date)

Sets the minimum starting date filter to date.

void PgnGameFilter::setMinRound ( int  round)

Sets the minimum round ordinal filter to round.

void PgnGameFilter::setOpponent ( const QString name)

Sets the first player's opponent filter to name.

void PgnGameFilter::setPattern ( const QString pattern)

Sets the FixedString pattern to pattern.

This function will change the filter type to FixedString.

void PgnGameFilter::setPlayer ( const QString name,
Chess::Side  side 
)

Sets the side player's filter to name.

void PgnGameFilter::setResult ( Result  result)

Sets the Result tag filter to result.

void PgnGameFilter::setResultInverted ( bool  invert)

Sets the resultInverted value to invert.

void PgnGameFilter::setSite ( const QString site)

Sets the Site tag filter to site.

const char * PgnGameFilter::site ( ) const
inline

Returns the filter for the Site tag.

PgnGameFilter::Type PgnGameFilter::type ( ) const
inline

Returns the type of the filter.


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