You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdeio-apt/src/parsers/parsers.cpp

65 lines
2.0 KiB

/***************************************************************************
* Copyright (C) 2003 by Sylvain Joyeux *
* sylvain.joyeux@m4x.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. *
***************************************************************************/
#include "parsers.h"
#include <kuserprofile.h>
#include <tdeio/slavebase.h>
#include <qhtmlstream.h>
#include <tqregexp.h>
#include <stdlib.h>
namespace Parsers
{
static void print_czstring(TDEIO::SlaveBase& slave, const char* data, int len)
{
TQByteArray nonull;
nonull.setRawData(data, len);
slave.data(nonull);
nonull.resetRawData(data, len);
}
void operator << (TDEIO::SlaveBase& slave, const TQCString& string)
{ print_czstring(slave, string.data(), string.size() - 1); }
void operator << (TDEIO::SlaveBase& slave, const TQString& string)
{ slave << string.utf8(); }
void operator << (TDEIO::SlaveBase& slave, const char* string)
{ print_czstring(slave, string, strlen(string)); }
Parser::Parser( ) {}
Parser::~Parser( ) {}
void Parser::attribute_begin(TQHtmlStream& stream, const TQString& text)
{
stream
<< block("tr") << endl
<< block("td") << param("class") << "attname" << data()
<< text
<< close() << endl
<< block("td");
}
void Parser::attribute_end(TQHtmlStream& stream)
{ stream << close() << endl << close(); }
// void Parser::operator ( )( TDEIO::SlaveBase * /*slave*/,
// const TQString & /*tag*/, const TQString & /*value*/ )
// {}
TQString mangle_version(TQString version)
{ return "version_" + version.replace(TQRegExp("[-:\\.\\+]"), TQString("_")); }
}