Heart 1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
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
15namespace 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 */
65namespace ErrorCodes {
66
70using Code = unsigned char;
71
86
91class HEARTSHARED_EXPORT AbstractErrorCodesHelper {
92
93public:
99 static QString toString(Code enumData);
100
101private:
102 AbstractErrorCodesHelper() = default;
103
104};
105
106}
107}
108
109#endif // ABSTRACT_ERRORCODES_H
static QString toString(Code enumData)
toString This method have a cases for the translate all ErrorCodes of the QuasarApp Heart library.
ErrorCodes This namesapce contains all error codes of the Heart Library.
unsigned char Code
Code This is alias for the unsigned char type.
AbstractErrorCodes
The AbstractErrorCodes enum This enum with default error codes.
@ InvalidRequest
The sender to remote nodes request is invalid. This is default value.
@ NoError
This reqest executed successful.
@ UnknownError
This is unknown error. Default value.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13