2
* This file is part of nzbget
4
* Copyright (C) 2013 Andrey Prygunkov <hugbug@users.sourceforge.net>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* $Date: 2014-02-24 23:11:14 +0100 (Mon, 24 Feb 2014) $
29
#include "DownloadInfo.h"
36
typedef std::deque<char*> RefValues;
57
ETermCommand m_eCommand;
59
long long m_iIntParam;
63
RefValues* m_pRefValues;
65
bool GetFieldData(const char* szField, FeedItemInfo* pFeedItemInfo,
66
const char** StrValue, long long* IntValue);
67
bool ParseParam(const char* szField, const char* szParam);
68
bool ParseSizeParam(const char* szParam);
69
bool ParseAgeParam(const char* szParam);
70
bool ParseNumericParam(const char* szParam);
71
bool MatchValue(const char* szStrValue, long long iIntValue);
72
bool MatchText(const char* szStrValue);
73
bool MatchRegex(const char* szStrValue);
74
void FillWildMaskRefValues(const char* szStrValue, WildMask* pMask, int iRefOffset);
75
void FillRegExRefValues(const char* szStrValue, RegEx* pRegEx);
80
void SetRefValues(RefValues* pRefValues) { m_pRefValues = pRefValues; }
81
bool Compile(char* szToken);
82
bool Match(FeedItemInfo* pFeedItemInfo);
83
ETermCommand GetCommand() { return m_eCommand; }
86
typedef std::deque<Term*> TermList;
101
ERuleCommand m_eCommand;
109
char* m_szAddDupeKey;
110
EDupeMode m_eDupeMode;
115
bool m_bHasAddPriority;
117
bool m_bHasDupeScore;
118
bool m_bHasAddDupeScore;
120
bool m_bHasAddDupeKey;
124
bool m_bPatAddDupeKey;
127
char* m_szPatCategory;
128
char* m_szPatDupeKey;
129
char* m_szPatAddDupeKey;
131
RefValues m_RefValues;
133
char* CompileCommand(char* szRule);
134
char* CompileOptions(char* szRule);
135
bool CompileTerm(char* szTerm);
136
bool MatchExpression(FeedItemInfo* pFeedItemInfo);
141
void Compile(char* szRule);
142
bool IsValid() { return m_bIsValid; }
143
ERuleCommand GetCommand() { return m_eCommand; }
144
const char* GetCategory() { return m_szCategory; }
145
int GetPriority() { return m_iPriority; }
146
int GetAddPriority() { return m_iAddPriority; }
147
bool GetPause() { return m_bPause; }
148
const char* GetDupeKey() { return m_szDupeKey; }
149
const char* GetAddDupeKey() { return m_szAddDupeKey; }
150
int GetDupeScore() { return m_iDupeScore; }
151
int GetAddDupeScore() { return m_iAddDupeScore; }
152
EDupeMode GetDupeMode() { return m_eDupeMode; }
153
const char* GetRageId() { return m_szRageId; }
154
const char* GetSeries() { return m_szSeries; }
155
bool HasCategory() { return m_bHasCategory; }
156
bool HasPriority() { return m_bHasPriority; }
157
bool HasAddPriority() { return m_bHasAddPriority; }
158
bool HasPause() { return m_bHasPause; }
159
bool HasDupeScore() { return m_bHasDupeScore; }
160
bool HasAddDupeScore() { return m_bHasAddDupeScore; }
161
bool HasDupeKey() { return m_bHasDupeKey; }
162
bool HasAddDupeKey() { return m_bHasAddDupeKey; }
163
bool HasDupeMode() { return m_bHasDupeMode; }
164
bool HasRageId() { return m_bHasRageId; }
165
bool HasSeries() { return m_bHasSeries; }
166
bool Match(FeedItemInfo* pFeedItemInfo);
167
void ExpandRefValues(FeedItemInfo* pFeedItemInfo, char** pDestStr, char* pPatStr);
168
const char* GetRefValue(FeedItemInfo* pFeedItemInfo, const char* szVarName);
171
typedef std::deque<Rule*> RuleList;
176
void Compile(const char* szFilter);
177
void CompileRule(char* szRule);
178
void ApplyOptions(Rule* pRule, FeedItemInfo* pFeedItemInfo);
181
FeedFilter(const char* szFilter);
183
void Match(FeedItemInfo* pFeedItemInfo);