/usr/include/k3bactivepipe.h is in libk3b-dev 2.0.3-0ubuntu5.
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 | /*
*
* Copyright (C) 2006-2008 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.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.
* See the file "COPYING" for the exact licensing terms.
*/
#ifndef _K3B_ACTIVE_PIPE_H_
#define _K3B_ACTIVE_PIPE_H_
#include "k3b_export.h"
#include <QtCore/QIODevice>
namespace K3b {
/**
* The active pipe pumps data from a source to a sink using an
* additional thread.
*
* The active pumping is only performed if both the source and sink
* QIODevices are set. Otherwise the pipe only serves as a conduit for
* data streams. The latter is mostly interesting when using the ChecksumPipe
* in combination with a Job that can only push data (like the DataTrackReader).
*/
class LIBK3B_EXPORT ActivePipe : public QIODevice
{
Q_OBJECT
public:
ActivePipe();
virtual ~ActivePipe();
/**
* Opens the pipe and thus starts the
* pumping.
*
* \param closeWhenDone If true the pipes will be closed
* once all data has been read.
*/
virtual bool open( bool closeWhenDone = false );
/**
* Close the pipe
*/
virtual void close();
/**
* Read from a QIODevice instead of a file descriptor.
* The device will be opened QIODevice::ReadOnly and closed
* afterwards.
*
* \param close If true the device will be closed once close() is called.
*/
void readFrom( QIODevice* dev, bool close = false );
/**
* Write to a QIODevice instead of using the readyRead signal.
* The device will be opened QIODevice::WriteOnly and closed
* afterwards.
*
* \param close If true the device will be closed once close() is called.
*/
void writeTo( QIODevice* dev, bool close = false );
/**
* The number of bytes that have been read.
*/
quint64 bytesRead() const;
/**
* The number of bytes that have been written.
*/
quint64 bytesWritten() const;
protected:
/**
* Reads the data from the source.
* The default implementation reads from the file desc
* set via readFromFd or from in()
*/
virtual qint64 readData( char* data, qint64 max );
/**
* Write the data to the sink.
* The default implementation writes to the file desc
* set via writeToFd or out()
*
* Can be reimplememented to further process the data.
*/
virtual qint64 writeData( const char* data, qint64 max );
/**
* Hidden open method. Use open(bool).
*/
bool open( OpenMode mode );
private:
class Private;
Private* d;
Q_PRIVATE_SLOT( d, void _k3b_close() )
};
}
#endif
|