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,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 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 private:
38  FXIO(const FXIO&);
39  FXIO &operator=(const FXIO&);
40 protected:
41  FXIO();
42  FXIO(FXuint m);
43 public:
44 
46  enum {
47 
49  NoAccess = 0,
50  ReadOnly = 1,
51  WriteOnly = 2,
52  ReadWrite = ReadOnly|WriteOnly,
53  Append = 4,
54  Truncate = 8,
55  Create = 16,
56  Exclusive = 32,
57  NonBlocking = 64,
58  Executable = 128,
59  OwnHandle = 256,
60  NoAccessTime = 512,
61  Inheritable = 1024,
62 
64  Reading = ReadOnly,
65  Writing = ReadWrite|Create|Truncate
66  };
67 
69  enum {
70  Begin = 0,
71  Current = 1,
72  End = 2
73  };
74 
76  enum {
77 
79  OtherExec = 0x00001,
80  OtherWrite = 0x00002,
81  OtherRead = 0x00004,
82  OtherReadWrite = OtherRead|OtherWrite,
83  OtherFull = OtherReadWrite|OtherExec,
84 
85  GroupExec = 0x00008,
86  GroupWrite = 0x00010,
87  GroupRead = 0x00020,
88  GroupReadWrite = GroupRead|GroupWrite,
89  GroupFull = GroupReadWrite|GroupExec,
90 
91  OwnerExec = 0x00040,
92  OwnerWrite = 0x00080,
93  OwnerRead = 0x00100,
94  OwnerReadWrite = OwnerRead|OwnerWrite,
95  OwnerFull = OwnerReadWrite|OwnerExec,
96 
97  AllRead = OtherRead|GroupRead|OwnerRead,
98  AllWrite = OtherWrite|GroupWrite|OwnerWrite,
99  AllExec = OtherExec|GroupExec|OwnerExec,
100  AllReadWrite = AllRead|AllWrite,
101  AllFull = AllReadWrite|AllExec,
102 
104  Hidden = 0x00200,
105  Directory = 0x00400,
106  File = 0x00800,
107  SymLink = 0x01000,
108 
110  SetUser = 0x02000,
111  SetGroup = 0x04000,
112  Sticky = 0x08000,
113 
115  Character = 0x10000,
116  Block = 0x20000,
117  Socket = 0x40000,
118  Fifo = 0x80000
119  };
120 
122  enum {
123  Error = -1,
124  Again = -2,
125  Broken = -3
126  };
127 
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

Copyright © 1997-2016 Jeroen van der Zijp