fswatch 1.17.1
win_error_message.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Enrico M. Crisostomo
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 3, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
25#ifndef FSW_WINDOWS_ERROR_MESSAGE_H
26# define FSW_WINDOWS_ERROR_MESSAGE_H
27
28# include <string>
29# include <windows.h>
30
31namespace fsw
32{
42 {
43 public:
51
57 win_error_message(DWORD error_code);
58
66
72 DWORD get_error_code() const;
73
82 std::wstring get_message() const;
83
89 operator std::wstring() const;
90
91 private:
92 mutable bool initialized = false;
93 mutable std::wstring msg;
94 DWORD err_code;
95 };
96}
97
98#endif /* FSW_WINDOWS_ERROR_MESSAGE_H */
Helper class to get the system-defined error message for a Microsoft Windows' error code.
Definition: win_error_message.hpp:42
win_error_message()
Constructs an error message using the last error code of the calling thread, retrieved with a call to...
std::wstring get_message() const
Gets the system-defined error message.
static win_error_message current()
Constructs an instance of this class using the last error code of the calling thread,...
win_error_message(DWORD error_code)
Constructs an error message using the specified error_code.
DWORD get_error_code() const
Gets the error code.
Main namespace of libfswatch.
Definition: event.cpp:24