FXIO.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        I / O   D e v i c e   C l a s s                        *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXIO.h,v 1.8 2006/01/22 17:58:04 fox Exp $                               *
00023 ********************************************************************************/
00024 #ifndef FXIO_H
00025 #define FXIO_H
00026 
00027 
00028 
00029 namespace FX {
00030 
00031 
00037 class FXAPI FXIO {
00038 protected:
00039   FXInputHandle device;         // Device (file/pipe/socket/whatever)
00040   FXuint        access;         // Access being performed
00041 private:
00042   FXIO(const FXIO&);
00043   FXIO &operator=(const FXIO&);
00044 public:
00045 
00047   enum {
00048 
00050     OtherRead      = 0x00004,   
00051     OtherWrite     = 0x00002,   
00052     OtherExec      = 0x00001,   
00053     OtherReadWrite = 0x00006,   
00054     OtherFull      = 0x00007,   
00055 
00056     GroupRead      = 0x00020,   
00057     GroupWrite     = 0x00010,   
00058     GroupExec      = 0x00008,   
00059     GroupReadWrite = 0x00030,   
00060     GroupFull      = 0x00038,   
00061 
00062     OwnerRead      = 0x00100,   
00063     OwnerWrite     = 0x00080,   
00064     OwnerExec      = 0x00040,   
00065     OwnerReadWrite = 0x00180,   
00066     OwnerFull      = 0x001C0,   
00067 
00069     Hidden         = 0x00200,   
00070     Directory      = 0x00400,   
00071     File           = 0x00800,   
00072     SymLink        = 0x01000,   
00073 
00075     SetUser        = 0x02000,   
00076     SetGroup       = 0x04000,   
00077     Sticky         = 0x08000,   
00078 
00080     Character      = 0x10000,   
00081     Block          = 0x20000,   
00082     Socket         = 0x40000,   
00083     Fifo           = 0x80000    
00084     };
00085 
00087   enum {
00088 
00090     NoAccess    =  0,                           
00091     ReadOnly    =  1,                           
00092     WriteOnly   =  2,                           
00093     ReadWrite   =  3,                           
00094     Append      =  4,                           
00095     Truncate    =  8,                           
00096     Create      = 16,                           
00097     Exclusive   = 32,                           
00098     NonBlocking = 64,                           
00099     TextTranslate=65536,                        
00100 
00102     Reading     = ReadOnly,                     
00103     Writing     = ReadWrite|Create|Truncate     
00104     };
00105 
00107   enum {
00108     Begin   = 0,                
00109     Current = 1,                
00110     End     = 2                 
00111     };
00112 
00113 public:
00114 
00116   FXIO();
00117 
00119   virtual bool open(FXInputHandle handle,FXuint mode);
00120 
00122   virtual bool isOpen() const;
00123 
00125   FXuint mode() const { return access; }
00126 
00128   //FXInputHandle handle() const { return device; }
00129 
00131   //virtual void attach(FXInputHandle handle,FXuint mode);
00132 
00134   //virtual void detach();
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 bool flush();
00153 
00155   virtual bool eof();
00156 
00158   virtual FXlong size();
00159 
00161   virtual bool close();
00162 
00164   virtual ~FXIO();
00165   };
00166 
00167 }
00168 
00169 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:22 2009 for TnFOX by doxygen v1.4.7