Doxygen
Loading...
Searching...
No Matches
message.h File Reference
#include <fmt/core.h>
#include <fmt/compile.h>
#include "types.h"
#include "dstring.h"
Include dependency graph for message.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fmt::formatter< T >
struct  fmt::formatter< DString >
 adds support for formatting DString More...
struct  fmt::formatter< Protection >
 adds support for formatting Protected More...
struct  fmt::formatter< Specifier >
 adds support for formatting Specifier More...
struct  fmt::formatter< MethodTypes >
 adds support for formatting MethodTypes More...
struct  fmt::formatter< RelatesType >
 adds support for formatting RelatesType More...
struct  fmt::formatter< Relationship >
 adds support for formatting RelationShip More...
struct  fmt::formatter< SrcLangExt >
 adds support for formatting SrcLangExt More...
struct  fmt::formatter< MemberType >
 adds support for formatting MemberType More...
struct  fmt::formatter< TypeSpecifier >
 adds support for formatting TypeSpecifier More...
struct  fmt::formatter< EntryType >
 adds support for formatting EntryType More...
struct  fmt::formatter< MemberListType >
 adds support for formatting MemberListType More...

Namespaces

namespace  fmt

Macros

#define msg_no_newline_allowed(x)
#define msg_newline_required(x)
#define msg(fmt, ...)
#define warn(file, line, fmt, ...)
#define warn_undoc(file, line, fmt, ...)
#define warn_incomplete_doc(file, line, fmt, ...)
#define warn_doc_error(file, line, fmt, ...)
#define warn_layout(file, line, fmt, ...)
#define warn_uncond(fmt, ...)
#define err(fmt, ...)
#define err_full(file, line, fmt, ...)
#define term(fmt, ...)

Enumerations

enum class  WarningType {
  Generic , Undocumented , IncompleteDoc , DocError ,
  Layout
}

Functions

void msg_ (fmt::string_view fmt, fmt::format_args args)
void warn_ (WarningType type, const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
void warn_uncond_ (fmt::string_view fmt, fmt::format_args args)
void err_ (fmt::string_view fmt, fmt::format_args args)
void err_full_ (const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
void term_ (fmt::string_view fmt, fmt::format_args args)
DString warn_line (const DString &file, int line)
void initWarningFormat ()
void warn_flush ()
void finishWarnExit ()
template<typename ... Args>
void err_fmt (fmt::format_string< Args... > fmt, Args &&... args)
template<typename ... Args>
void err_full_fmt (const DString &file, int line, fmt::format_string< Args... > fmt, Args &&... args)
template<typename ... Args>
void term_fmt (fmt::format_string< Args... > fmt, Args &&... args)
template<typename ... Args>
void msg_fmt (fmt::format_string< Args... > fmt, Args &&... args)
template<typename ... Args>
void warn_fmt (WarningType type, const DString &file, int line, fmt::format_string< Args... > fmt, Args &&... args)
template<typename ... Args>
void warn_uncond_fmt (fmt::format_string< Args... > fmt, Args &&... args)
template<std::size_t N>
constexpr bool has_newline_at_end (const char(&str)[N])

Macro Definition Documentation

◆ err

#define err ( fmt,
... )
Value:
do { \
msg_newline_required(fmt); \
err_fmt(FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
Definition message.h:144

Definition at line 127 of file message.h.

Referenced by MemberDefImpl::_writeReimplements(), FileDefImpl::acquireFileVersion(), DefinitionImpl::addInnerCompound(), DotManager::addJob(), addValidAliasToMap(), adjustBoolSetting(), adjustColorStyleSetting(), adjustConfiguration(), adjustStringSetting(), RTFGenerator::beginRTFDocument(), bindIntParameter(), bindTextParameter(), Config::checkAndCorrect(), checkFileName(), checkList(), checkPngResult(), classInheritedProtectionLevel(), convertMapFile(), DotFilePatcher::convertMapFile(), copyExtraFiles(), copyFile(), copyIcon(), copyLatexStyleSheet(), copyLogo(), ResourceMgr::copyResourceAs(), copyStyleSheet(), MemberList::countDecMembers(), createCroppedEPS(), createCroppedPDF(), createDVIFile(), createEPSbboxFile(), PerlModGenerator::createOutputDir(), PerlModGenerator::createOutputFile(), createPNG(), createPostscriptFile(), HtmlHelp::Private::createProjectFile(), FlowChart::createSVG(), createSVGFromPDF(), createSVGFromPDFviaInkscape(), RTFGenerator::decIndentLevel(), NamespaceLinkedRefMap::declVisible(), elemIsVisible(), Htags::execute(), extractBoundingBox(), fileToString(), DocParser::findAndCopyImage(), FlowChart::findLabel(), finishWarnExit(), generateDEF(), generateFormula(), generateOutput(), CitationManager::generatePage(), generateSqlite3(), generateXML(), generateXMLForClass(), generateXMLForConcept(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForModule(), generateXMLForNamespace(), generateXMLForPage(), generateXMLForRequirement(), generateXMLForRequirements(), FilterCache::getFileContentsPipe(), DocPara::handleShowDate(), hasNonReferenceNestedGroupRec(), hasNonReferenceNestedNamespaceRec(), hasNonReferenceSuperClassRec(), LatexDocVisitor::incIndentLevel(), RTFDocVisitor::incIndentLevel(), RTFGenerator::incIndentLevel(), RTFGenerator::init(), initializeTables(), initializeViews(), initWarningFormat(), CitationManager::insertCrossReferencesForBibFile(), FileDefImpl::insertMember(), GroupDefImpl::insertMember(), NamespaceDefImpl::insertMember(), ClassDefImpl::internalInsertMember(), ClassDefImpl::isBaseClass(), ClassDefImpl::isSubClass(), VhdlDocGen::isSubClass(), loadExtensions(), Htags::loadFilemap(), loadStylesheet(), openDbConnection(), DocbookDocVisitor::operator()(), HtmlDocVisitor::operator()(), LatexDocVisitor::operator()(), PerlModDocVisitor::operator()(), PerlModDocVisitor::operator()(), PerlModDocVisitor::operator()(), RTFDocVisitor::operator()(), TextDocVisitor::operator()(), XmlDocVisitor::operator()(), DotGraph::prepareDotFile(), prepareStatement(), preProcessFile(), RTFGenerator::preProcessFileInplace(), DotRunner::readBoundingBox(), readCodeFragment(), readConfiguration(), readInputFile(), readTagFile(), readTextFileByName(), FileDefImpl::removeMember(), GroupDefImpl::removeMember(), replaceVariables(), resetPDFSize(), DotFilePatcher::run(), DotRunner::run(), runHtmlHelpCompiler(), runQHelpGenerator(), StyleData::setStyle(), showDate(), SysTimeKeeper::stop(), testRTFOutput(), updateEPSBoundingBox(), updateLanguageMapping(), SearchIndexExternal::write(), ResourceMgr::writeCategory(), writeCombineScript(), MemberDefImpl::writeDeclaration(), writeDefaultLayoutFile(), FileDefImpl::writeDetailedDescription(), writeDiaGraphFromFile(), ConceptDefImpl::writeDocumentation(), DirDefImpl::writeDocumentation(), FileDefImpl::writeDocumentation(), GroupDefImpl::writeDocumentation(), MemberList::writeDocumentation(), ModuleDefImpl::writeDocumentation(), NamespaceDefImpl::writeDocumentation(), ClassDefImpl::writeDocumentationContents(), HtmlGenerator::writeExternalSearchPage(), ClassDiagram::writeFigure(), FlowChart::writeFlowChart(), writeInlineGraph(), writeJavasScriptSearchDataPage(), MemberList::writePlainDeclarations(), HtmlGenerator::writeSearchPage(), DefinitionImpl::writeSourceDef(), HtmlGenerator::writeStyleInfo(), and writeTagFile().

◆ err_full

#define err_full ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
err_full_fmt(file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 132 of file message.h.

Referenced by NamespaceDefImpl::compoundTypeString(), do_mscgen_generate(), DotRunner::run(), runMermaid(), runPlantumlContent(), writeDiaGraphFromFile(), MermaidManager::writeMermaidSource(), and writeMscGraphFromFile().

◆ msg

#define msg ( fmt,
... )
Value:
msg_fmt(FMT_STRING(fmt),##__VA_ARGS__)
void msg_fmt(fmt::format_string< Args... > fmt, Args &&... args)
Definition message.h:64

Definition at line 94 of file message.h.

Referenced by MemberDefImpl::_writeCallerGraph(), MemberDefImpl::_writeCallGraph(), FileDefImpl::acquireFileVersion(), adjustConfiguration(), Statistics::begin(), checkAndUpdatePath(), checkWarnMessage(), devUsage(), anonymous_namespace{tagreader.cpp}::TagFileParser::error(), LayoutParser::error(), exitDoxygen(), format_warn(), generateConceptDocs(), generateConfigFile(), generateDocsForClassList(), generateExampleDocs(), generateFileDocs(), generateFileSources(), generateFormula(), generateNamespaceClassDocs(), generateNamespaceConceptDocs(), generateNamespaceDocs(), generateOutput(), generatePageDocs(), generateSqlite3(), generateXML(), generateXMLForClass(), LayoutDocManager::init(), FormulaManager::initFromRepository(), initializeTables(), initializeViews(), loadExtensions(), loadStylesheet(), LayoutDocManager::parse(), XMLParser::parse(), parseFile(), parseFilesMultiThreading(), parseInput(), VHDLOutlineParser::parseInput(), parseMain(), parseMain(), parseMain(), parseMain(), parseTagFile(), Statistics::print(), Debug::printFlags(), processData(), readConfiguration(), readDir(), readIncludeFile(), readTagFile(), reportError(), DotManager::run(), DotRunner::run(), runMermaid(), runPlantumlContent(), AutoTrace::setExit(), setTranslator(), SymbolResolver::showCacheUsage(), stopDoxygen(), LayoutNavEntry::url(), usage(), version(), DirDefImpl::writeDirectoryGraph(), ClassDefImpl::writeDocumentationForInnerClasses(), and GroupDefImpl::writeGroupGraph().

◆ msg_newline_required

#define msg_newline_required ( x)
Value:
static_assert(has_newline_at_end(x),"text: \"" x "\" should have \\n at end");
constexpr bool has_newline_at_end(const char(&str)[N])
Definition message.h:83

Definition at line 91 of file message.h.

◆ msg_no_newline_allowed

#define msg_no_newline_allowed ( x)
Value:
static_assert(!has_newline_at_end(x),"text: \"" x "\" should not have \\n at end");

Definition at line 88 of file message.h.

◆ term

◆ warn

#define warn ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Generic,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 97 of file message.h.

Referenced by addAnchor(), addClassToGroups(), addConceptToGroups(), addDirToGroups(), ModuleManager::addDocs(), addExampleToGroups(), addGroupToGroups(), addIncludeFile(), addMemberDocs(), addMemberFunction(), addMemberToGroups(), addModuleToGroups(), addNamespaceToGroups(), addRelatedPage(), addRequirementId(), RequirementManager::addRequirementRefsForSymbol(), addSection(), addXRefItemToEntry(), buildExampleList(), buildFileList(), buildFunctionList(), buildGroupListFiltered(), buildInterfaceAndServiceList(), checkBlocks(), checkFormula(), DocGroup::close(), convertCppComments(), decrLevel(), endCondSection(), endCondSection(), DocGroup::enterCompound(), anonymous_namespace{tagreader.cpp}::TagFileParser::error(), Markdown::Private::extractTitleId(), findClassRelation(), findDefineDocumentation(), findDirDocumentation(), findEnumDocumentation(), findGlobalMember(), findMainPage(), findMember(), getConfig(), getConvertLatexMacro(), MemberDefImpl::getOutputFileBase(), DocParser::handleCite(), DocPara::handleCommand(), DocPara::handleDoxyConfig(), handleElse(), handleElseIf(), handleEndIf(), handleEndParBlock(), handleExample(), handleFileInfoResult(), handleInheritanceGraph(), handleMemberOf(), vhdl::parser::VhdlErrorHandler::handleOtherError(), handleParBlock(), vhdl::parser::VhdlErrorHandler::handleParseError(), handleRelated(), handleRelatedAlso(), handleSubpage(), handleToc(), vhdl::parser::VhdlErrorHandler::handleUnexpectedToken(), CitationManager::insertCrossReferencesForBibFile(), ClassDefImpl::internalInsertMember(), isFencedCodeBlock(), DocGroup::leaveFile(), vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError(), vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError(), loadExtensions(), loadStylesheet(), otherCaseDone(), CondParser::parse(), CommentScanner::parseCommentBlock(), parseIncludeOptions(), parseMain(), parsePrototype(), parsePrototype(), pop_state(), pop_state(), pop_state(), popBlockState(), Preprocessor::processFile(), Markdown::Private::processQuotations(), processSection(), readIncludeFile(), resolveClassNestingRelations(), subrHandleCommentBlock(), substituteKeywords(), tryAddEnumDocsToGroupMember(), MemberDefImpl::virtualness(), MemberDefImpl::warnIfUndocumented(), writeDirTreeNode(), and writeExceptionListImpl().

◆ warn_doc_error

#define warn_doc_error ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::DocError,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 112 of file message.h.

Referenced by DocParser::checkArgumentName(), DocParser::checkRetvalName(), DocParser::checkUnOrMultipleDocumentedParams(), DocParser::defaultHandleToken(), DocAnchor::DocAnchor(), DocCite::DocCite(), DocEmoji::DocEmoji(), DocFormula::DocFormula(), DocHtmlCaption::DocHtmlCaption(), DocRef::DocRef(), DocParser::errorHandleDefaultToken(), DocParser::findAndCopyImage(), DocParser::handleAHref(), DocParser::handleAnchor(), DocParser::handleCite(), DocPara::handleCommand(), DocPara::handleDoxyConfig(), DocPara::handleEmoji(), DocPara::handleFile(), DocPara::handleHtmlEndTag(), DocPara::handleHtmlStartTag(), DocParser::handleIFile(), DocParser::handleILine(), DocParser::handleImage(), DocParser::handleImg(), DocPara::handleInclude(), DocPara::handleIncludeOperator(), DocParser::handleInternalRef(), DocPara::handleLink(), DocParser::handleLinkedWord(), DocParser::handlePrefix(), DocParser::handleRef(), DocPara::handleSection(), DocPara::handleShowDate(), DocPara::handleStartCode(), DocParser::handleStyleArgument(), DocParser::handleStyleLeave(), DocParser::handleUnclosedStyleCommands(), DocDiaFile::parse(), DocDotFile::parse(), DocHRef::parse(), DocHtmlBlockQuote::parse(), DocHtmlCaption::parse(), DocHtmlDescList::parse(), DocHtmlDescTitle::parse(), DocHtmlDetails::parse(), DocHtmlHeader::parse(), DocHtmlList::parse(), DocHtmlRow::parse(), DocHtmlSummary::parse(), DocHtmlTable::parse(), DocInclude::parse(), DocIncOperator::parse(), DocIndexEntry::parse(), DocInternal::parse(), DocLink::parse(), DocMermaidFile::parse(), DocMscFile::parse(), DocPara::parse(), DocParamList::parse(), DocPlantUmlFile::parse(), DocRef::parse(), DocRoot::parse(), DocSecRefItem::parse(), DocSecRefList::parse(), DocSection::parse(), DocText::parse(), DocHtmlList::parseXml(), DocHtmlRow::parseXml(), DocParamList::parseXml(), DocParser::processCopyDoc(), readIncludeFile(), DocParser::readTextFileByName(), skipSpacesForTable(), and MemberDefImpl::warnIfUndocumentedParams().

◆ warn_incomplete_doc

#define warn_incomplete_doc ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::IncompleteDoc,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
@ IncompleteDoc
Definition message.h:29

Definition at line 107 of file message.h.

Referenced by DocParser::checkUnOrMultipleDocumentedParams().

◆ warn_layout

#define warn_layout ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Layout,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)

Definition at line 117 of file message.h.

Referenced by LayoutParser::error(), mergeDocEntryLists(), LayoutParser::startElement(), and LayoutParser::startNavEntry().

◆ warn_uncond

◆ warn_undoc

#define warn_undoc ( file,
line,
fmt,
... )
Value:
do { \
msg_no_newline_allowed(fmt); \
warn_fmt(WarningType::Undocumented,file,line,FMT_STRING(fmt),##__VA_ARGS__); \
} while (0)
@ Undocumented
Definition message.h:28

Definition at line 102 of file message.h.

Referenced by computeClassRelations(), findMember(), MemberDefImpl::warnIfUndocumented(), and warnUndocumentedNamespaces().

Enumeration Type Documentation

◆ WarningType

enum class WarningType
strong
Enumerator
Generic 
Undocumented 
IncompleteDoc 
DocError 
Layout 

Definition at line 25 of file message.h.

26{
27 Generic,
31 Layout
32};

Function Documentation

◆ err_()

void err_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 169 of file message.cpp.

170{
171 {
172 std::unique_lock<std::mutex> lock(g_mutex);
173 if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile,"{}{}",g_errorStr,fmt::vformat(fmt,args));
174 }
176}
static const char * g_errorStr
Definition message.cpp:35
static bool checkWarnMessage(std::string_view msg)
Definition message.cpp:46
static std::mutex g_mutex
Definition message.cpp:41
static FILE * g_warnFile
Definition message.cpp:36
static void handle_warn_as_error()
Definition message.cpp:95

References checkWarnMessage(), err_(), g_errorStr, g_mutex, g_warnFile, and handle_warn_as_error().

Referenced by err_(), and err_fmt().

◆ err_fmt()

template<typename ... Args>
void err_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 46 of file message.h.

47{
48 err_(fmt,fmt::make_format_args(args...));
49}
void err_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:169

References err_(), and err_fmt().

Referenced by err_fmt().

◆ err_full_()

void err_full_ ( const DString & file,
int line,
fmt::string_view fmt,
fmt::format_args args )

Definition at line 180 of file message.cpp.

181{
182 format_warn(file,line,g_errorStr+fmt::vformat(fmt,args));
183}
static void format_warn(const DString &file, int line, const DString &text)
Definition message.cpp:51

References err_full_(), format_warn(), and g_errorStr.

Referenced by err_full_(), and err_full_fmt().

◆ err_full_fmt()

template<typename ... Args>
void err_full_fmt ( const DString & file,
int line,
fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 52 of file message.h.

53{
54 err_full_(file,line,fmt,fmt::make_format_args(args...));
55}
void err_full_(const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:180

References err_full_(), and err_full_fmt().

Referenced by err_full_fmt().

◆ finishWarnExit()

void finishWarnExit ( )

Definition at line 289 of file message.cpp.

290{
291 fflush(stdout);
292 if (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
293 {
295 g_warnFile = nullptr;
296 }
297 if (g_warnStat && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
298 {
299
300 std::ifstream warnFile = Portable::openInputStream(g_warnlogFile);
301 if (!warnFile.is_open())
302 {
303 g_warnFile = stderr;
304 err("Cannot open warnings file '{}' for reading\n",g_warnlogFile);
305 }
306 else
307 {
308 std::string line;
309 while (getline(warnFile,line))
310 {
311 fmt::print(stderr,"{}\n",line);
312 }
313 warnFile.close();
314 }
315 }
316
318
319 if (g_warnStat && (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS ||
320 g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT))
321 {
322 exit(1);
323 }
324}
static bool g_warnlogTemp
Definition message.cpp:39
static std::atomic_bool g_warnStat
Definition message.cpp:40
static WARN_AS_ERROR_t g_warnBehavior
Definition message.cpp:37
static DString g_warnlogFile
Definition message.cpp:38
#define err(fmt,...)
Definition message.h:127
std::ifstream openInputStream(const DString &name, bool binary=false, bool openAtEnd=false)
Definition portable.cpp:659
void unlink(const DString &fileName)
Definition portable.cpp:544
int fclose(FILE *f)
Definition portable.cpp:369

References err, Portable::fclose(), finishWarnExit(), g_warnBehavior, g_warnFile, g_warnlogFile, g_warnlogTemp, g_warnStat, Portable::openInputStream(), and Portable::unlink().

Referenced by finishWarnExit(), and generateOutput().

◆ has_newline_at_end()

template<std::size_t N>
bool has_newline_at_end ( const char(&) str[N])
constexpr

Definition at line 83 of file message.h.

84{
85 return str[N-2]=='\n';
86}

References has_newline_at_end().

Referenced by has_newline_at_end().

◆ initWarningFormat()

void initWarningFormat ( )

Definition at line 231 of file message.cpp.

232{
233 g_warnFormat = Config_getString(WARN_FORMAT);
234 g_warnLineFormat = Config_getString(WARN_LINE_FORMAT);
235 g_warnBehavior = Config_getEnum(WARN_AS_ERROR);
236 g_warnlogFile = Config_getString(WARN_LOGFILE);
237 if (g_warnlogFile.empty() && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT)
238 {
239 uint32_t pid = Portable::pid();
240 g_warnlogFile.sprintf("doxygen_warnings_temp_%d.tmp",pid);
241 g_warnlogTemp = true;
242 }
243
244 if (!g_warnlogFile.empty())
245 {
246 if (g_warnlogFile == "-")
247 {
248 g_warnFile = stdout;
249 }
250 else
251 {
253 Dir d(fi.dirPath());
254 if (!d.exists() && !d.mkdir(fi.dirPath()))
255 {
256 // point it to something valid, because warn() relies on it
257 g_warnFile = stderr;
258 err("Cannot create directory for '{}', redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile);
259 }
260 else if (!(g_warnFile = Portable::fopen(g_warnlogFile,"w")))
261 {
262 // point it to something valid, because warn() relies on it
263 g_warnFile = stderr;
264 err("Cannot open '{}' for writing, redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile);
265 }
266 }
267 }
268 else
269 {
270 g_warnFile = stderr;
271 }
272 if (g_warnBehavior != WARN_AS_ERROR_t::NO)
273 {
275 }
276
277 // make sure the g_warnFile is closed in case we call exit and it is still open
278 std::atexit([](){
279 if (g_warnFile && g_warnFile!=stderr && g_warnFile!=stdout)
280 {
282 g_warnFile = nullptr;
283 }
284 });
285}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:153
DString & sprintf(const char *format,...)
Definition dstring.cpp:29
const std::string & str() const
Definition dstring.h:634
Class representing a directory in the file system.
Definition dir.h:75
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
#define Config_getString(name)
Definition config.h:32
#define Config_getEnum(name)
Definition config.h:35
static DString g_warnFormat
Definition message.cpp:32
static DString g_warnLineFormat
Definition message.cpp:33
static const char * g_warningStr
Definition message.cpp:34
uint32_t pid()
Definition portable.cpp:248
FILE * fopen(const DString &fileName, const DString &mode)
Definition portable.cpp:349

References Config_getEnum, Config_getString, FileInfo::dirPath(), DString::empty(), err, Dir::exists(), Portable::fclose(), Portable::fopen(), g_errorStr, g_warnBehavior, g_warnFile, g_warnFormat, g_warningStr, g_warnLineFormat, g_warnlogFile, g_warnlogTemp, initWarningFormat(), Dir::mkdir(), Portable::pid(), DString::sprintf(), and DString::str().

Referenced by checkConfiguration(), and initWarningFormat().

◆ msg_()

void msg_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 124 of file message.cpp.

125{
126 if (!Config_getBool(QUIET))
127 {
128 std::unique_lock<std::mutex> lock(g_mutex);
130 {
131 fmt::print("{:.3f} sec: ",(static_cast<double>(Debug::elapsedTime())));
132 }
133 fmt::print("{}",fmt::vformat(fmt,args));
134 }
135}
@ Time
Definition debug.h:35
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:133
static double elapsedTime()
Definition debug.cpp:201
#define Config_getBool(name)
Definition config.h:33

References Config_getBool, Debug::elapsedTime(), g_mutex, Debug::isFlagSet(), msg_(), and Debug::Time.

Referenced by msg_(), and msg_fmt().

◆ msg_fmt()

template<typename ... Args>
void msg_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 64 of file message.h.

65{
66 msg_(fmt,fmt::make_format_args(args...));
67}
void msg_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:124

References msg_(), and msg_fmt().

Referenced by msg_fmt().

◆ term_()

void term_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 187 of file message.cpp.

188{
189 {
190 std::unique_lock<std::mutex> lock(g_mutex);
191 if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile, "{}{}", g_errorStr, fmt::vformat(fmt,args));
192 if (g_warnFile != stderr)
193 {
194 size_t l = strlen(g_errorStr);
195 for (size_t i=0; i<l; i++) fmt::print(g_warnFile, " ");
196 fmt::print(g_warnFile, "{}\n", "Exiting...");
197 if (!Config_getBool(QUIET))
198 {
199 // cannot use `msg` due to the mutex
200 fmt::print("See '{}' for the reason of termination.\n",g_warnlogFile);
201 }
202 }
203 }
204 exit(1);
205}

References checkWarnMessage(), Config_getBool, g_errorStr, g_mutex, g_warnFile, g_warnlogFile, and term_().

Referenced by term_(), and term_fmt().

◆ term_fmt()

template<typename ... Args>
void term_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 58 of file message.h.

59{
60 term_(fmt,fmt::make_format_args(args...));
61}
void term_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:187

References term_(), and term_fmt().

Referenced by term_fmt().

◆ warn_()

void warn_ ( WarningType type,
const DString & file,
int line,
fmt::string_view fmt,
fmt::format_args args )

Definition at line 139 of file message.cpp.

140{
141 bool enabled = false;
142 switch (type)
143 {
144 case WarningType::Generic: enabled = Config_getBool(WARNINGS); break;
145 case WarningType::Undocumented: enabled = Config_getBool(WARN_IF_UNDOCUMENTED); break;
146 case WarningType::IncompleteDoc: enabled = Config_getBool(WARN_IF_INCOMPLETE_DOC); break;
147 case WarningType::DocError: enabled = Config_getBool(WARN_IF_DOC_ERROR); break;
148 case WarningType::Layout: enabled = Config_getBool(WARN_LAYOUT_FILE); break;
149 }
150 if (enabled)
151 {
152 do_warn(file, line, g_warningStr, fmt, args);
153 }
154}
static void do_warn(const DString &file, int line, const char *prefix, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:116

References Config_getBool, do_warn(), DocError, g_warningStr, Generic, IncompleteDoc, Layout, Undocumented, and warn_().

Referenced by warn_(), and warn_fmt().

◆ warn_flush()

void warn_flush ( )

Definition at line 224 of file message.cpp.

225{
226 fflush(g_warnFile);
227}

References g_warnFile, and warn_flush().

Referenced by Statistics::end(), and warn_flush().

◆ warn_fmt()

template<typename ... Args>
void warn_fmt ( WarningType type,
const DString & file,
int line,
fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 70 of file message.h.

71{
72 warn_(type,file,line,fmt,fmt::make_format_args(args...));
73}
void warn_(WarningType type, const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:139

References warn_(), and warn_fmt().

Referenced by warn_fmt().

◆ warn_line()

DString warn_line ( const DString & file,
int line )

Definition at line 209 of file message.cpp.

210{
211 DString fileSubst = file.empty() ? "<unknown>" : file;
212 DString lineSubst; lineSubst.setNum(line);
213 return substitute(
216 "$file",fileSubst
217 ),
218 "$line",lineSubst
219 );
220}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:89
DString & setNum(short n)
Definition dstring.h:541
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:480

References DString::empty(), g_warnLineFormat, DString::setNum(), substitute(), and warn_line().

Referenced by addMemberFunction(), checkPageRelations(), computePageRelations(), findGlobalMember(), and warn_line().

◆ warn_uncond_()

void warn_uncond_ ( fmt::string_view fmt,
fmt::format_args args )

Definition at line 158 of file message.cpp.

159{
160 {
161 std::unique_lock<std::mutex> lock(g_mutex);
162 if (checkWarnMessage(g_errorStr+fmt::vformat(fmt,args))) fmt::print(g_warnFile,"{}{}",g_warningStr,vformat(fmt,args));
163 }
165}

References checkWarnMessage(), g_errorStr, g_mutex, g_warnFile, g_warningStr, handle_warn_as_error(), and warn_uncond_().

Referenced by warn_uncond_(), and warn_uncond_fmt().

◆ warn_uncond_fmt()

template<typename ... Args>
void warn_uncond_fmt ( fmt::format_string< Args... > fmt,
Args &&... args )

Definition at line 76 of file message.h.

77{
78 warn_uncond_(fmt,fmt::make_format_args(args...));
79}
void warn_uncond_(fmt::string_view fmt, fmt::format_args args)
Definition message.cpp:158

References warn_uncond_(), and warn_uncond_fmt().

Referenced by warn_uncond_fmt().