Commit cd6f369f authored by Pino Toscano's avatar Pino Toscano

add an internal function to "pump" to the content of a QIODevice to another one

svn path=/trunk/KDE/kdegraphics/okular/; revision=884563
parent acab77c6
/***************************************************************************
* Copyright (C) 2006 by Luigi Toscano <luigi.toscano@tiscali.it> *
* Copyright (C) 2008 by Pino Toscano <pino@kde.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 *
......@@ -8,9 +9,11 @@
***************************************************************************/
#include "utils.h"
#include "utils_p.h"
#include <QtCore/QRect>
#include <QImage>
#include <QIODevice>
#ifdef Q_WS_X11
#include <QX11Info>
......@@ -210,3 +213,16 @@ got_bottom:
return bbox;
}
void Okular::copyQIODevice( QIODevice *from, QIODevice *to )
{
QByteArray buffer( 65536, '\0' );
qint64 read = 0;
qint64 written = 0;
while ( ( read = from->read( buffer.data(), buffer.size() ) ) > 0 )
{
written = to->write( buffer.constData(), read );
if ( read != written )
break;
}
}
/***************************************************************************
* Copyright (C) 2008 by Pino Toscano <pino@kde.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. *
***************************************************************************/
#ifndef _OKULAR_UTILS_P_H_
#define _OKULAR_UTILS_P_H_
class QIODevice;
namespace Okular
{
void copyQIODevice( QIODevice *from, QIODevice *to );
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment