00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _OASYS_FILE_IOCLIENT_H_
00019 #define _OASYS_FILE_IOCLIENT_H_
00020
00021 #include "FdIOClient.h"
00022 #include <fcntl.h>
00023 #include <string.h>
00024
00025 namespace oasys {
00026
00033 class FileIOClient : public FdIOClient {
00034 public:
00036 FileIOClient();
00037 virtual ~FileIOClient();
00038
00041 int open(const char* path, int flags, int* errnop = 0);
00042 int open(const char* path, int flags, mode_t mode, int* errnop = 0);
00043 int close();
00044 int unlink();
00045 int lseek(off_t offset, int whence);
00046 int truncate(off_t length);
00047 int mkstemp(char* temp);
00048 int stat(struct stat* buf);
00049 int lstat(struct stat* buf);
00051
00055 int copy_contents(FileIOClient* dest, size_t len = 0);
00056
00058 void set_path(const std::string& path) {
00059 path_ = path;
00060 }
00061
00063 int reopen(int flags);
00064
00066 bool is_open() { return fd_ != -1; }
00067
00069 const char* path() { return path_.c_str(); }
00070
00072 size_t path_len() { return path_.length(); }
00073
00074 protected:
00076 std::string path_;
00077 };
00078
00079 }
00080
00081 #endif