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,2017 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 space; // Space in buffer
38 private:
39  FXIOBuffer(const FXIOBuffer&);
40  FXIOBuffer &operator=(const FXIOBuffer&);
41 public:
42 
44  FXIOBuffer();
45 
47  FXIOBuffer(FXuchar* ptr,FXuval sz,FXuint m=FXIO::Reading);
48 
50  virtual FXbool open(FXuchar* ptr,FXuval sz,FXuint m=FXIO::Reading);
51 
53  FXuchar* data() const { return buffer; }
54 
56  virtual FXbool isOpen() const;
57 
59  virtual FXbool isSerial() const;
60 
62  virtual FXlong position() const;
63 
65  virtual FXlong position(FXlong offset,FXuint from=FXIO::Begin);
66 
68  virtual FXival readBlock(void* ptr,FXival count);
69 
71  virtual FXival writeBlock(const void* ptr,FXival count);
72 
74  virtual FXlong truncate(FXlong sz);
75 
77  virtual FXbool flush();
78 
80  virtual FXint eof();
81 
83  virtual FXlong size();
84 
86  virtual FXbool close();
87 
89  virtual ~FXIOBuffer();
90  };
91 
92 }
93 
94 #endif

Copyright © 1997-2016 Jeroen van der Zijp