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

FXIO.h
1 /********************************************************************************
2 * *
3 * A b s t r a c t I / O C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2021 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 FXIO_H
22 #define FXIO_H
23 
24 namespace FX {
25 
26 
33 class FXAPI FXIO {
34 protected:
35  FXlong pointer; // Stream pointer
36  FXuint access; // Access mode flags
37 public:
38 
40  enum {
41 
43  NoAccess = 0,
44  ReadOnly = 1,
45  WriteOnly = 2,
46  ReadWrite = ReadOnly|WriteOnly,
47  Append = 4,
48  Truncate = 8,
49  Create = 16,
50  Exclusive = 32,
51  NonBlocking = 64,
52  Executable = 128,
53  OwnHandle = 256,
54  NoAccessTime = 512,
55  Inheritable = 1024,
56 
58  Reading = ReadOnly,
59  Writing = ReadWrite|Create|Truncate
60  };
61 
63  enum {
64  Begin = 0,
65  Current = 1,
66  End = 2
67  };
68 
70  enum {
71 
73  OtherExec = 0x00001,
74  OtherWrite = 0x00002,
75  OtherRead = 0x00004,
76  OtherReadWrite = OtherRead|OtherWrite,
77  OtherFull = OtherReadWrite|OtherExec,
78 
79  GroupExec = 0x00008,
80  GroupWrite = 0x00010,
81  GroupRead = 0x00020,
82  GroupReadWrite = GroupRead|GroupWrite,
83  GroupFull = GroupReadWrite|GroupExec,
84 
85  OwnerExec = 0x00040,
86  OwnerWrite = 0x00080,
87  OwnerRead = 0x00100,
88  OwnerReadWrite = OwnerRead|OwnerWrite,
89  OwnerFull = OwnerReadWrite|OwnerExec,
90 
91  AllRead = OtherRead|GroupRead|OwnerRead,
92  AllWrite = OtherWrite|GroupWrite|OwnerWrite,
93  AllExec = OtherExec|GroupExec|OwnerExec,
94  AllReadWrite = AllRead|AllWrite,
95  AllFull = AllReadWrite|AllExec,
96 
98  Hidden = 0x00200,
99  Directory = 0x00400,
100  File = 0x00800,
101  SymLink = 0x01000,
102 
104  SetUser = 0x02000,
105  SetGroup = 0x04000,
106  Sticky = 0x08000,
107 
109  Character = 0x10000,
110  Block = 0x20000,
111  Socket = 0x40000,
112  Fifo = 0x80000
113  };
114 
116  enum {
117  Error = -1,
118  Again = -2,
119  Broken = -3
120  };
121 
122 protected:
123  FXIO();
124  FXIO(FXuint m);
125 private:
126  FXIO(const FXIO&);
127  FXIO &operator=(const FXIO&);
128 public:
129 
131  FXbool isReadable() const;
132 
134  FXbool isWritable() const;
135 
137  FXuint mode() const { return access; }
138 
140  virtual FXbool setMode(FXuint m);
141 
143  virtual FXbool isOpen() const;
144 
146  virtual FXbool isSerial() const;
147 
149  virtual FXlong position() const;
150 
152  virtual FXlong position(FXlong offset,FXuint from=FXIO::Begin);
153 
155  virtual FXival readBlock(void* ptr,FXival count);
156 
158  virtual FXival writeBlock(const void* ptr,FXival count);
159 
161  FXbool readChar(FXchar& ch);
162 
164  FXbool writeChar(FXchar ch);
165 
167  virtual FXlong truncate(FXlong sz);
168 
170  virtual FXbool flush();
171 
173  virtual FXint eof();
174 
176  virtual FXlong size();
177 
179  virtual FXbool close();
180 
182  virtual ~FXIO();
183  };
184 
185 }
186 
187 #endif
Definition: FX4Splitter.h:28
FXuint mode() const
Return access mode.
Definition: FXIO.h:137
FXIO is a base class for a generic i/o device.
Definition: FXIO.h:33

Copyright © 1997-2020 Jeroen van der Zijp