00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _MIMETIC_OS_STDFILE_H
00017 #define _MIMETIC_OS_STDFILE_H
00018 #include <sys/types.h>
00019 #include <sys/stat.h>
00020 #include <fcntl.h>
00021 #include <cstdio>
00022 #include <string>
00023 #include <iterator>
00024 #include <mimetic/os/fileop.h>
00025 #include <mimetic/os/file_iterator.h>
00026
00027 namespace mimetic
00028 {
00029
00030
00031 struct StdFile: public FileOp
00032 {
00033 typedef ifile_iterator iterator;
00034 StdFile();
00035 StdFile(const std::string&, int mode = O_RDONLY);
00036 ~StdFile();
00037 operator bool() const;
00038 void open(const std::string&, int mode = O_RDONLY);
00039 void close();
00040 uint read(char*, int);
00041
00042 iterator begin();
00043 iterator end();
00044 protected:
00045 void open(int flags);
00046 bool stat();
00047
00048 std::string m_fqn;
00049 bool m_stated;
00050 struct stat m_st;
00051 int m_fd;
00052 };
00053
00054 }
00055
00056
00057 #endif
00058