pianod2
multisource multiuser scriptable networked music player
Public Member Functions | List of all members
ListFilter Class Reference

Permuted filter, like Filter but constructed from a list of strings. More...

#include <filter.h>

Inheritance diagram for ListFilter:
Inheritance graph
[legend]
Collaboration diagram for ListFilter:
Collaboration graph
[legend]

Public Member Functions

 ListFilter (const std::vector< std::string > &items, Field search_target=Field::Search)
 Create a new list filter. More...
 
- Public Member Functions inherited from Filter
 Filter (void)
 
 Filter (const Filter &)=default
 
 Filter (Filter &&from_filter)=default
 
 Filter (const std::string &expression)
 Create a new filter from an expression. More...
 
 Filter (const MusicThingie *thing, const MusicThingie::Type type=MusicThingie::Type(0), const DuplicationFlags &manner=DuplicationFlags(true))
 Create a new filter. More...
 
Filteroperator= (const std::string &expression)
 Assign a new expression to a filter. More...
 
Filteroperator= (const Filter &filter)=default
 
Filteroperator= (Filter &&from_filter)=default
 
virtual ~Filter ()
 Destroy a filter. More...
 
template<typename MusicThing >
bool matches (const MusicThing *thing) const
 Check if a filter matches a song, album, artist or playlist. More...
 
bool canPersist (void) const
 
std::string toString () const
 Get a filter's expression. More...
 
template<>
bool matches (const MusicThingie *thing) const
 Specialization for matching to determine the type of thing being tested by the filter expression at run-time. More...
 
template<>
bool matches (const MusicThingie *thing) const
 

Additional Inherited Members

- Public Types inherited from Filter
enum class  Field {
  Invalid = 0 , Id , Artist , Album ,
  Type , Genre , Playlist , Title ,
  Search , Name , Year , Duration ,
  Lastplay , Track , Rating , Played ,
  Heard , Rated , UserRating , False ,
  Compilation , Count
}
 Fields on which comparisons can be done by the filter. More...
 
enum class  Action {
  Noop , And , Or , LessThan ,
  LessEqual , Equal , NotEqual , GreaterThan ,
  GreaterEqual , Match
}
 Filter operations; each node in the parse tree has one action indicating how to proceed. More...
 
using DuplicationFlags = EnumeratedArray< Field, bool >
 
using FilterRating = float
 
- Static Public Attributes inherited from Filter
static const unsigned FieldCount = static_cast <unsigned> (Field::Count)
 
static const Filter All
 Selects all tracks. More...
 
static const Filter None
 Selects nothing. More...
 
- Protected Types inherited from Filter
using Op = std::unique_ptr< Operation >
 Container for Operation, to ensure instances are cleaned up. More...
 
- Protected Member Functions inherited from Filter
const char * skipWhitespace (const char **const command)
 
std::string gatherString (const char **const command, const char *error_reason)
 Gather a string, either quoted or not, processing quote characters. More...
 
Op parseParenthesis (const char **const command)
 Handle (parenthesis in an expression). More...
 
Op parseComparison (const char **const command)
 Handle comparison or other base operator in expression. More...
 
Op parseSearch (const char **const command)
 Handle bare search term in expression. More...
 
Op parseNegation (const char **const command)
 Handle negation operator, then choose parenthesis or a comparison. More...
 
Op parseOr (const char **const command)
 Handle binary OR, either as | or ||. More...
 
Op parseAnd (const char **const command)
 Handle binary AND, either as & or &&. More...
 
- Protected Attributes inherited from Filter
std::shared_ptr< Operationparsetree
 
bool persistable = true
 Not true if user referenced or other problematic expressions. More...
 

Detailed Description

Permuted filter, like Filter but constructed from a list of strings.

The filter matches track data that contains any of the strings.

Constructor & Destructor Documentation

◆ ListFilter()

ListFilter::ListFilter ( const std::vector< std::string > &  items,
Field  search_target = Field::Search 
)

Create a new list filter.

Any* of the values causes match, not all (this is OR, not AND). Values must match exactly.

Parameters
itemsThe list of values to match.
search_targetThe field to match on.
Here is the call graph for this function:

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