KiCad PCB EDA Suite
Loading...
Searching...
No Matches
report_severity.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21#include <i18n_utility.h>
22#include <vector>
23#include <wx/arrstr.h> // for MSVC to see std::vector<wxString> is exported from wx
24
25
26wxString formatSeverities( int aSeverities )
27{
28 wxString result;
29 std::vector<wxString> items;
30
31 if( aSeverities & RPT_SEVERITY_ERROR )
32 items.push_back( wxS( "Errors" ) );
33
34 if( aSeverities & RPT_SEVERITY_WARNING )
35 items.push_back( wxS( "Warnings" ) );
36
37 if( aSeverities & RPT_SEVERITY_EXCLUSION )
38 items.push_back( wxS( "Exclusions" ) );
39
40 if( items.empty() )
41 return wxS( "None" );
42
43 for( size_t i = 0; i < items.size(); i++ )
44 {
45 result += items[i];
46
47 if( i < items.size() - 1 )
48 result += wxS( ", " );
49 }
50
51 return result;
52}
53
Some functions to handle hotkeys in KiCad.
wxString formatSeverities(int aSeverities)
Convert a severity mask to a human-readable comma-separated string.
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_EXCLUSION
wxString result
Test unit parsing edge cases and error handling.