source: mainline/uspace/lib/cpp/src/future.cpp@ 8624d1f

Last change on this file since 8624d1f was b57ba05, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Update headers in C++ files

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <future>
8#include <string>
9#include <system_error>
10
11namespace std
12{
13 error_code make_error_code(future_errc ec) noexcept
14 {
15 return error_code{static_cast<int>(ec), future_category()};
16 }
17
18 error_condition make_error_condition(future_errc ec) noexcept
19 {
20 return error_condition{static_cast<int>(ec), future_category()};
21 }
22
23 namespace aux
24 {
25 class future_category_t: public error_category
26 {
27 public:
28 future_category_t()
29 : error_category{}
30 { /* DUMMY BODY */ }
31
32 ~future_category_t() = default;
33
34 const char* name() const noexcept override
35 {
36 return "future";
37 }
38
39 string message(int ev) const override
40 {
41 return "ev: " + std::to_string(ev);
42 }
43 };
44 }
45
46 const error_category& future_category() noexcept
47 {
48 static aux::future_category_t instance{};
49
50 return instance;
51 }
52
53 future_error::future_error(error_code ec)
54 : logic_error{"future_error"}, code_{ec}
55 { /* DUMMY BODY */ }
56
57 const error_code& future_error::code() const noexcept
58 {
59 return code_;
60 }
61
62 const char* future_error::what() const noexcept
63 {
64 return code().message().c_str();
65 }
66}
Note: See TracBrowser for help on using the repository browser.