Coverage Report

Created: 2021-08-28 18:14

D:\git\skunkworks\herald-for-cpp\herald\include\herald\datatype\error_code.h
Line
Count
Source
1
//  Copyright 2020-2021 Herald Project Contributors
2
//  SPDX-License-Identifier: Apache-2.0
3
//
4
5
#ifndef HERALD_ERROR_CODE_H
6
#define HERALD_ERROR_CODE_H
7
8
#include <string>
9
10
namespace herald {
11
namespace datatype {
12
13
// Concept of an error code
14
class ErrorCode {
15
public:
16
1
  ErrorCode() : mSuccess(true), mMessage("") { }
17
2
  ErrorCode(bool success) : mSuccess(success), mMessage("") { }
18
2
  ErrorCode(bool success, std::string message) : mSuccess(success), mMessage(message) { }
19
5
  ~ErrorCode() = default;
20
21
5
  bool operator()() {
22
5
    return mSuccess;
23
5
  }
24
25
5
  std::string message() {
26
5
    return mMessage;
27
5
  }
28
29
private:
30
  bool mSuccess;
31
  std::string mMessage;
32
};
33
34
} // end namespace
35
} // end namespace
36
37
#endif