2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
|
|
|
|
2013-02-26 01:49:38 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-09-01 17:01:15 +02:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2013-01-10 18:46:23 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2020-05-08 18:16:39 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2023-10-13 11:29:59 +02:00
|
|
|
/** Reporting Information and Errors.
|
2009-06-30 21:20:45 +02:00
|
|
|
*
|
2023-10-13 11:29:59 +02:00
|
|
|
* These functions are thread-safe, unless otherwise specified.
|
|
|
|
*
|
|
|
|
* These functions also accept nullptr in case no error reporting is needed. The message are only
|
|
|
|
* printed to the console then. */
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/* Report structures are stored in DNA. */
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2023-10-13 11:29:59 +02:00
|
|
|
/** Initialize a #ReportList struct.
|
|
|
|
*
|
|
|
|
* \note: Not thread-safe, should only be called from the 'owner' thread of the report list.
|
|
|
|
*/
|
2008-12-19 01:50:21 +01:00
|
|
|
void BKE_reports_init(ReportList *reports, int flag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2023-10-13 11:29:59 +02:00
|
|
|
* Fully release any internal resources used by this #ReportList, as acquired by #BKE_reports_init.
|
|
|
|
*
|
|
|
|
* Also calls #BKE_reports_clear. The given `reports` should not be used anymore unless it is
|
|
|
|
* re-initialized first.
|
|
|
|
*
|
|
|
|
* \note: Not thread-safe, should only be called from the current owner of the report list, once
|
|
|
|
* no other concurrent access is possible.
|
|
|
|
*/
|
|
|
|
void BKE_reports_free(ReportList *reports);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Only frees the list of reports in given \a reports. Use #BKE_reports_free to fully cleanup all
|
|
|
|
* allocated resources.
|
|
|
|
*
|
2021-12-07 07:19:15 +01:00
|
|
|
* To make displayed reports disappear, either remove window-manager reports
|
|
|
|
* (#wmWindowManager.reports, or #CTX_wm_reports()), or use #WM_report_banners_cancel().
|
|
|
|
*/
|
2008-12-19 01:50:21 +01:00
|
|
|
void BKE_reports_clear(ReportList *reports);
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2023-10-13 11:29:59 +02:00
|
|
|
/** Moves all reports from `reports_src` to `reports_dst`. */
|
|
|
|
void BKE_reports_move_to_reports(ReportList *reports_dst, ReportList *reports_src);
|
|
|
|
|
|
|
|
/** (Un)lock given `reports`, in case external code needs to access its data. */
|
|
|
|
void BKE_reports_lock(ReportList *reports);
|
|
|
|
void BKE_reports_unlock(ReportList *reports);
|
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
void BKE_report(ReportList *reports, eReportType type, const char *message);
|
|
|
|
void BKE_reportf(ReportList *reports, eReportType type, const char *format, ...)
|
2013-09-01 17:01:15 +02:00
|
|
|
ATTR_PRINTF_FORMAT(3, 4);
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2008-12-29 14:38:08 +01:00
|
|
|
void BKE_reports_prepend(ReportList *reports, const char *prepend);
|
2013-09-01 17:01:15 +02:00
|
|
|
void BKE_reports_prependf(ReportList *reports, const char *prepend, ...) ATTR_PRINTF_FORMAT(2, 3);
|
2008-12-29 14:38:08 +01:00
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
eReportType BKE_report_print_level(ReportList *reports);
|
|
|
|
void BKE_report_print_level_set(ReportList *reports, eReportType level);
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
eReportType BKE_report_store_level(ReportList *reports);
|
|
|
|
void BKE_report_store_level_set(ReportList *reports, eReportType level);
|
2008-12-19 01:50:21 +01:00
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
char *BKE_reports_string(ReportList *reports, eReportType level);
|
2022-04-06 08:15:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \return true when reports of this type will print to the `stdout`.
|
|
|
|
*/
|
|
|
|
bool BKE_reports_print_test(const ReportList *reports, eReportType type);
|
2021-10-19 09:33:42 +02:00
|
|
|
void BKE_reports_print(ReportList *reports, eReportType level);
|
2008-12-18 03:56:48 +01:00
|
|
|
|
2010-06-03 09:27:55 +02:00
|
|
|
Report *BKE_reports_last_displayable(ReportList *reports);
|
2012-03-12 12:32:23 +01:00
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
bool BKE_reports_contain(ReportList *reports, eReportType level);
|
2013-01-10 17:37:48 +01:00
|
|
|
|
2021-10-19 09:33:42 +02:00
|
|
|
const char *BKE_report_type_str(eReportType type);
|
2015-11-13 15:26:22 +01:00
|
|
|
|
2013-01-11 02:30:44 +01:00
|
|
|
bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header);
|
2013-01-10 17:37:48 +01:00
|
|
|
bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header);
|
|
|
|
|
2008-12-18 03:56:48 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|