Blender V5.3
BKE_report.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include <cstdio>
12
13#include "BLI_compiler_attrs.hh"
14#include "BLI_enum_flags.hh"
15#include "BLI_mutex.hh"
16
17#include "DNA_listBase.h"
18
19struct CLG_LogRef;
20
21namespace blender {
22
23struct wmTimer;
24
33
36 RPT_DEBUG = (1 << 0),
37 RPT_INFO = (1 << 1),
38 RPT_OPERATOR = (1 << 2),
39 RPT_PROPERTY = (1 << 3),
40 RPT_WARNING = (1 << 4),
41 RPT_ERROR = (1 << 5),
45};
47
48#define RPT_DEBUG_ALL (RPT_DEBUG)
49#define RPT_INFO_ALL (RPT_INFO)
50#define RPT_OPERATOR_ALL (RPT_OPERATOR)
51#define RPT_PROPERTY_ALL (RPT_PROPERTY)
52#define RPT_WARNING_ALL (RPT_WARNING)
53#define RPT_ERROR_ALL \
54 (RPT_ERROR | RPT_ERROR_INVALID_INPUT | RPT_ERROR_INVALID_CONTEXT | RPT_ERROR_OUT_OF_MEMORY)
55
57 RPT_PRINT = (1 << 0),
58 RPT_STORE = (1 << 1),
59 RPT_FREE = (1 << 2),
60 RPT_OP_HOLD = (1 << 3), /* don't move them into the operator global list (caller will use) */
63};
64
65struct Report {
68 short type;
69 short flag;
71 int len;
72 const char *typestr;
73 const char *message;
76};
77
78struct ReportList {
79 ListBaseT<Report> list;
84 int flag;
85 char _pad[4];
87
89 std::mutex *lock;
90};
91
92/* Report structures are stored in DNA. */
93
99void BKE_reports_init(ReportList *reports, int flag);
109void BKE_reports_free(ReportList *reports);
110
118void BKE_reports_clear(ReportList *reports);
119
121void BKE_reports_move_to_reports(ReportList *reports_dst, ReportList *reports_src);
122
124void BKE_reports_lock(ReportList *reports);
125void BKE_reports_unlock(ReportList *reports);
126
127void BKE_report(ReportList *reports, eReportType type, const char *message);
128void BKE_reportf(ReportList *reports, eReportType type, const char *format, ...)
129 ATTR_PRINTF_FORMAT(3, 4);
130
131void BKE_reports_prepend(ReportList *reports, const char *prepend);
132void BKE_reports_prependf(ReportList *reports, const char *prepend_format, ...)
133 ATTR_PRINTF_FORMAT(2, 3);
134
137
140
141char *BKE_reports_string(ReportList *reports, eReportType level);
142
146bool BKE_reports_print_test(const ReportList *reports, eReportType type);
147void BKE_reports_print(ReportList *reports, eReportType level);
148
149void BKE_report_log(eReportType type, const char *message, CLG_LogRef *log);
150void BKE_reports_log(ReportList *reports, eReportType level, CLG_LogRef *log);
151
153
154bool BKE_reports_contain(ReportList *reports, eReportType level);
155
156const char *BKE_report_type_str(eReportType type);
157
158bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header);
159bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header);
160
161} // namespace blender
#define ENUM_OPERATORS(_enum_type)
These structs are the foundation for all linked lists in the library system.
#define log
BMesh Iterators.
Report * BKE_reports_last_displayable(ReportList *reports)
Definition report.cc:381
@ RPT_ERROR_INVALID_INPUT
Definition BKE_report.hh:42
@ RPT_ERROR_INVALID_CONTEXT
Definition BKE_report.hh:43
@ RPT_OPERATOR
Definition BKE_report.hh:38
@ RPT_ERROR_OUT_OF_MEMORY
Definition BKE_report.hh:44
@ RPT_PROPERTY
Definition BKE_report.hh:39
@ RPT_WARNING
Definition BKE_report.hh:40
bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header)
Definition report.cc:423
void BKE_reports_free(ReportList *reports)
Definition report.cc:106
void BKE_report_print_level_set(ReportList *reports, eReportType level)
Definition report.cc:276
void void BKE_reports_prepend(ReportList *reports, const char *prepend)
Definition report.cc:244
void BKE_reports_init(ReportList *reports, int flag)
Definition report.cc:91
void BKE_reports_move_to_reports(ReportList *reports_dst, ReportList *reports_src)
Definition report.cc:150
void BKE_reports_clear(ReportList *reports)
Definition report.cc:118
void BKE_report_store_level_set(ReportList *reports, eReportType level)
Definition report.cc:296
const char * BKE_report_type_str(eReportType type)
Definition report.cc:65
unsigned short uint16_t
Definition BKE_text.h:80
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
bool BKE_reports_contain(ReportList *reports, eReportType level)
Definition report.cc:394
eReportType BKE_report_store_level(ReportList *reports)
Definition report.cc:287
void BKE_reports_unlock(ReportList *reports)
Definition report.cc:145
void BKE_reports_print(ReportList *reports, eReportType level)
Definition report.cc:367
void BKE_report_log(eReportType type, const char *message, CLG_LogRef *log)
Definition report.cc:42
size_t ATTR_PRINTF_FORMAT(3, 4)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BKE_reports_lock(ReportList *reports)
Definition report.cc:140
void BKE_reports_prependf(ReportList *reports, const char *prepend_format,...) ATTR_PRINTF_FORMAT(2
Definition report.cc:252
@ RPT_OP_HOLD
Definition BKE_report.hh:60
@ RPT_PRINT_HANDLED_BY_OWNER
Definition BKE_report.hh:62
char * BKE_reports_string(ReportList *reports, eReportType level)
Definition report.cc:307
bool BKE_reports_print_test(const ReportList *reports, eReportType type)
Definition report.cc:336
void BKE_reports_log(ReportList *reports, eReportType level, CLG_LogRef *log)
Definition report.cc:354
void eReportType BKE_report_print_level(ReportList *reports)
Definition report.cc:267
bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header)
Definition report.cc:408
ListBaseT< Report > list
Definition BKE_report.hh:79
std::mutex * lock
Definition BKE_report.hh:89
wmTimer * reporttimer
Definition BKE_report.hh:86
const char * typestr
Definition BKE_report.hh:72
const char * message
Definition BKE_report.hh:73