From def5c50960eea4c112647f88361a3ae7155901a8 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Tue, 4 Jul 2023 00:48:00 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/wina?= =?UTF-8?q?pi-common@0c196cbe8b4927c78c02b2c7312fc69a507db845=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file_8hpp_source.html | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 file_8hpp_source.html (limited to 'file_8hpp_source.html') diff --git a/file_8hpp_source.html b/file_8hpp_source.html new file mode 100644 index 0000000..c710d95 --- /dev/null +++ b/file_8hpp_source.html @@ -0,0 +1,155 @@ + + + + + + + +winapi_common: include/winapi/file.hpp Source File + + + + + + + + + +
+
+ + + + + + +
+
winapi_common +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
file.hpp
+
+
+
1 // Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
+
2 // This file is part of the "winapi-common" project.
+
3 // For details, see https://github.com/egor-tensin/winapi-common.
+
4 // Distributed under the MIT License.
+
5 
+
6 #pragma once
+
7 
+
8 #include "handle.hpp"
+
9 #include "path.hpp"
+
10 
+
11 #include <boost/functional/hash.hpp>
+
12 
+
13 #include <windows.h>
+
14 
+
15 #include <cstddef>
+
16 #include <functional>
+
17 #include <string>
+
18 #include <utility>
+
19 
+
20 namespace winapi {
+
21 
+
22 bool operator==(const FILE_ID_128& a, const FILE_ID_128& b);
+
23 
+
29 class File : public Handle {
+
30 public:
+
31  struct ID {
+
32  const FILE_ID_INFO impl;
+
33 
+
34  bool operator==(const ID& other) const {
+
35  return impl.VolumeSerialNumber == other.impl.VolumeSerialNumber &&
+
36  impl.FileId == other.impl.FileId;
+
37  }
+
38  };
+
39 
+
41  static File open_r(const std::string&);
+
43  static File open_r(const CanonicalPath&);
+
45  static File open_read_attributes(const std::string&);
+ +
49  static File open_w(const std::string&);
+
51  static File open_w(const CanonicalPath&);
+
52 
+
54  static void remove(const std::string&);
+
56  static void remove(const CanonicalPath&);
+
57 
+
59  explicit File(Handle&& handle) : Handle{std::move(handle)} {}
+
60 
+
65  std::size_t get_size() const;
+
66 
+
71  ID query_id() const;
+
72 };
+
73 
+
74 } // namespace winapi
+
75 
+
76 namespace std {
+
77 
+
78 template <>
+
79 struct hash<winapi::File::ID> {
+
80  std::size_t operator()(const winapi::File::ID& id) const {
+
81  std::size_t seed = 0;
+
82  boost::hash_combine(seed, id.impl.VolumeSerialNumber);
+
83  boost::hash_combine(seed, id.impl.FileId.Identifier);
+
84  return seed;
+
85  }
+
86 };
+
87 
+
88 } // namespace std
+
Absolute, canonical path.
Definition: path.hpp:13
+
File I/O.
Definition: file.hpp:29
+
static File open_w(const std::string &)
Definition: file.cpp:108
+
static void remove(const std::string &)
Definition: file.cpp:116
+
File(Handle &&handle)
Definition: file.hpp:59
+
static File open_read_attributes(const std::string &)
Definition: file.cpp:100
+
static File open_r(const std::string &)
Definition: file.cpp:92
+
std::size_t get_size() const
Definition: file.cpp:124
+
ID query_id() const
Definition: file.cpp:139
+
HANDLE wrapper.
Definition: handle.hpp:25
+ +
+ + + + -- cgit v1.2.3