fs/io/FileOutputStream: use C++ exceptions in constructor

This commit is contained in:
Max Kellermann
2015-12-15 22:26:26 +01:00
parent d29be0f460
commit 24b2198668
9 changed files with 64 additions and 72 deletions

View File

@@ -102,7 +102,6 @@ protected:
}
#endif
public:
bool IsDefined() const {
#ifdef WIN32
return handle != INVALID_HANDLE_VALUE;
@@ -111,6 +110,7 @@ public:
#endif
}
public:
Path GetPath() const {
return path;
}
@@ -132,22 +132,20 @@ class FileOutputStream final : public BaseFileOutputStream {
#endif
public:
FileOutputStream(Path _path, Error &error);
FileOutputStream(Path _path);
~FileOutputStream() {
if (IsDefined())
Cancel();
}
static FileOutputStream *Create(Path path, Error &error);
bool Commit(Error &error);
void Cancel();
};
class AppendFileOutputStream final : public BaseFileOutputStream {
public:
AppendFileOutputStream(Path _path, Error &error);
AppendFileOutputStream(Path _path);
~AppendFileOutputStream() {
if (IsDefined())