iodeviceseq_qt.hpp

Go to the documentation of this file.
00001 /*
00002  !concept {:name => "QIODevice input device composing sub-QIODevices",
00003    :desc => "An abstraction for reading sequentially from multiple QIODevices."}
00004 */
00005 
00006 #ifndef __iodeviceseq_qt_hpp__
00007 #define __iodeviceseq_qt_hpp__
00008 
00009 #include <QIODevice>
00010 #include <QList>
00011 #include <QListIterator>
00012 
00013 // A composition of QIODevices, itself a QIODevice.
00014 // Sequentially reads data from each of the devices.
00015 // http://doc.qt.nokia.com/latest/qiodevice.html
00016 class QIODeviceSeq :
00017   public QIODevice
00018 {
00019   Q_OBJECT
00020 
00021  public:
00022   // Note that QList is a shared class, and hence passing like this is
00023   // efficient. Note that both QFile and QBuffer are subclasses of
00024   // QIODevice. Ownership of list elements is not taken. Devices must
00025   // be initialized and ready for reading.
00026   QIODeviceSeq(const QList<QIODevice*>& aList);
00027   ~QIODeviceSeq();
00028 
00029  private:
00030   QList<QIODevice*> iList;
00031   QListIterator<QIODevice*> iIterator;
00032   QIODevice* iDevice;
00033   bool iAtEnd;
00034 
00035 public: // QIODevice
00036   virtual bool isSequential() const;
00037   virtual qint64 readData(char *data, qint64 maxlen);
00038   virtual qint64 writeData(const char *data, qint64 len);
00039   virtual bool atEnd() const;
00040 };
00041 
00042 #endif /* __iodeviceseq_qt_hpp__ */
00043 
00044 /**
00045 
00046 Copyright 2010 Helsinki Institute for Information Technology (HIIT)
00047 and the authors. All rights reserved.
00048 
00049 Authors: Tero Hasu <tero.hasu@hut.fi>
00050 
00051 Permission is hereby granted, free of charge, to any person
00052 obtaining a copy of this software and associated documentation files
00053 (the "Software"), to deal in the Software without restriction,
00054 including without limitation the rights to use, copy, modify, merge,
00055 publish, distribute, sublicense, and/or sell copies of the Software,
00056 and to permit persons to whom the Software is furnished to do so,
00057 subject to the following conditions:
00058 
00059 The above copyright notice and this permission notice shall be
00060 included in all copies or substantial portions of the Software.
00061 
00062 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00063 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00064 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00065 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00066 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00067 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00068 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00069 SOFTWARE.
00070 
00071  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:54 2011 by Doxygen 1.6.1