diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-10 20:23:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-10 20:23:29 +0000 |
commit | ea4406b4779306f4d0c65f0619cd8241bbdcef7b (patch) | |
tree | a63d24ddd768559eb993d9bb847acbc3750ef261 /src/parsers/parsers.h | |
download | tdeio-apt-ea4406b4779306f4d0c65f0619cd8241bbdcef7b.tar.gz tdeio-apt-ea4406b4779306f4d0c65f0619cd8241bbdcef7b.zip |
Added abandoned version of kio-apt
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kio-apt@1088432 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/parsers/parsers.h')
-rw-r--r-- | src/parsers/parsers.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/parsers/parsers.h b/src/parsers/parsers.h new file mode 100644 index 0000000..26e0113 --- /dev/null +++ b/src/parsers/parsers.h @@ -0,0 +1,91 @@ +/*************************************************************************** + * Copyright (C) 2003 by Sylvain Joyeux * + * [email protected] * + * * + * 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. * + ***************************************************************************/ + +#ifndef PARSERS_H +#define PARSERS_H + +#include <qstring.h> + +namespace KIO +{ + class SlaveBase; +} +class QHtmlStream; +class AptProtocol; + +/** Here are defined the functional objects that takes the tokens + * sent by AptCache and PackageManager objects, and produces HTML */ +namespace Parsers +{ + class Parser + { + protected: + int m_result_count; + + static void attribute_begin(QHtmlStream& stream, const QString& text); + static void attribute_end(QHtmlStream& stream); + + public: + Parser(); + virtual ~Parser(); + int result_count() const { return m_result_count; } + virtual void operator () (AptProtocol* slave, const QString& tag, const QString& value) = 0; + }; + + class Search : public Parser + { + public: + void operator () (AptProtocol* slave, const QString& tag, const QString& value); + }; + + class List : public Parser + { + bool m_links; + public: + List(bool show_links); + void operator () (AptProtocol* slave, const QString& tag, const QString& value); + }; + + class FileSearch : public Parser + { + public: + void operator () (AptProtocol* slave, const QString& tag, const QString& value); + }; + + class Show : public Parser + { + QString m_package, m_installed; + bool m_act; + + public: + Show(const QString& package, const QString& installed, bool act); + void operator () (AptProtocol* slave, const QString& tag, const QString& value); + }; + + class Policy : public Parser + { + QString m_package, m_installed; + bool m_has_adept_batch; + bool m_act; + + public: + Policy(const QString& package, bool act); + QString getInstalled() const { return m_installed; } + void operator () (AptProtocol* slave, const QString& tag, const QString& value); + }; + + void operator << (KIO::SlaveBase& slave, const QCString& string); + void operator << (KIO::SlaveBase& slave, const QString& string); + void operator << (KIO::SlaveBase& slave, const char* string); + + QString mangle_version(QString version); +} + +#endif |