aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/pdb/utils
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-05-20 02:47:57 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-05-20 02:47:57 +0300
commitf4f39e74fae3c8b8d8fdb2f560e8a50777b6de1d (patch)
treea15a2c289e6d0f5fa8ccb2d71b1c4af24f0bd4b9 /include/pdb/utils
parentdon't load multiple PDBs with the same base (diff)
downloadwinapi-debug-f4f39e74fae3c8b8d8fdb2f560e8a50777b6de1d.tar.gz
winapi-debug-f4f39e74fae3c8b8d8fdb2f560e8a50777b6de1d.zip
don't load the same PDB twice
Diffstat (limited to '')
-rw-r--r--include/pdb/utils/file.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/pdb/utils/file.hpp b/include/pdb/utils/file.hpp
index 5b83f2b..50975aa 100644
--- a/include/pdb/utils/file.hpp
+++ b/include/pdb/utils/file.hpp
@@ -5,14 +5,44 @@
#pragma once
+#include <Windows.h>
+
#include <cstddef>
+#include <cstring>
+#include <functional>
#include <string>
+#include <type_traits>
namespace pdb
{
namespace file
{
std::size_t get_size(const std::string&);
+
+ struct ID
+ {
+ const FILE_ID_INFO raw;
+
+ bool operator==(const ID& other) const
+ {
+ static_assert(std::is_pod<FILE_ID_INFO>::value, "Can't memcmp if file IDs aren't PODs");
+ return 0 == std::memcmp(&raw, &other.raw, sizeof(FILE_ID_INFO));
+ }
+ };
+
+ ID query_id(const std::string&);
}
}
+
+namespace std
+{
+ template <>
+ struct hash<pdb::file::ID>
+ {
+ std::size_t operator()(const pdb::file::ID& id) const
+ {
+ return _Bitwise_hash<FILE_ID_INFO>{}(id.raw);
+ }
+ };
+}