#include <itunesdb.h>
Inheritance diagram for ITunesDBSPLRuleSet:
Public Member Functions | |
ITunesDBSPLRuleSet (const itunesdb::SmartPlaylistRuleSet &src, ITunesDBPlaylist &playlist, const ITunesDB &itunesdb) | |
ITunesDBSPLRuleSet (ITunesDBPlaylist &playlist, const ITunesDB &itunesdb) | |
virtual bool | addStringRule (itunesdb::SPLStringField field, itunesdb::SPLStringAction action, const QString &testString, int position=-1) |
virtual bool | addUIntRule (itunesdb::SPLUIntField field, itunesdb::SPLUIntAction action, Q_UINT64 fromValue, Q_UINT64 toValue, Q_INT64 fromDate, Q_INT64 toDate, Q_UINT64 fromUnits, Q_UINT64 toUnits, int position=-1) |
void | refreshPlaylist (bool force=false) |
bool | addUIntRule (SPLUIntField field, SPLUIntAction action, Q_UINT64 fromValue, Q_UINT64 toValue, int position=-1) |
bool | addInTheLastRule (SPLUIntField field, bool negateRule, Q_INT64 value, Q_UINT64 units, int position=-1) |
const SmartPlaylistRule * | getRuleAt (uint position) |
bool | removeRuleAt (uint position) |
void | clear () |
bool | isLiveUpdate () const |
void | setLiveUpdateFlag (bool liveupdate) |
bool | isCheckRules () const |
void | setCheckRulesFlag (bool checkRules) |
bool | isCheckLimits () const |
virtual void | setLimits (SPLLimitSort limitSort, SPLLimitType limitType, Q_UINT32 limitValue, bool reverseLimitSort=false) |
void | enableLimits (bool enable) |
SPLLimitSort | getLimitSort () const |
SPLLimitType | getLimitType () const |
bool | isMatchAny () const |
void | setMatchAnyFlag (bool matchAny) |
bool | checkedTracksOnly () const |
void | setCheckedTracksOnlyFlag (bool checkedOnly) |
const RuleList & | getRules () const |
uint | getNumRules () const |
QString | toString () const |
Protected Member Functions | |
virtual itunesdb::SmartPlaylistRule * | createStringRule (itunesdb::SPLStringField field, itunesdb::SPLStringAction action, const QString &testString) |
virtual itunesdb::SmartPlaylistRule * | createUIntRule (itunesdb::SPLUIntField field, itunesdb::SPLUIntAction action, Q_UINT64 fromValue, Q_UINT64 toValue, Q_INT64 fromDate, Q_INT64 toDate, Q_UINT64 fromUnits, Q_UINT64 toUnits) |
virtual bool | operator() (const itunesdb::Track *track) const |
uint | readRules (QDataStream &instream, uint length) |
bool | readHeader (QDataStream &instream, uint length) |
uint | writeRules (QDataStream &outstream) const |
uint | writeHeader (QDataStream &outstream) const |
Protected Attributes | |
bool | mMatchAny |
Q_UINT32 | unk5 |
Q_UINT8 | mLiveUpdate |
Q_UINT8 | mCheckLimits |
Q_UINT8 | mCheckRules |
Q_UINT8 | mCheckedOnly |
Q_UINT8 | mReverseLimitSort |
SPLLimitSort | mLimitSort |
SPLLimitType | mLimitType |
Q_UINT32 | mLimitValue |
RuleList | mRules |
itunesdb::SmartPlaylistRuleSet
for further information.
bool ITunesDBSPLRuleSet::operator() | ( | const itunesdb::Track * | track | ) | const [protected, virtual] |
Implement this method accordingly to the documentation above and (!) the documentation of the function this predicate will be given to.
Implements itunesdb::TrackPredicate.
bool ITunesDBSPLRuleSet::addStringRule | ( | itunesdb::SPLStringField | field, | |
itunesdb::SPLStringAction | action, | |||
const QString & | testString, | |||
int | position = -1 | |||
) | [virtual] |
adds a string based rule to the rule set and returns true if successful.
Reimplemented from itunesdb::SmartPlaylistRuleSet.
bool ITunesDBSPLRuleSet::addUIntRule | ( | itunesdb::SPLUIntField | field, | |
itunesdb::SPLUIntAction | action, | |||
Q_UINT64 | fromValue, | |||
Q_UINT64 | toValue, | |||
Q_INT64 | fromDate, | |||
Q_INT64 | toDate, | |||
Q_UINT64 | fromUnits, | |||
Q_UINT64 | toUnits, | |||
int | position = -1 | |||
) | [virtual] |
adds a uint based rule to the rule set and returns true if successful.
Reimplemented from itunesdb::SmartPlaylistRuleSet.
void ITunesDBSPLRuleSet::refreshPlaylist | ( | bool | force = false |
) |
Refreshes the playlist associated with this set of rules. If the database didn't change since the last refresh and force
is false the playlist won't be updated.
force | forces the rule set to update the playlist even if the database didn't change. |
bool itunesdb::SmartPlaylistRuleSet::addUIntRule | ( | SPLUIntField | field, | |
SPLUIntAction | action, | |||
Q_UINT64 | fromValue, | |||
Q_UINT64 | toValue, | |||
int | position = -1 | |||
) | [inline, inherited] |
Convenience method. This creates a UInt based rule setting the from and to values as provided and using sane defaults for the rest.
field | field ID to identify the track field in question | |
action | the compare operation to use | |
fromValue | the "from" value | |
toValue | the "to" value | |
position | the position the rule will be inserted to the rule set. Set to -1 to append the rule to the end |
bool itunesdb::SmartPlaylistRuleSet::addInTheLastRule | ( | SPLUIntField | field, | |
bool | negateRule, | |||
Q_INT64 | value, | |||
Q_UINT64 | units, | |||
int | position = -1 | |||
) | [inline, inherited] |
Convenience method. This creates a UInt based "In The Last" rule with the given parameters
field | field ID, to identify the field in question. | |
negateRule | if true, this negates the rule to "Not In The Last" | |
value | the time to evaluate; like in the last [WEEKS|DAYS|HOURS|etc] | |
units | the units the value is mesaured in; base is seconds. The Predefined values IN_THE_LAST_[SECONDS|DAYS|WEEKS] may be used | |
position | the position the rule will be inserted to the rule set. Set to -1 to append the rule to the end |
const SmartPlaylistRule* itunesdb::SmartPlaylistRuleSet::getRuleAt | ( | uint | position | ) | [inline, inherited] |
Returns the Rule at the specified position or NULL if no such rule exists.
position | the position |
bool itunesdb::SmartPlaylistRuleSet::removeRuleAt | ( | uint | position | ) | [inherited] |
Removes the rule at the specified position. The list will be compacted, so all the rules after the rule to be removed will be moved one position towards the start of the list.
position | the position to remove the rule from |
void itunesdb::SmartPlaylistRuleSet::clear | ( | ) | [inherited] |
Removes all the rule from this RuleSet
bool itunesdb::SmartPlaylistRuleSet::isLiveUpdate | ( | ) | const [inline, inherited] |
Returns true if the playlist may be updated by the iPod itself.
void itunesdb::SmartPlaylistRuleSet::setLiveUpdateFlag | ( | bool | liveupdate | ) | [inherited] |
Sets the live update flag.
bool itunesdb::SmartPlaylistRuleSet::isCheckRules | ( | ) | const [inline, inherited] |
Returns true if the smart playlist checks the rules
void itunesdb::SmartPlaylistRuleSet::setCheckRulesFlag | ( | bool | checkRules | ) | [inherited] |
Set the checkRules flag.
bool itunesdb::SmartPlaylistRuleSet::isCheckLimits | ( | ) | const [inline, inherited] |
Returns true if the limits will/need_to be checked
void itunesdb::SmartPlaylistRuleSet::setLimits | ( | SPLLimitSort | limitSort, | |
SPLLimitType | limitType, | |||
Q_UINT32 | limitValue, | |||
bool | reverseLimitSort = false | |||
) | [virtual, inherited] |
Sets the limit for this smart playlist and enable limit checking
void itunesdb::SmartPlaylistRuleSet::enableLimits | ( | bool | enable | ) | [inherited] |
enables or disables limit checking.
SPLLimitSort itunesdb::SmartPlaylistRuleSet::getLimitSort | ( | ) | const [inline, inherited] |
returns the limit sort field
SPLLimitType itunesdb::SmartPlaylistRuleSet::getLimitType | ( | ) | const [inline, inherited] |
Returns the limit type
bool itunesdb::SmartPlaylistRuleSet::isMatchAny | ( | ) | const [inline, inherited] |
Returns true if only one rule needs to match.
void itunesdb::SmartPlaylistRuleSet::setMatchAnyFlag | ( | bool | matchAny | ) | [inherited] |
Sets the "match any" flag
bool itunesdb::SmartPlaylistRuleSet::checkedTracksOnly | ( | ) | const [inline, inherited] |
Returns true if only "checked" tracks should be matched against the rules.
void itunesdb::SmartPlaylistRuleSet::setCheckedTracksOnlyFlag | ( | bool | checkedOnly | ) | [inherited] |
sets the checkedTracksOnlyFlag.
checkedOnly | If set to true only "checked" tracks should be matched against the rules. |
const itunesdb::RuleList & itunesdb::SmartPlaylistRuleSet::getRules | ( | ) | const [inherited] |
Returns the rules making up this smart playlist rule set.
uint itunesdb::SmartPlaylistRuleSet::getNumRules | ( | ) | const [inherited] |
Returns the number of rules
QString itunesdb::SmartPlaylistRuleSet::toString | ( | ) | const [inherited] |
Returns a String representation of this rule set.
uint itunesdb::SmartPlaylistRuleSet::readRules | ( | QDataStream & | instream, | |
uint | length | |||
) | [protected, inherited] |
read Rules from type 51 MHOD data, starting at SLst and returns the number of rules read
instream | the stream to read from positioned at the MHOD data | |
length | the MHOD data length in bytes (blocklen - headerlen) |
bool itunesdb::SmartPlaylistRuleSet::readHeader | ( | QDataStream & | instream, | |
uint | length | |||
) | [protected, inherited] |
reads the SPL Header from a type 50 MHOD and returns if the operation succeeded.
instream | the stream to read from positioned at the MHOD data | |
length | the MHOD data length in bytes (blocklen - headerlen) |
uint itunesdb::SmartPlaylistRuleSet::writeRules | ( | QDataStream & | outstream | ) | const [protected, inherited] |
Writes the rules back to the stream and returns the number of bytes written.
outstream | the stream to write the MHOD51 data to. |
uint itunesdb::SmartPlaylistRuleSet::writeHeader | ( | QDataStream & | outstream | ) | const [protected, inherited] |
Writes the header to the stream as a type 50 MHOD and returns the number of bytes written.
outstream | the stream to write the MHOD50 data to. |