OMW  0.1.0
error.h
1 /*
2 author Oliver Blaser
3 date 13.08.2021
4 copyright MIT - Copyright (c) 2021 Oliver Blaser
5 */
6 
7 #ifndef OMW_WINDOWS_ERROR_H
8 #define OMW_WINDOWS_ERROR_H
9 
10 #include "../../omw/defs.h"
11 #ifdef OMW_PLAT_WIN
12 
13 #include <iostream>
14 #include <string>
15 
16 namespace omw
17 {
18  namespace windows
19  {
20  enum ERRORCODE
21  {
22  EC_OK = 0,
35  };
36 
37  class ErrorCode
38  {
39  public:
40  ErrorCode();
41  ErrorCode(int code, const std::string& message = "");
42  virtual ~ErrorCode();
43 
44  virtual int code() const;
45  virtual const std::string& msg() const;
46 
47  virtual bool good() const;
48 
49  std::string toString() const;
50 
51  friend std::ostream& operator<<(std::ostream& os, const ErrorCode& ec);
52 
53  private:
54  int errorCode;
55  std::string errorMsg;
56  };
57  }
58 }
59 
60 #endif // OMW_PLAT_WIN
61 #endif // OMW_WINDOWS_ERROR_H
omw::windows::ERRORCODE
ERRORCODE
Definition: error.h:21
std::string
C++ standard string. See std::basic_string for further detail.
Definition: linkToStd.dox:15
omw::windows::ErrorCode::good
virtual bool good() const
Definition: error.cpp:49
omw::windows::ErrorCode::ErrorCode
ErrorCode()
Default ctor.
Definition: error.cpp:15
omw::windows::ErrorCode::msg
virtual const std::string & msg() const
Getter for the message.
Definition: error.cpp:41
omw::windows::EC_STRCONV_DEST_BUFFER_SIZE
@ EC_STRCONV_DEST_BUFFER_SIZE
Definition: error.h:34
omw::windows::EC_INV_UNICODE
@ EC_INV_UNICODE
Definition: error.h:25
omw::windows::EC_RESOURCE_NOT_FOUND
@ EC_RESOURCE_NOT_FOUND
Definition: error.h:31
omw::windows::EC_ERROR
@ EC_ERROR
Definition: error.h:23
omw::windows::EC_OK
@ EC_OK
Definition: error.h:22
omw::windows::EC_ENVVAR_NOT_FOUND
@ EC_ENVVAR_NOT_FOUND
Definition: error.h:29
omw::windows::EC_INTERNAL
@ EC_INTERNAL
Definition: error.h:26
omw::windows::EC_UNKNOWN_WIN
@ EC_UNKNOWN_WIN
Definition: error.h:27
omw::windows::EC_RESOURCE_NOT_LOADED
@ EC_RESOURCE_NOT_LOADED
Definition: error.h:32
omw::windows::EC_INV_ARG
@ EC_INV_ARG
Definition: error.h:24
omw::windows::ErrorCode::code
virtual int code() const
Getter for the error code.
Definition: error.cpp:34
omw
Main namespace.
omw::windows::ErrorCode
Definition: error.h:38