aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/file.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/file.cpp b/src/file.cpp
index 2b04f80..4f1d2a9 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -58,7 +58,7 @@ private:
CreateFileParams() = default;
};
-Handle open_file(const std::wstring& path, const CreateFileParams& params) {
+File open_file(const std::wstring& path, const CreateFileParams& params) {
SECURITY_ATTRIBUTES attributes;
std::memset(&attributes, 0, sizeof(attributes));
attributes.nLength = sizeof(attributes);
@@ -76,7 +76,7 @@ Handle open_file(const std::wstring& path, const CreateFileParams& params) {
throw error::windows(GetLastError(), "CreateFileW");
}
- return Handle{handle};
+ return File{Handle{handle}};
}
void remove_file(const std::wstring& path) {
@@ -89,22 +89,38 @@ void remove_file(const std::wstring& path) {
} // namespace
-Handle File::open_r(const std::string& path) {
+File File::open_r(const std::string& path) {
return open_file(to_system_path(path), CreateFileParams::read());
}
-Handle File::open_r(const CanonicalPath& path) {
+File File::open_r(const CanonicalPath& path) {
return open_file(to_system_path(path), CreateFileParams::read());
}
-Handle File::open_read_attributes(const std::string& path) {
+File File::open_read_attributes(const std::string& path) {
return open_file(to_system_path(path), CreateFileParams::read_attributes());
}
-Handle File::open_read_attributes(const CanonicalPath& path) {
+File File::open_read_attributes(const CanonicalPath& path) {
return open_file(to_system_path(path), CreateFileParams::read_attributes());
}
+File File::open_w(const std::string& path) {
+ return open_file(to_system_path(path), CreateFileParams::write());
+}
+
+File File::open_w(const CanonicalPath& path) {
+ return open_file(to_system_path(path), CreateFileParams::write());
+}
+
+void File::remove(const std::string& path) {
+ remove_file(to_system_path(path));
+}
+
+void File::remove(const CanonicalPath& path) {
+ remove_file(to_system_path(path));
+}
+
std::size_t File::get_size() const {
LARGE_INTEGER size;
@@ -129,20 +145,4 @@ File::ID File::query_id() const {
return {id};
}
-Handle File::open_w(const std::string& path) {
- return open_file(to_system_path(path), CreateFileParams::write());
-}
-
-Handle File::open_w(const CanonicalPath& path) {
- return open_file(to_system_path(path), CreateFileParams::write());
-}
-
-void File::remove(const std::string& path) {
- remove_file(to_system_path(path));
-}
-
-void File::remove(const CanonicalPath& path) {
- remove_file(to_system_path(path));
-}
-
} // namespace winapi