QBuffer.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        i/o device working with memory                         *
00004 *                                                                               *
00005 *********************************************************************************
00006 *        Copyright (C) 2003 by Niall Douglas.   All Rights Reserved.            *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 #ifndef QBUFFER_H
00023 #define QBUFFER_H
00024 
00025 #include "QIODevice.h"
00026 
00031 namespace FX {
00032 
00033 class QByteArray;
00034 
00055 struct QBufferPrivate;
00056 class FXAPIR QBuffer : public QIODevice
00057 {
00058     QBufferPrivate *p;
00059     QBuffer(const QBuffer &);
00060     QBuffer &operator=(const QBuffer &);
00061 public:
00066     explicit QBuffer(FXuval len=0, bool fastbuffer=false);
00068     explicit QBuffer(QByteArray &buffer);
00069     ~QBuffer();
00071     bool isNull() const;
00073     QByteArray &buffer() const;
00075     void setBuffer(QByteArray &buffer);
00076 
00077     virtual bool open(FXuint mode);
00078     virtual void close();
00079     virtual void flush();
00080     virtual FXfval size() const;
00081     virtual void truncate(FXfval size);
00082     virtual FXuval readBlock(char *data, FXuval maxlen);
00083     virtual FXuval writeBlock(const char *data, FXuval maxlen);
00084     virtual FXuval readBlockFrom(char *data, FXuval maxlen, FXfval pos);
00085     virtual FXuval writeBlockTo(FXfval pos, const char *data, FXuval maxlen);
00086     virtual int getch();
00087     virtual int putch(int c);
00088     virtual int ungetch(int c);
00089     friend FXAPI FXStream &operator<<(FXStream &s, const QBuffer &i);
00090     friend FXAPI FXStream &operator>>(FXStream &s, QBuffer &i);
00091 };
00092 
00096 FXAPI FXStream &operator<<(FXStream &s, const QBuffer &i);
00100 FXAPI FXStream &operator>>(FXStream &s, QBuffer &i);
00101 
00102 }
00103 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:25 2009 for TnFOX by doxygen v1.4.7