X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fio%2Ffile.h;h=4f8e5ddf8612b559f82ce5bfc7c2623ba5860cc9;hb=fd074aa05df58fd60d490bb4e367aa2c82338741;hp=cd547b37545cb23b6f0c3842c512a7cf13847905;hpb=e4afb5edb0b7834ef4872218c99207e6b589e9ce;p=libs%2Fcore.git diff --git a/source/io/file.h b/source/io/file.h index cd547b3..4f8e5dd 100644 --- a/source/io/file.h +++ b/source/io/file.h @@ -17,6 +17,12 @@ public: file_not_found(const std::string &fn): std::runtime_error(fn) { } }; +class file_already_exists: public std::runtime_error +{ +public: + file_already_exists(const std::string &fn): std::runtime_error(fn) { } +}; + /** A class for reading and writing files. @@ -30,7 +36,8 @@ public: { C_NONE = 0, C_CREATE = 1, - C_TRUNCATE = 2 + C_TRUNCATE = 2, + C_EXCLUSIVE = 4 }; private: @@ -55,8 +62,7 @@ public: virtual SeekOffset seek(SeekOffset, SeekType); virtual SeekOffset tell() const; -private: - void check_access(Mode) const; + virtual const Handle &get_handle(Mode); }; inline File::CreateMode operator|(File::CreateMode m, File::CreateMode n)