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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXIO.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       A b s t r a c t   I / O   C l a s s                     *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXIO_H
00022 #define FXIO_H
00023 
00024 
00025 
00026 namespace FX {
00027 
00028 
00032 class FXAPI FXIO {
00033 protected:
00034   FXuint access;
00035 private:
00036   FXIO(const FXIO&);
00037   FXIO &operator=(const FXIO&);
00038 protected:
00039   FXIO();
00040   FXIO(FXuint m);
00041 public:
00042 
00044   enum {
00045 
00047     NoAccess     = 0,                    
00048     ReadOnly     = 1,                    
00049     WriteOnly    = 2,                    
00050     ReadWrite    = ReadOnly|WriteOnly,   
00051     Append       = 4,                    
00052     Truncate     = 8,                    
00053     Create       = 16,                   
00054     Exclusive    = 32,                   
00055     NonBlocking  = 64,                   
00056     Executable   = 128,                  
00057     OwnHandle    = 256,                  
00058     NoAccessTime = 512,                  
00059     Inheritable  = 1024,                 
00060 
00062     Reading      = ReadOnly,                    
00063     Writing      = ReadWrite|Create|Truncate    
00064     };
00065 
00067   enum {
00068     Begin   = 0,                
00069     Current = 1,                
00070     End     = 2                 
00071     };
00072 
00074   enum {
00075 
00077     OtherExec      = 0x00001,                   
00078     OtherWrite     = 0x00002,                   
00079     OtherRead      = 0x00004,                   
00080     OtherReadWrite = OtherRead|OtherWrite,      
00081     OtherFull      = OtherReadWrite|OtherExec,  
00082 
00083     GroupExec      = 0x00008,                   
00084     GroupWrite     = 0x00010,                   
00085     GroupRead      = 0x00020,                   
00086     GroupReadWrite = GroupRead|GroupWrite,      
00087     GroupFull      = GroupReadWrite|GroupExec,  
00088 
00089     OwnerExec      = 0x00040,                   
00090     OwnerWrite     = 0x00080,                   
00091     OwnerRead      = 0x00100,                   
00092     OwnerReadWrite = OwnerRead|OwnerWrite,      
00093     OwnerFull      = OwnerReadWrite|OwnerExec,  
00094 
00095     AllRead        = OtherRead|GroupRead|OwnerRead,     
00096     AllWrite       = OtherWrite|GroupWrite|OwnerWrite,  
00097     AllExec        = OtherExec|GroupExec|OwnerExec,     
00098     AllReadWrite   = AllRead|AllWrite,                  
00099     AllFull        = AllReadWrite|AllExec,              
00100 
00102     Hidden         = 0x00200,   
00103     Directory      = 0x00400,   
00104     File           = 0x00800,   
00105     SymLink        = 0x01000,   
00106 
00108     SetUser        = 0x02000,   
00109     SetGroup       = 0x04000,   
00110     Sticky         = 0x08000,   
00111 
00113     Character      = 0x10000,   
00114     Block          = 0x20000,   
00115     Socket         = 0x40000,   
00116     Fifo           = 0x80000    
00117     };
00118 
00119 public:
00120 
00122   FXbool isReadable() const;
00123 
00125   FXbool isWritable() const;
00126 
00128   FXuint mode() const { return access; }
00129 
00131   virtual FXbool isOpen() const;
00132 
00134   virtual FXbool isSerial() const;
00135 
00137   virtual FXlong position() const;
00138 
00140   virtual FXlong position(FXlong offset,FXuint from=FXIO::Begin);
00141 
00143   virtual FXival readBlock(void* data,FXival count);
00144 
00146   virtual FXival writeBlock(const void* data,FXival count);
00147 
00149   virtual FXlong truncate(FXlong size);
00150 
00152   virtual FXbool flush();
00153 
00155   virtual FXbool eof();
00156 
00158   virtual FXlong size();
00159 
00161   virtual FXbool close();
00162 
00164   virtual ~FXIO();
00165   };
00166 
00167 }
00168 
00169 #endif

Copyright © 1997-2011 Jeroen van der Zijp