Blender V5.0
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.h"
14#include "BLI_mutex.hh"
15#include "BLI_utildefines.h"
16
17#include "DNA_listBase.h"
18
19struct wmTimer;
20
21struct CLG_LogRef;
22
31
33enum eReportType : uint16_t {
34 RPT_DEBUG = (1 << 0),
35 RPT_INFO = (1 << 1),
36 RPT_OPERATOR = (1 << 2),
37 RPT_PROPERTY = (1 << 3),
38 RPT_WARNING = (1 << 4),
39 RPT_ERROR = (1 << 5),
43};
45
46#define RPT_DEBUG_ALL (RPT_DEBUG)
47#define RPT_INFO_ALL (RPT_INFO)
48#define RPT_OPERATOR_ALL (RPT_OPERATOR)
49#define RPT_PROPERTY_ALL (RPT_PROPERTY)
50#define RPT_WARNING_ALL (RPT_WARNING)
51#define RPT_ERROR_ALL \
52 (RPT_ERROR | RPT_ERROR_INVALID_INPUT | RPT_ERROR_INVALID_CONTEXT | RPT_ERROR_OUT_OF_MEMORY)
53
55 RPT_PRINT = (1 << 0),
56 RPT_STORE = (1 << 1),
57 RPT_FREE = (1 << 2),
58 RPT_OP_HOLD = (1 << 3), /* don't move them into the operator global list (caller will use) */
61};
62
63struct Report {
66 short type;
67 short flag;
69 int len;
70 const char *typestr;
71 const char *message;
72};
73
74struct ReportList {
80 int flag;
81 char _pad[4];
83
85 std::mutex *lock;
86};
87
88/* Report structures are stored in DNA. */
89
95void BKE_reports_init(ReportList *reports, int flag);
105void BKE_reports_free(ReportList *reports);
106
114void BKE_reports_clear(ReportList *reports);
115
117void BKE_reports_move_to_reports(ReportList *reports_dst, ReportList *reports_src);
118
120void BKE_reports_lock(ReportList *reports);
121void BKE_reports_unlock(ReportList *reports);
122
123void BKE_report(ReportList *reports, eReportType type, const char *message);
124void BKE_reportf(ReportList *reports, eReportType type, const char *format, ...)
125 ATTR_PRINTF_FORMAT(3, 4);
126
127void BKE_reports_prepend(ReportList *reports, const char *prepend);
128void BKE_reports_prependf(ReportList *reports, const char *prepend_format, ...)
129 ATTR_PRINTF_FORMAT(2, 3);
130
133
136
137char *BKE_reports_string(ReportList *reports, eReportType level);
138
142bool BKE_reports_print_test(const ReportList *reports, eReportType type);
143void BKE_reports_print(ReportList *reports, eReportType level);
144
145void BKE_report_log(eReportType type, const char *message, CLG_LogRef *log);
146void BKE_reports_log(ReportList *reports, eReportType level, CLG_LogRef *log);
147
149
150bool BKE_reports_contain(ReportList *reports, eReportType level);
151
152const char *BKE_report_type_str(eReportType type);
153
154bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header);
155bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header);
bool BKE_reports_contain(ReportList *reports, eReportType level)
Definition report.cc:383
void BKE_reports_unlock(ReportList *reports)
Definition report.cc:136
ReportListFlags
Definition BKE_report.hh:54
@ RPT_PRINT
Definition BKE_report.hh:55
@ RPT_OP_HOLD
Definition BKE_report.hh:58
@ RPT_PRINT_HANDLED_BY_OWNER
Definition BKE_report.hh:60
@ RPT_FREE
Definition BKE_report.hh:57
@ RPT_STORE
Definition BKE_report.hh:56
bool BKE_reports_print_test(const ReportList *reports, eReportType type)
Definition report.cc:325
eReportType BKE_report_store_level(ReportList *reports)
Definition report.cc:276
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
eReportType
Definition BKE_report.hh:33
@ RPT_ERROR_OUT_OF_MEMORY
Definition BKE_report.hh:42
@ RPT_INFO
Definition BKE_report.hh:35
@ RPT_OPERATOR
Definition BKE_report.hh:36
@ RPT_ERROR_INVALID_INPUT
Definition BKE_report.hh:40
@ RPT_DEBUG
Definition BKE_report.hh:34
@ RPT_ERROR
Definition BKE_report.hh:39
@ RPT_ERROR_INVALID_CONTEXT
Definition BKE_report.hh:41
@ RPT_WARNING
Definition BKE_report.hh:38
@ RPT_PROPERTY
Definition BKE_report.hh:37
bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header)
Definition report.cc:412
char * BKE_reports_string(ReportList *reports, eReportType level)
Definition report.cc:296
void BKE_reports_prependf(ReportList *reports, const char *prepend_format,...) ATTR_PRINTF_FORMAT(2
bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header)
Definition report.cc:397
Report * BKE_reports_last_displayable(ReportList *reports)
Definition report.cc:370
void BKE_reports_free(ReportList *reports)
Definition report.cc:97
const char * BKE_report_type_str(eReportType type)
Definition report.cc:56
void BKE_report_print_level_set(ReportList *reports, eReportType level)
Definition report.cc:265
void BKE_reports_log(ReportList *reports, eReportType level, CLG_LogRef *log)
Definition report.cc:343
void eReportType BKE_report_print_level(ReportList *reports)
Definition report.cc:256
void BKE_report_store_level_set(ReportList *reports, eReportType level)
Definition report.cc:285
void BKE_reports_clear(ReportList *reports)
Definition report.cc:109
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
void void BKE_reports_prepend(ReportList *reports, const char *prepend)
Definition report.cc:233
void BKE_reports_lock(ReportList *reports)
Definition report.cc:131
void BKE_reports_init(ReportList *reports, int flag)
Definition report.cc:82
void BKE_reports_print(ReportList *reports, eReportType level)
Definition report.cc:356
void BKE_reports_move_to_reports(ReportList *reports_dst, ReportList *reports_src)
Definition report.cc:141
void BKE_report_log(eReportType type, const char *message, CLG_LogRef *log)
Definition report.cc:33
#define ATTR_PRINTF_FORMAT(format_param, dots_param)
#define ENUM_OPERATORS(_type, _max)
These structs are the foundation for all linked lists in the library system.
#define log
format
char _pad[4]
Definition BKE_report.hh:81
std::mutex * lock
Definition BKE_report.hh:85
wmTimer * reporttimer
Definition BKE_report.hh:82
ListBase list
Definition BKE_report.hh:75
int len
Definition BKE_report.hh:69
Report * prev
Definition BKE_report.hh:64
short flag
Definition BKE_report.hh:67
short type
Definition BKE_report.hh:66
const char * typestr
Definition BKE_report.hh:70
const char * message
Definition BKE_report.hh:71
Report * next
Definition BKE_report.hh:64
uint8_t flag
Definition wm_window.cc:145