kiobuffer.h

00001 /*  -*- C++ -*-
00002  *  Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
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 <qcstring.h>
00029 
00030 #include <kdelibs_export.h>
00031 
00032 class QIODevice;
00033 
00045 class KIOBufferBase
00046 {
00047 public:
00051   KIOBufferBase()
00052   { }
00053 
00057   KIOBufferBase(const KIOBufferBase& )
00058   { }
00059 
00063   virtual ~KIOBufferBase()
00064   { }
00065 
00069   KIOBufferBase& operator=(const KIOBufferBase& )
00070   { return *this; }
00071 
00075   virtual bool canReadLine() const = 0;
00076 
00080   virtual QCString readLine() = 0;
00081 
00088   virtual Q_LONG length() const = 0;
00089 
00093   inline bool isEmpty() const
00094   { return length() == 0; }
00095 
00102   virtual Q_LONG size() const = 0;
00103 
00107   inline bool isFull() const
00108   { return size() != -1 && size() == length(); }
00109 
00117   virtual bool setSize(Q_LONG size) = 0;
00118 
00126   virtual Q_LONG feedBuffer(const char *data, Q_LONG len) = 0;
00127 
00136   virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard = true) = 0;
00137 
00141   virtual void clear() = 0;
00142 };
00143 
00144 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys