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.cpp | |
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.cpp')
-rw-r--r-- | src/parsers/parsers.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/parsers/parsers.cpp b/src/parsers/parsers.cpp new file mode 100644 index 0000000..2f959ce --- /dev/null +++ b/src/parsers/parsers.cpp @@ -0,0 +1,64 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +#include "parsers.h" + +#include <kuserprofile.h> + +#include <kio/slavebase.h> +#include <qhtmlstream.h> +#include <qregexp.h> + +#include <stdlib.h> + +namespace Parsers +{ + static void print_czstring(KIO::SlaveBase& slave, const char* data, int len) + { + QByteArray nonull; + nonull.setRawData(data, len); + slave.data(nonull); + nonull.resetRawData(data, len); + } + void operator << (KIO::SlaveBase& slave, const QCString& string) + { print_czstring(slave, string.data(), string.size() - 1); } + void operator << (KIO::SlaveBase& slave, const QString& string) + { slave << string.utf8(); } + void operator << (KIO::SlaveBase& slave, const char* string) + { print_czstring(slave, string, strlen(string)); } + + + + Parser::Parser( ) {} + Parser::~Parser( ) {} + + void Parser::attribute_begin(QHtmlStream& stream, const QString& text) + { + stream + << block("tr") << endl + << block("td") << param("class") << "attname" << data() + << text + << close() << endl + << block("td"); + } + void Parser::attribute_end(QHtmlStream& stream) + { stream << close() << endl << close(); } + +// void Parser::operator ( )( KIO::SlaveBase * /*slave*/, +// const QString & /*tag*/, const QString & /*value*/ ) +// {} + + QString mangle_version(QString version) + { return "version_" + version.replace(QRegExp("[-:\\.\\+]"), QString("_")); } + +} + + + |