• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • network
tdeiobuffer.h
1 /*
2  * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
3  *
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef TDEIOBUFFER_H
26 #define TDEIOBUFFER_H
27 
28 #include <tqcstring.h>
29 
30 #include <tdelibs_export.h>
31 
32 class TQIODevice;
33 
45 class TDEIOBufferBase
46 {
47 public:
51  TDEIOBufferBase()
52  { }
53 
57  TDEIOBufferBase(const TDEIOBufferBase& )
58  { }
59 
63  virtual ~TDEIOBufferBase()
64  { }
65 
69  TDEIOBufferBase& operator=(const TDEIOBufferBase& )
70  { return *this; }
71 
75  virtual bool canReadLine() const = 0;
76 
80  virtual TQCString readLine() = 0;
81 
88  virtual TQ_LONG length() const = 0;
89 
93  inline bool isEmpty() const
94  { return length() == 0; }
95 
102  virtual TQ_LONG size() const = 0;
103 
107  inline bool isFull() const
108  { return size() != -1 && size() == length(); }
109 
117  virtual bool setSize(TQ_LONG size) = 0;
118 
126  virtual TQ_LONG feedBuffer(const char *data, TQ_LONG len) = 0;
127 
136  virtual TQ_LONG consumeBuffer(char *data, TQ_LONG maxlen, bool discard = true) = 0;
137 
141  virtual void clear() = 0;
142 };
143 
144 #endif
TDEIOBufferBase
base for I/O buffer implementation
Definition: tdeiobuffer.h:46
TDEIOBufferBase::size
virtual TQ_LONG size() const =0
Retrieves the buffer size.
TDEIOBufferBase::setSize
virtual bool setSize(TQ_LONG size)=0
Sets the size of the buffer, if allowed.
TDEIOBufferBase::consumeBuffer
virtual TQ_LONG consumeBuffer(char *data, TQ_LONG maxlen, bool discard=true)=0
Consumes data from the beginning of the buffer.
TDEIOBufferBase::feedBuffer
virtual TQ_LONG feedBuffer(const char *data, TQ_LONG len)=0
Adds data to the end of the buffer.
TDEIOBufferBase::~TDEIOBufferBase
virtual ~TDEIOBufferBase()
Virtual destructor.
Definition: tdeiobuffer.h:63
TDEIOBufferBase::canReadLine
virtual bool canReadLine() const =0
Returns true if a line can be read from the buffer.
TDEIOBufferBase::operator=
TDEIOBufferBase & operator=(const TDEIOBufferBase &)
Assignment operator.
Definition: tdeiobuffer.h:69
TDEIOBufferBase::TDEIOBufferBase
TDEIOBufferBase(const TDEIOBufferBase &)
Copy constructor.
Definition: tdeiobuffer.h:57
TDEIOBufferBase::TDEIOBufferBase
TDEIOBufferBase()
Default constructor.
Definition: tdeiobuffer.h:51
TDEIOBufferBase::clear
virtual void clear()=0
Clears the buffer.
TDEIOBufferBase::isEmpty
bool isEmpty() const
Returns true if the buffer is empty of data.
Definition: tdeiobuffer.h:93
TDEIOBufferBase::readLine
virtual TQCString readLine()=0
Reads a line from the buffer and discards it.
TDEIOBufferBase::isFull
bool isFull() const
Returns true if the buffer is full (i.e., cannot receive more data)
Definition: tdeiobuffer.h:107
TDEIOBufferBase::length
virtual TQ_LONG length() const =0
Returns the number of bytes in the buffer.

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.