13 class file_not_found: public std::runtime_error
16 file_not_found(const std::string &fn): std::runtime_error(fn) { }
21 A class for reading and writing files.
23 Non-blocking mode is not supported on Win32.
25 class File: public Seekable
39 /** Creates a new file object and opens it. If the create flag is set and
40 write access is requested and the file does exist, it is created. Otherwise
41 a missing file is an error. */
42 File(const std::string &, Mode = M_READ, CreateMode = CreateMode(C_CREATE+C_TRUNCATE));
45 /** Closes the file. Any attempt to access the file after this will cause
46 an exception to be thrown. */
52 virtual unsigned do_write(const char *, unsigned);
53 virtual unsigned do_read(char *, unsigned);
58 virtual unsigned seek(int, SeekType);
59 virtual unsigned tell() const;
61 virtual Handle get_event_handle() { return handle; }
64 void check_access(Mode) const;
67 inline File::CreateMode operator|(File::CreateMode m, File::CreateMode n)
68 { return File::CreateMode(static_cast<int>(m)|static_cast<int>(n)); }
70 inline File::CreateMode operator&(File::CreateMode m, File::CreateMode n)
71 { return File::CreateMode(static_cast<int>(m)&static_cast<int>(n)); }
73 inline File::CreateMode operator~(File::CreateMode m)
74 { return File::CreateMode(~static_cast<int>(m)); }
76 typedef Filtered<File, Buffered> BufferedFile;