Veethree D7 SDK
Loading...
Searching...
No Matches
libio_error.h
Go to the documentation of this file.
1
5#ifndef LIBIO_ERROR_H
6#define LIBIO_ERROR_H
7
8#include "io_error_codes.h"
9
10#include <string>
11#include <system_error>
12
13namespace vsdk::io {
14
23public:
30 source_location(std::string file, int line, std::string func);
31
42 static source_location current(std::string file = __builtin_FILE(),
43 int line = __builtin_LINE(),
44 std::string func = __builtin_FUNCTION());
45
50 int line() const;
55 std::string function_name() const;
60 std::string file_name() const;
61
62private:
63 std::string _func;
64 std::string _file;
65 int _line{};
66};
67
75public:
85 const std::string &name() const;
91
92private:
93 std::string _name;
94 io_module _value{};
95};
96
103class libio_error : public std::system_error {
104public:
130 std::error_code ec,
131 const std::string &message = "",
154 io_error ec,
155 const std::string &message = "",
182 int ev,
183 const std::error_category &ecat,
184 const std::string &message = "",
203 const char *what() const noexcept override;
227 const module_value &module() const;
251 const source_location &location() const;
252
253private:
254 std::string _what;
255 module_value _module;
256 source_location _location;
257};
258
259} // namespace vsdk::io
260
261#endif // LIBIO_ERROR_H
libio_error(io_module module, io_error ec, const std::string &message="", source_location loc=source_location::current())
Class constructor.
const char * what() const noexcept override
Provide a string description for this error.
const module_value & module() const
Module object based on io_module.
libio_error(io_module module, std::error_code ec, const std::string &message="", source_location loc=source_location::current())
Class constructor.
libio_error(io_module module, int ev, const std::error_category &ecat, const std::string &message="", source_location loc=source_location::current())
Class constructor.
const source_location & location() const
Exception location.
The module_value class.
Definition libio_error.h:74
io_module value() const
The io_module value.
module_value(io_module module)
The class constructor.
const std::string & name() const
The io_module name.
The source_location class.
Definition libio_error.h:22
int line() const
The source file line.
static source_location current(std::string file=__builtin_FILE(), int line=__builtin_LINE(), std::string func=__builtin_FUNCTION())
Calling this function will gather all info about file, line and function.
std::string function_name() const
The source file function_name.
std::string file_name() const
The source file name.
source_location(std::string file, int line, std::string func)
The class constructor.
module
Enumeration of available logging modules.
Definition log.h:33
IO Modules And Error Codes.
Any entities that belong to the IO library.
io_module
The io_module enum.
Definition io_error_codes.h:17
io_error
The io_error enum.
Definition io_error_codes.h:34