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