Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXIOBuffer.h
1 /********************************************************************************
2 * *
3 * I / O B u f f e r C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXIOBUFFER_H
22 #define FXIOBUFFER_H
23 
24 #ifndef FXIO_H
25 #include "FXIO.h"
26 #endif
27 
28 namespace FX {
29 
30 
34 class FXAPI FXIOBuffer : public FXIO {
35 protected:
36  FXuchar *buffer; // Memory buffer
37  FXuval pointer; // Stream pointer
38  FXuval space; // Space in buffer
39 private:
40  FXIOBuffer(const FXIOBuffer&);
41  FXIOBuffer &operator=(const FXIOBuffer&);
42 public:
43 
45  FXIOBuffer();
46 
48  FXIOBuffer(FXuchar* ptr,FXuval sz);
49 
51  virtual FXbool open(FXuchar* ptr,FXuval sz);
52 
54  FXuchar* data() const { return buffer; }
55 
57  virtual FXbool isOpen() const;
58 
60  virtual FXbool isSerial() const;
61 
63  virtual FXlong position() const;
64 
66  virtual FXlong position(FXlong offset,FXuint from=FXIO::Begin);
67 
69  virtual FXival readBlock(void* ptr,FXival count);
70 
72  virtual FXival writeBlock(const void* ptr,FXival count);
73 
75  virtual FXlong truncate(FXlong sz);
76 
78  virtual FXbool flush();
79 
81  virtual FXint eof();
82 
84  virtual FXlong size();
85 
87  virtual FXbool close();
88 
90  virtual ~FXIOBuffer();
91  };
92 
93 }
94 
95 #endif
IOBuffer provides a file-interface to a memory-buffer of a given size.
Definition: FXIOBuffer.h:34
FXuchar * data() const
Obtain pointer to buffer.
Definition: FXIOBuffer.h:54
Definition: FX4Splitter.h:28
FXIO is a base class for a generic i/o device.
Definition: FXIO.h:33

Copyright © 1997-2022 Jeroen van der Zijp