home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qbuffer.h.z / qbuffer.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  1.8 KB  |  83 lines

  1. /****************************************************************************
  2. ** $Id: qbuffer.h,v 2.6 1998/07/03 00:09:43 hanord Exp $
  3. **
  4. ** Definition of QBuffer class
  5. **
  6. ** Created : 930812
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QBUFFER_H
  25. #define QBUFFER_H
  26.  
  27. #ifndef QT_H
  28. #include "qiodevice.h"
  29. #include "qstring.h"
  30. #endif // QT_H
  31.  
  32.  
  33. class QBuffer : public QIODevice        // buffer I/O device class
  34. {
  35. public:
  36.     QBuffer();
  37.     QBuffer( QByteArray );
  38.    ~QBuffer();
  39.  
  40.     QByteArray buffer() const;
  41.     bool  setBuffer( QByteArray );
  42.  
  43.     bool  open( int );
  44.     void  close();
  45.     void  flush();
  46.  
  47.     uint  size() const;
  48.     int      at()     const;
  49.     bool  at( int );
  50.  
  51.     int      readBlock( char *p, uint );
  52.     int      writeBlock( const char *p, uint );
  53.     int      readLine( char *p, uint );
  54.  
  55.     int      getch();
  56.     int      putch( int );
  57.     int      ungetch( int );
  58.  
  59. protected:
  60.     QByteArray a;
  61.  
  62. private:
  63.     uint  a_len;
  64.     uint  a_inc;
  65.  
  66. private:    // Disabled copy constructor and operator=
  67.     QBuffer( const QBuffer & );
  68.     QBuffer &operator=( const QBuffer & );
  69. };
  70.  
  71.  
  72. inline QByteArray QBuffer::buffer() const
  73. { return a; }
  74.  
  75. inline uint QBuffer::size() const
  76. { return a.size(); }
  77.  
  78. inline int QBuffer::at() const
  79. { return index; }
  80.  
  81.  
  82. #endif // QBUFFER_H
  83.