14 class file_not_found: public std::runtime_error
17 file_not_found(const std::string &fn): std::runtime_error(fn) { }
20 class file_already_exists: public std::runtime_error
23 file_already_exists(const std::string &fn): std::runtime_error(fn) { }
28 A class for reading and writing files.
30 Non-blocking mode is not supported on Win32.
32 class File: public Seekable
47 /** Creates a new file object and opens it. If the create flag is set and
48 write access is requested and the file does exist, it is created. Otherwise
49 a missing file is an error. */
50 File(const std::string &, Mode = M_READ, CreateMode = CreateMode(C_CREATE+C_TRUNCATE));
56 virtual unsigned do_write(const char *, unsigned);
57 virtual unsigned do_read(char *, unsigned);
62 virtual SeekOffset seek(SeekOffset, SeekType);
63 virtual SeekOffset tell() const;
65 virtual const Handle &get_handle(Mode);
68 inline File::CreateMode operator|(File::CreateMode m, File::CreateMode n)
69 { return File::CreateMode(static_cast<int>(m)|static_cast<int>(n)); }
71 inline File::CreateMode operator&(File::CreateMode m, File::CreateMode n)
72 { return File::CreateMode(static_cast<int>(m)&static_cast<int>(n)); }
74 inline File::CreateMode operator~(File::CreateMode m)
75 { return File::CreateMode(~static_cast<int>(m)); }
77 typedef Filtered<File, Buffered> BufferedFile;