kiobuffer.h
/* -*- C++ -*-
* Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef KIOBUFFER_H
#define KIOBUFFER_H
#include <qcstring.h>
#include <kdelibs_export.h>
class QIODevice;
class KIOBufferBase
{
public:
KIOBufferBase()
{ }
KIOBufferBase(const KIOBufferBase& )
{ }
virtual ~KIOBufferBase()
{ }
KIOBufferBase& operator=(const KIOBufferBase& )
{ return *this; }
virtual bool canReadLine() const = 0;
virtual QCString readLine() = 0;
virtual Q_LONG length() const = 0;
inline bool isEmpty() const
{ return length() == 0; }
virtual Q_LONG size() const = 0;
inline bool isFull() const
{ return size() != -1 && size() == length(); }
virtual bool setSize(Q_LONG size) = 0;
virtual Q_LONG feedBuffer(const char *data, Q_LONG len) = 0;
virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard = true) = 0;
virtual void clear() = 0;
};
#endif
KIOBufferBase::clear
virtual void clear()=0
Clears the buffer.
KIOBufferBase::setSize
virtual bool setSize(Q_LONG size)=0
Sets the size of the buffer, if allowed.
KIOBufferBase::KIOBufferBase
KIOBufferBase()
Default constructor.
Definition: kiobuffer.h:51
KIOBufferBase::isFull
bool isFull() const
Returns true if the buffer is full (i.e., cannot receive more data)
Definition: kiobuffer.h:107
KIOBufferBase::size
virtual Q_LONG size() const =0
Retrieves the buffer size.
KIOBufferBase::KIOBufferBase
KIOBufferBase(const KIOBufferBase &)
Copy constructor.
Definition: kiobuffer.h:57
KIOBufferBase::isEmpty
bool isEmpty() const
Returns true if the buffer is empty of data.
Definition: kiobuffer.h:93
KIOBufferBase
base for I/O buffer implementation
Definition: kiobuffer.h:45
KIOBufferBase::canReadLine
virtual bool canReadLine() const =0
Returns true if a line can be read from the buffer.
KIOBufferBase::length
virtual Q_LONG length() const =0
Returns the number of bytes in the buffer.
KIOBufferBase::consumeBuffer
virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard=true)=0
Consumes data from the beginning of the buffer.
KIOBufferBase::~KIOBufferBase
virtual ~KIOBufferBase()
Virtual destructor.
Definition: kiobuffer.h:63
KIOBufferBase::operator=
KIOBufferBase & operator=(const KIOBufferBase &)
Assignment operator.
Definition: kiobuffer.h:69
KIOBufferBase::feedBuffer
virtual Q_LONG feedBuffer(const char *data, Q_LONG len)=0
Adds data to the end of the buffer.
KIOBufferBase::readLine
virtual QCString readLine()=0
Reads a line from the buffer and discards it.

KDE Home | KDE Accessibility Home | Description of Access Keys