KDECore
k3iobuffer.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 * Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org> 00003 * 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining 00006 * a copy of this software and associated documentation files (the 00007 * "Software"), to deal in the Software without restriction, including 00008 * without limitation the rights to use, copy, modify, merge, publish, 00009 * distribute, sublicense, and/or sell copies of the Software, and to 00010 * permit persons to whom the Software is furnished to do so, subject to 00011 * the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included 00014 * in all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00017 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00019 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00020 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00021 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00022 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 #ifndef KIOBUFFER_H 00026 #define KIOBUFFER_H 00027 00028 #include <kdecore_export.h> 00029 #include <QtCore/QByteArray> 00030 00031 00044 class KDECORE_EXPORT KIOBufferBase //krazy:exclude=inline (mainly virtual; simple implementations; KDE3 compat) 00045 { 00046 public: 00050 KIOBufferBase() 00051 { } 00052 00056 KIOBufferBase(const KIOBufferBase& ) 00057 { } 00058 00062 virtual ~KIOBufferBase() 00063 { } 00064 00068 KIOBufferBase& operator=(const KIOBufferBase& ) 00069 { return *this; } 00070 00074 virtual bool canReadLine() const = 0; 00075 00079 virtual qint64 readLine(char* data, qint64 maxlen) = 0; 00080 00087 virtual qint64 length() const = 0; 00088 00092 inline bool isEmpty() const 00093 { return length() == 0; } 00094 00101 virtual qint64 size() const = 0; 00102 00106 inline bool isFull() const 00107 { return size() != -1 && size() == length(); } 00108 00116 virtual bool setSize(qint64 size) = 0; 00117 00125 virtual qint64 feedBuffer(const char *data, qint64 len) = 0; 00126 00135 virtual qint64 consumeBuffer(char *data, qint64 maxlen, bool discard = true) = 0; 00136 00140 virtual void clear() = 0; 00141 }; 00142 00143 #endif
KDE 4.6 API Reference