kdecore Library API Documentation

ksocketbuffer_p.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 KSOCKETBUFFER_P_H
00026 #define KSOCKETBUFFER_P_H
00027 
00028 #include <qmutex.h>
00029 #include <qcstring.h>
00030 #include <qvaluelist.h>
00031 #include "kiobuffer.h"
00032 
00033 namespace KNetwork {
00034 
00035 class KActiveSocketBase;
00036 
00037   namespace Internal {
00038 
00048 class KSocketBuffer: public KIOBufferBase
00049 {
00050 public:
00056   KSocketBuffer(Q_LONG size = -1);
00057 
00061   KSocketBuffer(const KSocketBuffer& other);
00062 
00066   virtual ~KSocketBuffer();
00067 
00071   KSocketBuffer& operator=(const KSocketBuffer& other);
00072 
00076   virtual bool canReadLine() const;
00077 
00081   virtual QCString readLine();
00082 
00089   virtual Q_LONG length() const;
00090 
00097   virtual Q_LONG size() const;
00098 
00106   virtual bool setSize(Q_LONG size);
00107 
00115   virtual Q_LONG feedBuffer(const char *data, Q_LONG len);
00116 
00120   virtual void clear();
00121 
00130   virtual Q_LONG consumeBuffer(char *data, Q_LONG maxlen, bool discard = true);
00131 
00140   virtual Q_LONG sendTo(KActiveSocketBase* device, Q_LONG len = -1);
00141 
00151   virtual Q_LONG receiveFrom(KActiveSocketBase* device, Q_LONG len = -1);
00152 
00153 protected:
00154   mutable QMutex m_mutex;
00155   QValueList<QByteArray> m_list;
00156   QIODevice::Offset m_offset;   
00157 
00158   Q_LONG m_size;        
00159   mutable Q_LONG m_length;
00160 };
00161 
00162 } }         // namespace KNetwork::Internal
00163 
00164 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Jan 15 13:32:30 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003