aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/file.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/winapi/file.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/winapi/file.hpp b/include/winapi/file.hpp
index 7d0126c..b1c8ce3 100644
--- a/include/winapi/file.hpp
+++ b/include/winapi/file.hpp
@@ -21,6 +21,11 @@ namespace winapi {
bool operator==(const FILE_ID_128& a, const FILE_ID_128& b);
+/**
+ * @brief File I/O.
+ *
+ * Easily open, read & write files.
+ */
class File : public Handle {
public:
struct ID {
@@ -32,20 +37,37 @@ public:
}
};
+ /** Open file for reading. */
static File open_r(const std::string&);
+ /** @overload */
static File open_r(const CanonicalPath&);
+ /** Open file for reading (inc. ability to read its attributes). */
static File open_read_attributes(const std::string&);
+ /** @overload */
static File open_read_attributes(const CanonicalPath&);
+ /** Open file for writing. */
static File open_w(const std::string&);
+ /** @overload */
static File open_w(const CanonicalPath&);
+ /** Delete a file. */
static void remove(const std::string&);
+ /** @overload */
static void remove(const CanonicalPath&);
+ /** Make a File instance from an open handle. */
explicit File(Handle&& handle) : Handle{std::move(handle)} {}
+ /**
+ * Get file size.
+ * @return File size, bytes.
+ */
std::size_t get_size() const;
+ /**
+ * Get file ID.
+ * File ID is a unique representation of a file, suitable for hashing.
+ */
ID query_id() const;
};