aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi
diff options
context:
space:
mode:
Diffstat (limited to 'include/winapi')
-rw-r--r--include/winapi/file.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/winapi/file.hpp b/include/winapi/file.hpp
index b9688e9..78187d9 100644
--- a/include/winapi/file.hpp
+++ b/include/winapi/file.hpp
@@ -8,15 +8,34 @@
#include "handle.hpp"
#include "path.hpp"
+#include <boost/functional/hash.hpp>
+
+#include <windows.h>
+
+#include <cstddef>
+#include <functional>
#include <string>
#include <utility>
namespace winapi {
+bool operator==(const FILE_ID_128& a, const FILE_ID_128& b);
+
class File : private Handle {
public:
+ struct ID {
+ const FILE_ID_INFO impl;
+
+ bool operator==(const ID& other) const {
+ return impl.VolumeSerialNumber == other.impl.VolumeSerialNumber &&
+ impl.FileId == other.impl.FileId;
+ }
+ };
+
static Handle open_r(const std::string&);
static Handle open_r(const CanonicalPath&);
+ static Handle open_read_attributes(const std::string&);
+ static Handle open_read_attributes(const CanonicalPath&);
static Handle open_w(const std::string&);
static Handle open_w(const CanonicalPath&);
@@ -29,6 +48,24 @@ public:
using Handle::read;
using Handle::write;
+
+ std::size_t get_size() const;
+
+ ID query_id() const;
};
} // namespace winapi
+
+namespace std {
+
+template <>
+struct hash<winapi::File::ID> {
+ std::size_t operator()(const winapi::File::ID& id) const {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, id.impl.VolumeSerialNumber);
+ boost::hash_combine(seed, id.impl.FileId.Identifier);
+ return seed;
+ }
+};
+
+} // namespace std