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 --- error_8hpp_source.html | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 error_8hpp_source.html (limited to 'error_8hpp_source.html') diff --git a/error_8hpp_source.html b/error_8hpp_source.html new file mode 100644 index 0000000..3eff8c1 --- /dev/null +++ b/error_8hpp_source.html @@ -0,0 +1,122 @@ + + + + + + + +winapi_common: include/winapi/error.hpp Source File + + + + + + + + + +
+
+ + + + + + +
+
winapi_common +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
error.hpp
+
+
+Go to the documentation of this file.
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 
+
11 #pragma once
+
12 
+
13 #include <windows.h>
+
14 
+
15 #include <cstdint>
+
16 #include <sstream>
+
17 #include <stdexcept>
+
18 #include <string>
+
19 #include <system_error>
+
20 
+
21 namespace winapi {
+
22 namespace error {
+
23 
+
24 class CategoryWindows : public std::error_category {
+
25 public:
+
26  CategoryWindows() = default;
+
27 
+
28  const char* name() const noexcept { return "Windows"; }
+
29 
+
30  std::string message(int32_t) const;
+
31 };
+
32 
+
33 inline const CategoryWindows& category_windows() {
+
34  static const CategoryWindows instance;
+
35  return instance;
+
36 }
+
37 
+
43 std::system_error windows(DWORD code, const char* function);
+
44 
+
45 template <typename Ret>
+
46 std::runtime_error custom(Ret ret, const char* function) {
+
47  std::ostringstream oss;
+
48  oss << "Function " << function << " failed with error code " << ret;
+
49  return std::runtime_error{oss.str()};
+
50 }
+
51 
+
52 } // namespace error
+
53 } // namespace winapi
+ +
+ + + + -- cgit v1.2.3