ATLAS Offline Software
Loading...
Searching...
No Matches
MessagePrinterErrorCollect.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9//
10// includes
11//
12
14
15#include <regex>
16
17//
18// method implementations
19//
20
21#ifdef XAOD_STANDALONE
22
23namespace asg
24{
25 void MessagePrinterErrorCollect ::
26 print (MSG::Level reglvl, const std::string& /*name*/,
27 const std::string& text)
28 {
29 if (reglvl >= MSG::ERROR)
30 {
31 m_errorMessages.push_back (text);
32 }
33 }
34
35
36
37 bool MessagePrinterErrorCollect ::
38 empty () const noexcept
39 {
40 return m_errorMessages.empty();
41 }
42
43
44
45 bool MessagePrinterErrorCollect ::
46 matchesRegex (const std::string& pattern) const
47 {
48 std::regex regex (pattern);
49 for (auto& msg : m_errorMessages)
50 {
51 if (std::regex_search (msg, regex))
52 return true;
53 }
54 return false;
55 }
56
57
58
59 std::string MessagePrinterErrorCollect ::
60 asString (const std::string& prefix) const
61 {
62 std::string result;
63 for (auto& msg : m_errorMessages)
64 {
65 if (!result.empty())
66 result += "\n";
67 result += prefix + msg;
68 }
69 return result;
70 }
71}
72
73#endif
MsgStream & msg
Definition testRead.cxx:32