Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
abstracterrorcodes.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020-2025 QuasarApp.
3
* Distributed under the lgplv3 software license, see the accompanying
4
* Everyone is permitted to copy and distribute verbatim copies
5
* of this license document, but changing it is not allowed.
6
*/
7
8
#ifndef ABSTRACT_ERRORCODES_H
9
#define ABSTRACT_ERRORCODES_H
10
11
#include <QString>
12
#include "heart_global.h"
13
14
15
namespace
QH
{
16
33
MyFirstError = AbstractErrorCodes::AbstractErrorCodes, // or another ErrorCodes enum.
34
35
MyErrorCodes,
36
37
38
};
39
40
class MyErrorCodesHelper {
41
public:
42
static QString toString(unsigned char enumData) {
43
44
switch (enumData) {
45
46
case ErrorCodes::MyFirstError: {
47
return "My Error";
48
}
49
50
default: return AbstractErrorCodesHelper::toString(enumData);
51
52
}
53
54
private:
55
MyErrorCodesHelper() = default;
56
57
};
58
59
}
60
}
61
* @endcode
62
* @note in place the AbstractErrorCodes you can use another erorcodes class for example : DBErrorCodesHelper.
63
* Do not forget invoke toString method of the parent erorcodes class (in example case it is DBErrorCodesHelper class).
64
*/
65
namespace
ErrorCodes
{
66
70
using
Code
=
unsigned
char;
71
75
enum
AbstractErrorCodes
:
Code
{
76
78
NoError
= 0,
80
UnknownError
,
82
InvalidRequest
,
84
AbstractErrorCodes
85
};
86
91
class
HEARTSHARED_EXPORT AbstractErrorCodesHelper {
92
93
public
:
99
static
QString
toString
(
Code
enumData);
100
101
private
:
102
AbstractErrorCodesHelper() =
default
;
103
104
};
105
106
}
107
}
108
109
#endif
// ABSTRACT_ERRORCODES_H
QH::ErrorCodes::AbstractErrorCodesHelper::toString
static QString toString(Code enumData)
toString This method have a cases for the translate all ErrorCodes of the QuasarApp Heart library.
Definition
abstracterrorcodes.cpp:17
QH::ErrorCodes
ErrorCodes This namesapce contains all error codes of the Heart Library.
Definition
abstracterrorcodes.cpp:15
QH::ErrorCodes::Code
unsigned char Code
Code This is alias for the unsigned char type.
Definition
abstracterrorcodes.h:70
QH::ErrorCodes::AbstractErrorCodes
AbstractErrorCodes
The AbstractErrorCodes enum This enum with default error codes.
Definition
abstracterrorcodes.h:75
QH::ErrorCodes::InvalidRequest
@ InvalidRequest
The sender to remote nodes request is invalid. This is default value.
Definition
abstracterrorcodes.h:82
QH::ErrorCodes::NoError
@ NoError
This reqest executed successful.
Definition
abstracterrorcodes.h:78
QH::ErrorCodes::UnknownError
@ UnknownError
This is unknown error. Default value.
Definition
abstracterrorcodes.h:80
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
src
public
abstracterrorcodes.h
Generated by
1.18.0