00001 #ifndef CLASSLIB_STDIO_STORAGE_H 00002 # define CLASSLIB_STDIO_STORAGE_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/system.h" 00007 # include "classlib/iobase/Storage.h" 00008 # include <string> 00009 # include <cstdio> 00010 00011 namespace lat { 00012 //<<<<<< PUBLIC DEFINES >>>>>> 00013 //<<<<<< PUBLIC CONSTANTS >>>>>> 00014 //<<<<<< PUBLIC TYPES >>>>>> 00015 //<<<<<< PUBLIC VARIABLES >>>>>> 00016 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00017 //<<<<<< CLASS DECLARATIONS >>>>>> 00018 00019 class StdioStorage : public Storage 00020 { 00021 public: 00022 StdioStorage (void); 00023 StdioStorage (const char *name, const char *mode); 00024 StdioStorage (const std::string &name, const char *mode); 00025 StdioStorage (FILE *stream); 00026 ~StdioStorage (void); 00027 00028 // open (..., OpenMode?) 00029 virtual void open (const char *name, const char *mode); 00030 virtual void open (const std::string &name, const char *mode); 00031 00032 virtual bool hasError (void) const; 00033 virtual void clearError (void); 00034 00035 // setbuf / setvbuf? 00036 00037 using Storage::read; 00038 using Storage::write; 00039 00040 virtual IOSize read (void *into, IOSize n); 00041 virtual IOSize write (const void *from, IOSize n); 00042 00043 virtual IOOffset position (void) const; 00044 virtual IOOffset position (IOOffset offset, Relative whence = SET); 00045 virtual void rewind (void); 00046 00047 virtual void resize (IOOffset size); 00048 00049 virtual void flush (void); 00050 virtual void close (void); 00051 00052 protected: 00053 FILE *m_stream; 00054 }; 00055 00056 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00057 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00058 00059 } // namespace lat 00060 #endif // CLASSLIB_STDIO_STORAGE_H