Bitcoin Core 28.99.0
P2P Digital Currency
|
Manages warning messages within a node. More...
#include <warnings.h>
Public Member Functions | |
Warnings () | |
Warnings (const Warnings &)=delete | |
A warnings instance should always be passed by reference, never copied. More... | |
Warnings & | operator= (const Warnings &)=delete |
bool | Set (warning_type id, bilingual_str message) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) |
Set a warning message. More... | |
bool | Unset (warning_type id) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) |
Unset a warning message. More... | |
std::vector< bilingual_str > | GetMessages () const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) |
Return potential problems detected by the node, sorted by the warning_type id. More... | |
Private Types | |
typedef std::variant< kernel::Warning, node::Warning > | warning_type |
Private Member Functions | |
std::map< warning_type, bilingual_str > m_warnings | GUARDED_BY (m_mutex) |
Private Attributes | |
Mutex | m_mutex |
Manages warning messages within a node.
The Warnings class provides mechanisms to set, unset, and retrieve warning messages. It updates the GUI when warnings are changed.
This class is designed to be non-copyable to ensure warnings are managed centrally.
Definition at line 39 of file warnings.h.
|
private |
Definition at line 41 of file warnings.h.
node::Warnings::Warnings | ( | ) |
|
delete |
A warnings instance should always be passed by reference, never copied.
std::vector< bilingual_str > node::Warnings::GetMessages | ( | ) | const |
Return potential problems detected by the node, sorted by the warning_type id.
Definition at line 43 of file warnings.cpp.
|
private |
bool node::Warnings::Set | ( | warning_type | id, |
bilingual_str | message | ||
) |
Set a warning message.
If a warning with the specified id
is already active, false is returned and the new warning is ignored. If id
does not yet exist, the warning is set, the UI is updated, and true is returned.
[in] | id | Unique identifier of the warning. |
[in] | message | Warning message to be shown. |
id
), otherwise false. Definition at line 29 of file warnings.cpp.
bool node::Warnings::Unset | ( | warning_type | id | ) |
Unset a warning message.
If a warning with the specified id
is active, it is unset, the UI is updated, and true is returned. Otherwise, no warning is unset and false is returned.
[in] | id | Unique identifier of the warning. |
id
), otherwise false. Definition at line 36 of file warnings.cpp.
|
mutableprivate |
Definition at line 43 of file warnings.h.