/usr/include/kmldonkey/searchquery.h is in kmldonkey 4:2.0.5+kde4.3.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | /* -*- c++ -*-
*
* searchquery.h
*
* Copyright (C) 2003-2004 Petter Stokke <ummo@hellokitty.com>
* Copyright (C) 2003-2004 Sebastian Sauer <mail@dipe.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __libkmldonkey_searchquery_h__
#define __libkmldonkey_searchquery_h__
#include <QString>
#include <QList>
#include <kmldonkey_export.h>
class DonkeyMessage;
//! Base class for query operations.
class KMLDONKEY_EXPORT SearchQuery
{
public:
enum Operation {
And = 0,
Or,
AndNot,
Module,
Keywords,
MinSize,
MaxSize,
Format,
Media,
Mp3Artist,
Mp3Title, // 10
Mp3Album,
Mp3Bitrate,
Hidden
};
SearchQuery(Operation op);
virtual ~SearchQuery();
Operation operation();
void setOperation(Operation op);
//! Returns the SearchQuery as QueryString
virtual const QString getQuerystring();
//! Write this query into a DonkeyMessage.
/*! \param msg The message to write to. */
virtual void writeQuery(DonkeyMessage& msg);
//! Returns a SearchQuery matching to the given DonkeryMessage.
/*! \param msg The DonkeyMessage.
\return SearchQuery-instance. */
static SearchQuery* getQuery(DonkeyMessage* msg);
//! Returns a SearchQuery matching to the given QueryString.
/*! \param querystring The Querystring (see getQuerystring()).
\return SearchQuery-instance. */
static SearchQuery* getQuery(const QString& querystring);
protected:
Operation Op;
};
//! A base class for queries containing a list of other queries.
class KMLDONKEY_EXPORT SearchQueryList : public SearchQuery
{
public:
SearchQueryList(Operation op);
~SearchQueryList();
//! Append a query to the list.
/*! Queries appended to the query list are owned by the list, and will be freed along with it.
* \param q The query to append.
* \return A pointer to the list. Useful for code like <tt>query->append(foo)->append(bar)->append(baz)</tt>.
*/
SearchQueryList* append(SearchQuery* q);
//! Returns the size of the attached list of queries.
/*! \return The number of queries in this query list. */
uint count();
//! Returns a pointer to the query at a given index in the list.
/*! \param index The index of the query to retrieve.
* \return Pointer to the query at the given index.
*/
SearchQuery* at(uint index);
//! Detaches a query from the list.
/*! This method removes a query from the query list and returns a pointer to it.
* When you remove a query, you are responsible for freeing it. The list will no longer take care of this.
* \param index The index of the query to detach.
* \return The detached query.
*/
SearchQuery* take(uint index);
virtual const QString getQuerystring();
//! Write this query (with its attached queries) into a DonkeyMessage.
/*! \param msg The message to write to. */
virtual void writeQuery(DonkeyMessage& msg);
protected:
const QString toQueryString(const QString& joinstr);
private:
QList<SearchQuery *> queryList;
};
//! A query containing a list of subqueries that must all match.
class KMLDONKEY_EXPORT QueryAnd : public SearchQueryList
{
public:
QueryAnd();
virtual const QString getQuerystring();
};
//! A query containing a list of subqueries of which at least one must match.
class KMLDONKEY_EXPORT QueryOr : public SearchQueryList
{
public:
QueryOr();
virtual const QString getQuerystring();
};
class KMLDONKEY_EXPORT QueryHidden : public SearchQueryList
{
public:
QueryHidden();
virtual const QString getQuerystring();
};
class KMLDONKEY_EXPORT QueryAndNot : public SearchQuery
{
public:
QueryAndNot(SearchQuery* q1, SearchQuery* q2);
~QueryAndNot();
SearchQuery* getQueryAnd() { return query1; }
SearchQuery* getQueryNot() { return query2; }
virtual const QString getQuerystring();
virtual void writeQuery(DonkeyMessage& msg);
private:
SearchQuery *query1, *query2;
};
class KMLDONKEY_EXPORT QueryModule : public SearchQuery
{
public:
QueryModule(QString str, SearchQuery* q);
~QueryModule();
const QString& getName() { return string; }
SearchQuery* getQuery() { return query; }
virtual const QString getQuerystring();
virtual void writeQuery(DonkeyMessage& msg);
private:
QString string;
SearchQuery* query;
};
class KMLDONKEY_EXPORT SearchQueryTwoStrings : public SearchQuery
{
public:
SearchQueryTwoStrings(Operation op, QString str1, QString str2);
QString getKey() { return s1; }
void setKey(const QString& key) { s1 = key; }
QString getValue() { return s2; }
void setValue(const QString& value) { s2 = value; }
virtual const QString getQuerystring();
virtual void writeQuery(DonkeyMessage& msg);
protected:
QString s1, s2;
};
//! A query that specifies keywords to match.
class KMLDONKEY_EXPORT QueryKeywords : public SearchQueryTwoStrings
{
public:
QueryKeywords(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that defines a minimum file size that must be matched.
class KMLDONKEY_EXPORT QueryMinSize : public SearchQueryTwoStrings
{
public:
QueryMinSize(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that defines a maximum file size that must be matched.
class KMLDONKEY_EXPORT QueryMaxSize : public SearchQueryTwoStrings
{
public:
QueryMaxSize(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies a file format to match.
class KMLDONKEY_EXPORT QueryFormat : public SearchQueryTwoStrings
{
public:
QueryFormat(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies a media type to match.
class KMLDONKEY_EXPORT QueryMedia : public SearchQueryTwoStrings
{
public:
QueryMedia(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies an ID3 artist tag for MP3 files.
class KMLDONKEY_EXPORT QueryMp3Artist : public SearchQueryTwoStrings
{
public:
QueryMp3Artist(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies an ID3 title tag for MP3 files.
class KMLDONKEY_EXPORT QueryMp3Title : public SearchQueryTwoStrings
{
public:
QueryMp3Title(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies an ID3 album tag for MP3 files.
class KMLDONKEY_EXPORT QueryMp3Album : public SearchQueryTwoStrings
{
public:
QueryMp3Album(QString str1, QString str2);
virtual const QString getQuerystring();
};
//! A query that specifies a given MP3 bitrate to match.
class KMLDONKEY_EXPORT QueryMp3Bitrate : public SearchQueryTwoStrings
{
public:
QueryMp3Bitrate(QString str1, QString str2);
virtual const QString getQuerystring();
};
#endif
|